From 230688a0b842cf57b316a7ba62910ca387afbce7 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 3 Aug 2015 12:49:29 +0200 Subject: Start of complete rewrite to switch to hakyll --- .gitignore | 18 +- README | 5 - all.do | 1 - blog.cabal | 23 + blog.nix | 17 + build/extract-title.hs | 25 - build/generate-rss.hs | 88 -- build/preamble.tex | 259 ------ build/preview/preview.dtx | 1872 ------------------------------------------ build/preview/preview.ins | 44 - build/preview/preview.sty.do | 4 - build/template.html5 | 55 -- build/tex-filter.hs | 61 -- clean.do | 4 - default.html.do | 15 - default.nix | 22 +- default.svg.do | 28 - do | 177 ---- getopts_long.sh | 701 ---------------- htdocs.do | 3 - index.md.do | 27 - lists.sh | 66 -- posts.sh | 41 - rss/default.rss.do | 4 - src/Site.hs | 16 + style.css | 40 - sync.do | 2 - templates/default.html | 55 ++ 28 files changed, 126 insertions(+), 3547 deletions(-) delete mode 100644 README delete mode 100644 all.do create mode 100644 blog.cabal create mode 100644 blog.nix delete mode 100755 build/extract-title.hs delete mode 100755 build/generate-rss.hs delete mode 100644 build/preamble.tex delete mode 100644 build/preview/preview.dtx delete mode 100644 build/preview/preview.ins delete mode 100644 build/preview/preview.sty.do delete mode 100644 build/template.html5 delete mode 100755 build/tex-filter.hs delete mode 100644 clean.do delete mode 100644 default.html.do delete mode 100644 default.svg.do delete mode 100755 do delete mode 100644 getopts_long.sh delete mode 100644 htdocs.do delete mode 100644 index.md.do delete mode 100755 lists.sh delete mode 100755 posts.sh delete mode 100644 rss/default.rss.do create mode 100644 src/Site.hs delete mode 100644 style.css delete mode 100644 sync.do create mode 100644 templates/default.html diff --git a/.gitignore b/.gitignore index 16e0d46..c4a847d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1 @@ -.do_built* -build/preview/* -!build/preview/preview.dtx -!build/preview/preview.ins -!build/preview/preview.sty.do -htdocs -nginx - -*.html -*.rss -index.md -lists/*.md -lists/*/preview -tex/ - -cabal.sandbox.config -.cabal-sandbox/ \ No newline at end of file +/result diff --git a/README b/README deleted file mode 100644 index 13b8af0..0000000 --- a/README +++ /dev/null @@ -1,5 +0,0 @@ -This is my personal take on a static blogging system. I make integral -use of djb's redo (for more information see https://github.com/apenwarr/redo). -However, the whole thing is a pretty big mess. - -Caveat lector. \ No newline at end of file diff --git a/all.do b/all.do deleted file mode 100644 index 9facf1a..0000000 --- a/all.do +++ /dev/null @@ -1 +0,0 @@ -redo-ifchange index.html diff --git a/blog.cabal b/blog.cabal new file mode 100644 index 0000000..b8daa19 --- /dev/null +++ b/blog.cabal @@ -0,0 +1,23 @@ +-- Initial beuteltier.cabal generated by cabal init. For further +-- documentation, see http://haskell.org/cabal/users-guide/ + +name: dirty-haskell +version: 0.0.0 +-- synopsis: +-- description: +homepage: git://git.yggdrasil.li/dirty-haskell.org +-- license: PublicDomain +-- license-file: LICENSE +author: Gregor Kleen +maintainer: aethoago@141.li +copyright: N/A +category: Web +build-type: Simple +-- extra-source-files: +cabal-version: >=1.10 + +executable site + hs-source-dirs: src + main-is: Site.hs + build-depends: base >=4.7 && <4.8 + , hakyll >=4.6 && <5 diff --git a/blog.nix b/blog.nix new file mode 100644 index 0000000..52e23ca --- /dev/null +++ b/blog.nix @@ -0,0 +1,17 @@ +# This file was auto-generated by cabal2nix. Please do NOT edit manually! + +{ mkDerivation, stdenv +, hakyll +}: + +mkDerivation { + pname = "dirty-haskell"; + version = "0.0.0"; + src = ./.; + isExecutable = true; + isLibrary = false; + buildDepends = [ + hakyll + ]; + license = stdenv.lib.licenses.publicDomain; +} diff --git a/build/extract-title.hs b/build/extract-title.hs deleted file mode 100755 index 6964d26..0000000 --- a/build/extract-title.hs +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env runhaskell - --- import Text.Pandoc.Pretty --- import Text.Pandoc.JSON -import Text.Pandoc.Pretty -import Text.Pandoc.JSON -import qualified Text.Pandoc.Walk as W -import System.IO -import qualified Data.Aeson as A -import qualified Data.ByteString.Lazy as BL - -extract_title :: Pandoc -> String -extract_title (Pandoc m _) = do - title <- render Nothing $ cat $ map pretty (docTitle m) - return title - where pretty :: Inline -> Doc - pretty (Str s) = text s - pretty Space = space - pretty _ = empty - -main :: IO () -main = do - input <- BL.getContents - let title = (W.query extract_title :: Pandoc -> String) . either error id . A.eitherDecode' $ input - putStrLn title diff --git a/build/generate-rss.hs b/build/generate-rss.hs deleted file mode 100755 index 2263ba8..0000000 --- a/build/generate-rss.hs +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env runhaskell - -import System.Environment (getArgs) -import qualified Control.Monad.State as S -import Control.Monad (sequence) - -import Text.Feed.Constructor -import Text.Feed.Util -import Text.Feed.Export -import Text.Feed.Types - -import Text.Pandoc -import Text.Pandoc.Pretty - -import qualified System.Time as T -import qualified System.Posix.Files as F -import qualified Text.XML.Light.Output as X -import qualified System.FilePath as FP -import System.Posix.Types - -import Data.Maybe (fromMaybe) -import Data.List (dropWhileEnd, isSuffixOf) - -type FeedState = (Feed, Maybe T.ClockTime) - -feedKind = RSSKind $ Just "2.0" - -baseurl = "http://dirty-haskell.org" - -description = "dirty-haskell.org — a blog" - -mkUrl' :: FilePath -> String -mkUrl' path = (++) (baseurl ++ "/posts/") $ (flip FP.replaceExtension) "html" $ FP.takeFileName path - - -extract_title :: Pandoc -> String -extract_title (Pandoc m _) = do - title <- render Nothing $ cat $ map pretty (docTitle m) - return title - where pretty :: Inline -> Doc - pretty (Str s) = text s - pretty Space = space - pretty _ = empty - -main :: IO () -main = do - (title:entries) <- getArgs - currentTime <- T.getClockTime - let feed = foldl1 (.) - [ withFeedDescription description - , withFeedHome baseurl - , withFeedTitle title - ] $ newFeed feedKind - (populatedFeed, itemTime) <- S.execStateT (sequence $ map addItem' entries) (feed, Nothing) - let populatedFeed' = withFeedPubDate (toFeedDateString feedKind $ fromMaybe currentTime itemTime) $ withFeedLastUpdate (toFeedDateString feedKind currentTime) $ populatedFeed - putStrLn $ X.ppElement $ xmlFeed populatedFeed' - -addItem' :: FilePath -> S.StateT FeedState IO () -addItem' mdFile = do - url <- S.liftIO $ mkUrl mdFile - fileStatus <- S.liftIO $ F.getSymbolicLinkStatus mdFile - fileContents <- S.liftIO $ readFile mdFile - let title = extract_title $ document - contents = writeAsciiDoc def document - document = readMarkdown def fileContents - (feed, time) <- S.get - let fileTime = maximum ([F.modificationTime, F.statusChangeTime] <-> fileStatus) :: System.Posix.Types.EpochTime - fileTime' = T.TOD (toInteger $ fromEnum fileTime) 0 - let item = foldl1 (.) - [ withItemTitle title - , withItemLink url - , withItemId True url - , withItemDate $ toFeedDateString feedKind fileTime' - , withItemDescription contents - ] $ newItem feedKind :: Item - S.put (addItem item feed, if (Just fileTime' > time) then Just fileTime' else time) - -mkUrl :: FilePath -> IO String -mkUrl link = do - status <- F.getSymbolicLinkStatus link - if F.isSymbolicLink status then - do target <- F.readSymbolicLink link - mkUrl $ FP.combine (FP.takeDirectory link) target - else - return $ mkUrl' link -(<->) :: [(a -> b)] -> a -> [b] -[] <-> _ = [] -(f:fs) <-> x = (f x:fs <-> x) diff --git a/build/preamble.tex b/build/preamble.tex deleted file mode 100644 index cf3623b..0000000 --- a/build/preamble.tex +++ /dev/null @@ -1,259 +0,0 @@ -\documentclass[14pt,preview,border=1pt,class=extarticle]{standalone} - -\usepackage{amssymb} -\usepackage{amsmath} -\usepackage{etoolbox} -\usepackage{xspace} -\usepackage{mathrsfs} -\usepackage{xifthen} - -\usepackage{tikz} -\usetikzlibrary{arrows,decorations.markings,chains,calc,matrix} -\usepackage{tikz-cd} -\tikzset{>=cm to} - -\usepackage{mathtools} - -\undef\Re -\undef\Im - -\DeclareMathOperator{\colim}{\textnormal{colim}} -\DeclareMathOperator{\Spec}{\textnormal{Spec}} -\DeclareMathOperator{\im}{\textnormal{im}} -\DeclareMathOperator{\Sing}{\textnormal{Sing}} -\DeclareMathOperator{\Map}{\textnormal{Map}} -\DeclareMathOperator{\InnHom}{\textnormal{\textbf{Hom}}} -\DeclareMathOperator{\Hom}{\textnormal{Hom}} -\undef\hom -\DeclareMathOperator{\hom}{\textnormal{hom}} -\DeclareMathOperator{\nerve}{\textnormal{N}} -\DeclareMathOperator{\simpnerve}{\textnormal{sN}} -\DeclareMathOperator{\core}{\textnormal{Core}} -\DeclareMathOperator{\id}{\textnormal{id}} -\undef\lim -\DeclareMathOperator{\lim}{\textnormal{lim}} -\DeclareMathOperator{\Op}{\textnormal{op}} -\DeclareMathOperator{\yon}{\textnormal{y}} -\DeclareMathOperator{\HomL}{\textnormal{\textbf{Hom}}^{\textnormal{L}}} -\DeclareMathOperator{\sk}{\textnormal{sk}} -\DeclareMathOperator{\cosk}{\textnormal{cosk}} -\DeclareMathOperator{\thom}{\textnormal{Th}} -\DeclareMathOperator{\Bl}{\textnormal{Bl}} -\DeclareMathOperator{\Stab}{\textnormal{Stab}} -\DeclareMathOperator{\Grp}{\textnormal{\textsf{Grp}}} -\DeclareMathOperator{\Set}{\textnormal{\textsf{Set}}} - -\newcommand*{\alg}[1]{\ensuremath{\overline{#1}}\xspace} -\newcommand*{\sep}[1]{\ensuremath{#1^{\textnormal{sep}}}\xspace} -\newcommand*{\ab}[1]{\ensuremath{#1^{\textnormal{ab}}}\xspace} -\newcommand*{\units}[1]{\ensuremath{#1^\times}\xspace} -\newcommand*{\lapl}{\Delta} -\newcommand*{\grad}{\nabla} -\newcommand*{\op}[1]{\ensuremath{#1^{\textnormal{op}}}\xspace} -\newcommand*{\codiag}[1]{\ensuremath{\nabla\mkern-3mu_{#1}}\xspace} -\newcommand*{\diag}[1]{\ensuremath{\Delta_{#1}}\xspace} - -\newcommand*{\cech}{\v{C}ech\xspace} -\newcommand*{\mc}{\operatorname{\textnormal{\v{C}}}} - -\newcommand*{\normal}{\lhd} -\newcommand*{\isom}{\cong} -\newcommand*{\homot}{\sim} -\newcommand*{\cequiv}{\simeq} - -\makeatletter -\let\@oldsubset=\subset -\def\@subsethelper#1#2{\mathrel{\raisebox{.5pt}{$#1\@oldsubset$}}\xspace} -\DeclareRobustCommand*{\subset}{\mathpalette\@subsethelper\relax} - -\let\@oldotimes=\otimes -\def\@otimeshelper#1#2{\mathrel{\raisebox{.5pt}{$#1\@oldotimes$}}\xspace} -\DeclareRobustCommand*{\otimes}{\mathpalette\@otimeshelper\relax} -\makeatother - -\tikzset{/tikz/commutative diagrams/arrows={thin}} - -\makeatletter -\newbox\@xrat -\renewcommand*{\xrightarrow}[2][-cm to]{% - \setbox\@xrat=\hbox{\ensuremath{\scriptstyle #2}} - \pgfmathsetlengthmacro{\@xratlen}{max(1.6em,\wd\@xrat+.6em)} - \pgfmathsetlengthmacro{\@xratinnersep}{.5ex-\dp\@xrat} - \mathrel{\tikz [#1,baseline=-.6ex] - \draw (0,0) -- node[auto,inner sep=\@xratinnersep] {\box\@xrat} (\@xratlen,0) ;}} -\renewcommand*{\xleftarrow}[2][cm to-]{% - \setbox\@xrat=\hbox{\ensuremath{\scriptstyle #2}} - \pgfmathsetlengthmacro{\@xratlen}{max(1.6em,\wd\@xrat+.6em)} - \pgfmathsetlengthmacro{\@xratinnersep}{.5ex-\dp\@xrat} - \mathrel{\tikz [#1,baseline=-.6ex] - \draw (0,0) -- node[auto,inner sep=\@xratinnersep] {\box\@xrat} (\@xratlen,0) ;}} -\newcommand*{\xrightarrowb}[2][-cm to]{% - \setbox\@xrat=\hbox{\ensuremath{\scriptstyle #2}} - \pgfmathsetlengthmacro{\@xratlen}{max(1.6em,\wd\@xrat+.6em)} - \pgfmathsetlengthmacro{\@xratinnersep}{.5ex} - \mathrel{\tikz [#1,baseline=-.6ex] - \draw (0,0) -- node[auto,inner sep=\@xratinnersep] {\box\@xrat} (\@xratlen,0) ;}} -\newcommand*{\xleftarrowb}[2][cm to-]{% - \setbox\@xrat=\hbox{\ensuremath{\scriptstyle #2}} - \pgfmathsetlengthmacro{\@xratlen}{max(1.6em,\wd\@xrat+.6em)} - \pgfmathsetlengthmacro{\@xratinnersep}{.5ex} - \mathrel{\tikz [#1,baseline=-.6ex] - \draw (0,0) -- node[auto,inner sep=\@xratinnersep] {\box\@xrat} (\@xratlen,0) ;}} - -\pgfarrowsdeclare{my right hook}{my right hook} -{ -\arrowsize=0.2pt -\advance\arrowsize by .5\pgflinewidth -\pgfarrowsleftextend{-.5\pgflinewidth} -\pgfarrowsrightextend{3.5\arrowsize+.5\pgflinewidth} -} -{ -\arrowsize=0.2pt -\advance\arrowsize by .5\pgflinewidth -\pgfsetdash{}{0pt} % do not dash -\pgfsetroundjoin % fix join -\pgfsetroundcap % fix cap -\pgfpathmoveto{\pgfpoint{0\arrowsize}{-7\arrowsize}} -\pgfpatharc{-90}{90}{3.5\arrowsize} -\pgfusepathqstroke -} - -\tikzset{% - iso/.style={above,sloped,inner sep=0}, - iso'/.style={below,sloped,inner sep=0}, - to/.style={-cm to}, - onto/.style={-cm double to}, - into/.style={my right hook-cm to}, - mapsto/.style={|-cm to}, - clim/.style={decoration={markings, - mark=at position#1 with {\draw[-] (0,-3\pgflinewidth) -- (0,3\pgflinewidth);}}, - postaction=decorate}, - clim/.default=0.5, - opim/.style={decoration={markings, - mark=at position#1 with {\draw[-] circle(3\pgflinewidth);}}, - postaction=decorate}, - opim/.default=0.5 -} - -\newcommand*\@tikzto[2]{\mathrel{\begin{tikzpicture}[baseline]% - \draw[to,line width={#2\pgflinewidth},scale=#1](0,.55ex) -- (1.6em,.55ex);% - \end{tikzpicture}}} - -\newcommand*\@tikzcto[2]{\mathrel{\begin{tikzpicture}[baseline]% - \draw[to,line width={#2\pgflinewidth},scale=#1](0,.55ex) -- (0.8em,.55ex);% - \end{tikzpicture}}} - -\newcommand*\@tikzonto[2]{\mathrel{\begin{tikzpicture}[baseline]% - \draw[onto,line width={#2\pgflinewidth},scale=#1](0,.55ex) -- (1.6em,.55ex);% - \end{tikzpicture}}} - -\newcommand*\@tikzinto[2]{\mathrel{\begin{tikzpicture}[baseline]% - \draw[into,line width={#2\pgflinewidth},scale=#1](0,.55ex) -- (1.6em,.55ex);% - \end{tikzpicture}}} - -\newcommand*\@tikzclim[2]{\mathrel{\begin{tikzpicture}[baseline]% - \draw[into,clim,line width={#2\pgflinewidth},scale=#1](0,.55ex) -- (1.6em,.55ex);% - \end{tikzpicture}}} - -\newcommand*\@tikzopim[2]{\mathrel{\begin{tikzpicture}[baseline]% - \draw[into,opim,line width={#2\pgflinewidth},scale=#1](0,.55ex) -- (1.6em,.55ex);% - \end{tikzpicture}}} - -\newcommand*\@tikzmapsto[2]{\mathrel{\begin{tikzpicture}[baseline]% - \draw[mapsto,line width={#2\pgflinewidth},scale=#1](0,.55ex) -- (1.6em,.55ex);% - \end{tikzpicture}}} - -\newcommand*\@tikziso[4]{\mathrel{\begin{tikzpicture}[baseline]% - \draw[to,line width={#2\pgflinewidth},scale=#1](0,.55ex) -- node[iso,pos=0.47,inner sep=#4]{$#3\sim$} (1.6em,.55ex);% - \end{tikzpicture}}} - -\newcommand*\tikzto{\mathchoice{\@tikzto{1.0}{1}}{\@tikzto{1.0}{1}}{\@tikzcto{0.8}{0.9}}{\@tikzcto{0.6}{0.75}}} -\newcommand*\tikzcto{\mathchoice{\@tikzcto{1.0}{1}}{\@tikzcto{1.0}{1}}{\@tikzcto{0.8}{0.9}}{\@tikzcto{0.6}{0.75}}} -\newcommand*\tikzonto{\mathchoice{\@tikzonto{1.0}{1}}{\@tikzonto{1.0}{1}}{\@tikzonto{0.8}{0.9}}{\@tikzonto{0.6}{0.75}}} -\newcommand*\tikzinto{\mathchoice{\@tikzinto{1.0}{1}}{\@tikzinto{1.0}{1}}{\@tikzinto{0.8}{0.9}}{\@tikzinto{0.6}{0.75}}} -\newcommand*\tikzclim{\mathchoice{\@tikzclim{1.0}{1}}{\@tikzclim{1.0}{1}}{\@tikzclim{0.8}{0.9}}{\@tikzclim{0.6}{0.75}}} -\newcommand*\tikzopim{\mathchoice{\@tikzopim{1.0}{1}}{\@tikzopim{1.0}{1}}{\@tikzopim{0.8}{0.9}}{\@tikzopim{0.6}{0.75}}} -\newcommand*\tikzmapsto{\mathchoice{\@tikzmapsto{1.0}{1}}{\@tikzmapsto{1.0}{1}}{\@tikzmapsto{0.8}{0.9}}{\@tikzmapsto{0.6}{0.75}}} -\newcommand*\tikziso{\mathchoice{\@tikziso{1.0}{1}{\displaystyle}{0pt}}% - {\@tikziso{1.0}{1}{\textstyle}{0pt}}% - {\@tikziso{0.8}{0.9}{\scriptstyle}{0pt}}% - {\@tikziso{0.67}{0.8}{\scriptscriptstyle}{0.15ex}}} -\makeatother - -\renewcommand*{\to}[1][]{\ifthenelse{\isempty{#1}}{\tikzto}{\xrightarrowb{#1}}} -\newcommand*{\cto}{\ensuremath{\tikzcto}} -\newcommand*{\into}[1][]{\ifthenelse{\isempty{#1}}{\tikzinto}{\xrightarrowb[into]{#1}}} -\newcommand*{\onto}[1][]{\ifthenelse{\isempty{#1}}{\tikzonto}{\xrightarrowb[onto]{#1}}} -\newcommand*{\clim}{\tikzclim} -\newcommand*{\opim}{\tikzopim} - -\newcommand*{\iso}{\tikziso} - -\renewcommand*{\mapsto}{\tikzmapsto} - -\newcommand*{\ca}[1]{\ensuremath{\mathscr{#1}}\xspace} -\renewcommand*{\cal}[1]{\ensuremath{\mathcal{#1}}\xspace} -\newcommand*{\f}[1]{\ensuremath{\mathfrak{#1}}\xspace} - -\newcommand{\cl}[2][0]{{}\mkern#1mu\overline{\mkern-#1mu#2}} -\newcommand*{\Int}[1]{\ensuremath{#1^\circ}\xspace} - -\newcommand*{\infcat}[1][1]{\((\infty,#1)\)–category\xspace} -\newcommand*{\linfcat}{\(\infty\)–category\xspace} -\newcommand*{\infcats}[1][1]{\((\infty,#1)\)–categories\xspace} -\newcommand*{\linfcats}{\(\infty\)–categories\xspace} -\newcommand*{\Cat}{\textnormal{\textsf{Cat}}} -\newcommand*{\spc}{\textnormal{\textbf{Spc}}} -\newcommand*{\ICat}{\textnormal{\textbf{Cat}}} -\newcommand*{\infpshv}{\operatorname{\textnormal{\textbf{PShv}}}} -\newcommand*{\infshv}{\operatorname{\textnormal{\textbf{Sh}}}} -\newcommand*{\hypshv}{\operatorname{\widehat{\textnormal{\textbf{Sh}}}}} -\newcommand*{\hyp}[1][]{\operatorname{\ca H}^{#1}\mkern-2mu} -\newcommand*{\phyp}[1][]{\operatorname{\ca H}^{#1}_{\bullet}\mkern-2mu} -\newcommand*{\sh}{\operatorname{\ca{SH}}} -\newcommand*{\shv}{\operatorname{\textnormal{\textsf{Shv}}}} -\newcommand*{\pshv}{\operatorname{\textnormal{\textsf{PShv}}}} -\newcommand*{\Aff}{\operatorname{\textnormal{\textsf{Aff}}}} -\newcommand*{\Ring}{\operatorname{\textnormal{\textsf{Ring}}}} -\newcommand*{\Alg}{\operatorname{\textnormal{\textsf{Alg}}}} -\newcommand*{\Disc}{\operatorname{\textnormal{\textsf{Disc}}}} -\newcommand*{\mfd}{\operatorname{\textnormal{\textsf{Mfd}}}} -\newcommand*{\sm}[1][k]{\mathop{\textnormal{\textsf{Sm}}/#1}} -\newcommand*{\Simp}{\mathbf{\Delta}} -\newcommand*{\sset}{\operatorname{\textnormal{\textsf{sSet}}}} -\newcommand*{\ssetQ}{\operatorname{\textnormal{\textsf{sSet}}_{\textnormal{\textsf{Q}}}}} -\newcommand*{\ssetJ}{\operatorname{\textnormal{\textsf{sSet}}_{\textnormal{\textsf{J}}}}} -\newcommand*{\Top}{\operatorname{\textnormal{\textsf{Top}}}} -\newcommand*{\qcat}{\operatorname{\textnormal{\textsf{qCat}}_{2}}} -\newcommand*{\Fin}{\operatorname{\textnormal{\textsf{Fin}}_{*}}} -\newcommand*{\tang}[1]{\textnormal{T}\mkern-2mu_{#1}} -\newcommand*{\dual}[1]{\textnormal{D}#1} -\newcommand*{\sch}[1][k]{\mathop{\textnormal{\textsf{Sch}}/#1}} - -\def\<#1>{\left\langle #1 \right\rangle} - -\newcommand{\dd}[1][]{% - \mathrm{d}% - \if\relax\detokenize{#1}\relax% - \else% - ^{#1}\mkern-1.5mu% - \fi% -} - -\newcommand{\Diff}[1][]{% - \mathrm{D}% - \if\relax\detokenize{#1}\relax% - \else% - ^{#1}\m - kern-1.5mu% - \fi% -} - -\newcommand{\ddd}[1][]{% - \mathop{}\!\dd[#1]% -} - -\undef\AA -\undef\SS -\renewcommand*{\do}[1]{\expandafter\def\csname#1#1\endcsname{\ensuremath{\mathbb{#1}}\xspace}} -\docsvlist{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z} diff --git a/build/preview/preview.dtx b/build/preview/preview.dtx deleted file mode 100644 index 0675c27..0000000 --- a/build/preview/preview.dtx +++ /dev/null @@ -1,1872 +0,0 @@ -% \iffalse -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -% -% Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, -% 2010 Free Software Foundation -% -% This program is free software; you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation; either version 3 of the License, or -% (at your option) any later version. -% -% This program is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with this program; if not, write to the -% Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -% Boston, MA 02110-1301 USA -% \fi -% \CheckSum{1758} -% \GetFileInfo{preview.sty} -% \date{\filedate} -% \author{David Kastrup\thanks{\texttt{dak@gnu.org}}} -% \title{The \texttt{preview} Package for \LaTeX\\Version \fileversion} -% \maketitle -% \section{Introduction} -% The main purpose of this package is the extraction of certain -% environments (most notably displayed formulas) from \LaTeX\ sources -% as graphics. This works with DVI files postprocessed by either -% Dvips and Ghostscript or dvipng, but it also works when you are -% using PDF\TeX\ for generating PDF files (usually also postprocessed -% by Ghostscript). -% -% Current uses of the package include the \previewlatex\ package for -% WYSIWYG functionality in the AUC\TeX\ editing environment, -% generation of previews in LyX, as part of the operation of the -% ps4pdf package, the tbook XML system and some other tools. -% -% Producing EPS files with Dvips and its derivatives using the -% \texttt{-E} option is not a good alternative: People make do by -% fiddling around with |\thispagestyle{empty}| and hoping for the best -% (namely, that the specified contents will indeed fit on single -% pages), and then trying to guess the baseline of the resulting code -% and stuff, but this is at best dissatisfactory. The preview package -% provides an easy way to ensure that exactly one page per request -% gets shipped, with a well-defined baseline and no page decorations. -% While you still can use the preview package with the `classic' -% \begin{quote} -% |dvips -E -i| -% \end{quote} -% invocation, there are better ways available that don't rely on Dvips -% not getting confused by PostScript specials. -% -% For most applications, you'll want to make use of the |tightpage| -% option. This will embed the page dimensions into the PostScript or -% PDF code, obliterating the need to use the |-E -i| options to Dvips. -% You can then produce all image files with a single run of -% Ghostscript from a single PDF or PostScript (as opposed to EPS) -% file. -% -% Various options exist that will pass \TeX\ dimensions and other -% information about the respective shipped out material (including -% descender size) into the log file, where external applications might -% make use of it. -% -% The possibility for generating a whole set of graphics with a single -% run of Ghostscript (whether from \LaTeX\ or PDF\LaTeX) increases -% both speed and robustness of applications. It is also feasible to -% use dvipng on a DVI file with the options -% \begin{quote} -% |-picky -noghostscript| -% \end{quote} -% to omit generating any image file that requires Ghostscript, then -% let a script generate all missing files using Dvips/Ghostscript. -% This will usually speed up the process significantly. -% -% \section{Package options} -% The package is included with the customary -% \begin{quote} -% |\usepackage|\oarg{options}|{preview}| -% \end{quote} -% You should usually load this package as the last one, since it -% redefines several things that other packages may also provide. -% -% The following options are available: -% \begin{description} -% \item[|active|] is the most essential option. If this option is not -% specified, the |preview| package will be inactive and the document -% will be typeset as if the |preview| package were not loaded, -% except that all declarations and environments defined by the -% package are still legal but have no effect. This allows defining -% previewing characteristics in your document, and only activating -% them by calling \LaTeX\ as -% \begin{quote} -% \raggedright -% |latex '\PassOptionsToPackage{active}{preview}| |\input|\marg{filename}|'| -% \end{quote} -% \item[|noconfig|] Usually the file |prdefault.cfg| gets loaded -% whenever the |preview| package gets activated. |prdefault.cfg| is -% supposed to contain definitions that can cater for otherwise bad -% results, for example, if a certain document class would otherwise -% lead to trouble. It also can be used to override any settings -% made in this package, since it is loaded at the very end of it. -% In addition, there may be configuration files specific for certain -% |preview| options like |auctex| which have more immediate needs. -% The |noconfig| option suppresses loading of those option files, -% too. -% \item[|psfixbb|] Dvips determines the bounding boxes from the -% material in the DVI file it understands. Lots of PostScript -% specials are not part of that. Since the \TeX\ boxes do not make -% it into the DVI file, but merely characters, rules and specials -% do, Dvips might include far too small areas. The option |psfixbb| -% will include |/dev/null| as a graphic file in the ultimate upper -% left and lower right corner of the previewed box. This will make -% Dvips generate an appropriate bounding box. -% \item[|dvips|] If this option is specified as a class option or to -% other packages, several packages pass things like page size -% information to Dvips, or cause crop marks or draft messages -% written on pages. This seriously hampers the usability of -% previews. If this option is specified, the changes will be undone -% if possible. -% \item[|pdftex|] If this option is set, PDF\TeX\ is assumed as the -% output driver. This mainly affects the |tightpage| option. -% \item[|xetex|] If this option is set, Xe\TeX\ is assumed as the -% output driver. This mainly affects the |tightpage| option. -% \item[|displaymath|] will make all displayed math environments -% subject to preview processing. This will typically be the most -% desired option. -% \item[|floats|] will make all float objects subject to preview -% processing. If you want to be more selective about what floats to -% pass through to a preview, you should instead use the -% \cmd{\PreviewSnarfEnvironment} command on the floats you want to -% have previewed. -% \item[|textmath|] will make all text math subject to previews. -% Since math mode is used throughly inside of \LaTeX\ even for other -% purposes, this works by redefining \cmd\(, \cmd\) -% and |$| and the |math| environment (apparently some people use -% that). Only occurences of these text math delimiters in later -% loaded packages and in the main document will thus be affected. -% \item[|graphics|] will subject all \cmd{\includegraphics} commands -% to a preview. -% \item[|sections|] will subject all section headers to a preview. -% \item[|delayed|] will delay all activations and redefinitions the -% |preview| package makes until |\||begin{document}|. The purpose -% of this is to cater for documents which should be subjected to the -% |preview| package without having been prepared for it. You can -% process such documents with -% \begin{quote} -% |latex '\RequirePackage[active,delayed,|\meta{options}|]{preview}| -% |\input|\marg{filename}|'| -% \end{quote} -% This relaxes the requirement to be loading the |preview| package -% as last package. -% \item[\meta{driver}] loads a special driver file -% |pr|\meta{driver}|.def|. The remaining options are implemented -% through the use of driver files. -% \item[|auctex|] This driver will produce fake error messages at the -% start and end of every preview environment that enable the Emacs -% package \previewlatex\ in connection with AUC\TeX\ to pinpoint -% the exact source location where the previews have originated. -% Unfortunately, there is no other reliable means of passing the -% current \TeX\ input position \emph{in} a line to external -% programs. In order to make the parsing more robust, this option -% also switches off quite a few diagnostics that could be -% misinterpreted. -% -% You should not specify this option manually, since it will only be -% needed by automated runs that want to parse the pseudo error -% messages. Those runs will then use \cmd{\PassOptionsToPackage} in -% order to effect the desired behaviour. In addition, -% |prauctex.cfg| will get loaded unless inhibited by the |noconfig| -% option. This caters for the most frequently encountered -% problematic commands. -% \item[|showlabels|] During the editing process, some people like to -% see the label names in their equations, figures and the like. Now -% if you are using Emacs for editing, and in particular -% \previewlatex, I'd strongly recommend that you check out the -% Ref\TeX\ package which pretty much obliterates the need for this -% kind of functionality. If you still want it, standard \LaTeX\ -% provides it with the |showkeys| package, and there is also the -% less encompassing |showlabels| package. Unfortunately, since -% those go to some pain not to change the page layout and spacing, -% they also don't change |preview|'s idea of the \TeX\ dimensions of -% the involved boxes. So if you are using |preview| for determing -% bounding boxes, those packages are mostly useless. The option -% |showlabels| offers a substitute for them. -% \item[|tightpage|] It is not uncommon to want to use the results of -% |preview| as graphic images for some other application. One -% possibility is to generate a flurry of EPS files with -% \begin{quote} -% |dvips -E -i -Pwww -o| \meta{outputfile}|.000| \meta{inputfile} -% \end{quote} -% However, in case those are to be processed further into graphic -% image files by Ghostscript, this process is inefficient since all -% of those files need to be processed one by one. In addition, it -% is necessary to extract the bounding box comments from the EPS -% files and convert them into page dimension parameters for -% Ghostscript in order to avoid full-page graphics. This is not -% even possible if you wanted to use Ghostscript in a~\emph{single} -% run for generating the files from a single PostScript file, since -% Dvips will in that case leave no bounding box information -% anywhere. -% -% The solution is to use the |tightpage| option. That way a single -% command line like -% \begin{quote} -% \raggedright -% \texttt{gs -sDEVICE=png16m -dTextAlphaBits=4 -r300 -% -dGraphicsAlphaBits=4 -dSAFER -q -dNOPAUSE -% -sOutputFile=\meta{outputfile}\%d.png \meta{inputfile}.ps} -% \end{quote} -% will be able to produce tight graphics from a single PostScript -% file generated with Dvips \emph{without} use of the options -% |-E -i|, in a single run. -% -% The |tightpage| option actually also works when using the |pdftex| -% option and generating PDF files with PDF\TeX. The resulting PDF -% file has separate page dimensions for every page and can directly -% be converted with one run of Ghostscript into image files. -% -% If neither |dvips| or |pdftex| have been specified, the -% corresponding option will get autodetected and invoked. -% -% If you need this in a batch environment where you don't want to -% use |preview|'s automatic extraction facilities, no problem: just -% don't use any of the extraction options, and wrap everything to be -% previewed into |preview| environments. This is how LyX does its -% math previews. -% -% If the pages under the |tightpage| option are just too tight, you -% can adjust by setting the length |\PreviewBorder| to a different -% value by using \cmd{\setlength}. The default value is -% |0.50001bp|, which is half of a usual PostScript point, rounded -% up. If you go below this value, the resulting page size may drop -% below |1bp|, and Ghostscript does not seem to like that. If you -% need finer control, you can adjust the bounding box dimensions -% individually by changing the macro |\PreviewBbAdjust| with the -% help of |\renewcommand|. Its default value is -% \begin{quote} -% \raggedright -% |\newcommand| |\PreviewBbAdjust| -% |{-\PreviewBorder| |-\PreviewBorder| -% |\PreviewBorder| |\PreviewBorder}| -% \end{quote} -% This adjusts the left, lower, right and upper borders by the given -% amount. The macro must contain 4~\TeX\ dimensions after another, -% and you may not omit the units if you specify them explicitly -% instead of by register. PostScript points have the unit~|bp|. -% \item[|lyx|] This option is for the sake of LyX developers. It will -% output a few diagnostics relevant for the sake of LyX' preview -% functionality (at the time of writing, mostly implemented for math -% insets, in versions of LyX starting with 1.3.0). -% \item[|counters|] This writes out diagnostics at the start and the -% end of previews. Only the counters changed since the last output -% get written, and if no counters changed, nothing gets written at -% all. The list consists of counter name and value, both enclosed -% in |{}| braces, followed by a space. The last such pair is -% followed by a colon (|:|) if it is at the start of the preview -% snippet, and by a period (|.|) if it is at the end. The order of -% different diagnostics like this being issued depends on the order -% of the specification of the options when calling the package. -% -% Systems like \previewlatex\ use this for keeping counters accurate -% when single previews are regenerated. -% \item[|footnotes|] This makes footnotes render as previews, and only -% as their footnote symbol. A convenient editing feature inside of -% Emacs. -% \end{description} -% The following options are just for debugging purposes of the package -% and similar to the corresponding \TeX\ commands they allude to: -% \begin{description} -% \item[|tracingall|] causes lots of diagnostic output to appear in -% the log file during the preview collecting phases of \TeX's -% operation. In contrast to the similarly named \TeX\ command, it -% will not switch to |\errorstopmode|, nor will it change the -% setting of |\tracingonline|. -% \item[|showbox|] This option will show the contents of the boxes -% shipped out to the DVI files. It also sets |\showboxbreadth| and -% |\showboxdepth| to their maximum values at the end of loading this -% package, but you may reset them if you don't like that. -% \end{description} -% \section{Provided Commands} -% \DescribeEnv{preview} The |preview| environment causes its contents -% to be set as a single preview image. Insertions like figures and -% footnotes (except those included in minipages) will typically lead -% to error messages or be lost. In case the |preview| package has not -% been activated, the contents of this environment will be typeset -% normally. -% -% \DescribeEnv{nopreview} The |nopreview| environment will cause its -% contents not to undergo any special treatment by the |preview| -% package. When |preview| is active, the contents will be discarded -% like all main text that does not trigger the |preview| hooks. When -% |preview| is not active, the contents will be typeset just like the -% main text. -% -% Note that both of these environments typeset things as usual when -% preview is not active. If you need something typeset conditionally, -% use the \cmd{\ifPreview} conditional for it. -% -% \DescribeMacro{\PreviewMacro} If you want to make a macro like -% \cmd{\includegraphics} (actually, this is what is done by the -% |graphics| option to |preview|) produce a preview image, you put a -% declaration like -% \begin{quote} -% |\PreviewMacro[*[[!]{\includegraphics}| -% \end{quote} -% or, more readable, -% \begin{quote} -% |\PreviewMacro[{*[][]{}}]{\includegraphics}| -% \end{quote} -% into your preamble. The optional argument to \cmd{\PreviewMacro} -% specifies the arguments \cmd{\includegraphics} accepts, since this -% is necessary information for properly ending the preview box. Note -% that if you are using the more readable form, you have to enclose -% the argument in a |[{| and |}]| pair. The inner braces are -% necessary to stop any included |[]| pairs from prematurely ending -% the optional argument, and to make a single |{}| -% denoting an optional argument not get stripped away by \TeX's -% argument parsing. -% -% The letters simply mean -% \begin{description} -% \item[|*|] indicates an optional |*| modifier, as in -% |\includegraphics*|. -% \item[|[|]^^A] -% indicates an optional argument in brackets. This syntax -% is somewhat baroque, but brief. -% \item[{|[]|}] also indicates an optional argument in brackets. Be -% sure to have encluded the entire optional argument specification -% in an additional pair of braces as described above. -% \item[|!|] indicates a mandatory argument. -% \item[|\char`{\char`}|] indicates the same. Again, be sure to have -% that additional level of braces around the whole argument -% specification. -% \item[|?|\meta{delimiter}\marg{true case}\marg{false case}] is a -% conditional. The next character is checked against being equal to -% \meta{delimiter}. If it is, the specification \meta{true case} is -% used for the further parsing, otherwise \meta{false case} will be -% employed. In neither case is something consumed from the input, -% so \marg{true case} will still have to deal with the upcoming -% delimiter. -% \item[|@|\marg{literal sequence}] will insert the given sequence -% literally into the executed call of the command. -% \item[|-|] will just drop the next token. It will probably be most -% often used in the true branch of a |?| specification. -% \item[|\#|\marg{argument}\marg{replacement}] is a transformation -% rule that calls a macro with the given argument and replacement -% text on the rest of the argument list. The replacement is used in -% the executed call of the command. This can be used for parsing -% arbitrary constructs. For example, the |[]| option could manually -% be implemented with the option string |?[{#{[#1]}{[{#1}]}}{}|. -% PStricks users might enjoy this sort of flexibility. -% \item[|:|\marg{argument}\marg{replacement}] is again a -% transformation rule. As opposed to |#|, however, the result of -% the transformation is parsed again. You'll rarely need this. -% \end{description} -% -% There is a second optional argument in brackets that can be used to -% declare any default action to be taken instead. This is mostly for -% the sake of macros that influence numbering: you would want to keep -% their effects in that respect. The default action should use |#1| -% for referring to the original (not the patched) command with the -% parsed options appended. Not specifying a second optional argument -% here is equivalent to specifying~|[#1]|. -% -% \DescribeMacro{\PreviewMacro*} A similar invocation -% \cmd{\PreviewMacro*} simply throws the macro and all of its -% arguments declared in the manner above away. This is mostly useful -% for having things like \cmd{\footnote} not do their magic on their -% arguments. More often than not, you don't want to declare any -% arguments to scan to \cmd{\PreviewMacro*} since you would want the -% remaining arguments to be treated as usual text and typeset in that -% manner instead of being thrown away. An exception might be, say, -% sort keys for \cmd{\cite}. -% -% A second optional argument in brackets can be used to declare any -% default action to be taken instead. This is for the sake of macros -% that influence numbering: you would want to keep their effects in -% that respect. The default action might use |#1| for referring to -% the original (not the patched) command with the parsed options -% appended. Not specifying a second optional argument here is -% equivalent to specifying~|[]| since the command usually gets thrown -% away. -% -% As an example for using this argument, you might want to specify -% \begin{quote} -% |\PreviewMacro*\footnote[{[]}][#1{}]| -% \end{quote} -% This will replace a footnote by an empty footnote, but taking any -% optional parameter into account, since an optional paramter changes -% the numbering scheme. That way the real argument for the footnote -% remains for processing by \previewlatex. -% -% \DescribeMacro{\PreviewEnvironment} The macro -% \cmd{\PreviewEnvironment} works just as \cmd{\PreviewMacro} does, -% only for environments. \DescribeMacro{\PreviewEnvironment*} And the -% same goes for \cmd{\PreviewEnvironment*} as compared to -% \cmd{\PreviewMacro*}. -% -% \DescribeMacro{\PreviewSnarfEnvironment} This macro does not typeset -% the original environment inside of a preview box, but instead -% typesets just the contents of the original environment inside of the -% preview box, leaving nothing for the original environment. This has -% to be used for figures, for example, since they would -% \begin{enumerate} -% \item produce insertion material that cannot be extracted to the -% preview properly, -% \item complain with an error message about not being in outer par -% mode. -% \end{enumerate} -% -% \DescribeMacro{\PreviewOpen} -% \DescribeMacro{\PreviewClose} -% Those Macros form a matched preview pair. This is for macros that -% behave similar as \cmd{\begin} and \cmd{\end} of an environment. It -% is essential for the operation of \cmd{\PreviewOpen} that the macro -% treated with it will open an additional group even when the preview -% falls inside of another preview or inside of a |nopreview| -% environment. Similarly, the macro treated with \cmd{PreviewClose} -% will close an environment even when inactive. -% -% \DescribeMacro{\ifPreview} In case you need to know whether -% |preview| is active, you can use the conditional \cmd{\ifPreview} -% together with |\else| and |\fi|. -% -% \StopEventually{} -% \section{The Implementation} -% Here we go: the start is somewhat obtuse since we figure out version -% number and date from RCS strings. This should really be done at -% docstrip time instead. Takers? -% \begin{macro}{\pr@version} -% \begin{macrocode} -%<*style> -%<*!active> -\NeedsTeXFormat{LaTeX2e} \def\reserved@a #1#2$#3: -#4${\xdef#1{\reserved@c #2#4 $}} \def\reserved@c #1 #2${#1} -\begingroup \catcode`\_=12 -\reserved@a\pr@version $Name: release_11_88 $ \ifx\pr@version\@empty -\reserved@a\pr@version CVS-$Revision: 1.126 $ \endgroup \else - \def\next release_{} \lccode`\_=`. - \edef\next{\lowercase{\endgroup - \def\noexpand\pr@version{\expandafter\next\pr@version}}} \next \fi -\reserved@a\next $Date: 2010/02/14 16:19:00 $ -\edef\next{\noexpand\ProvidesPackage{preview}% - [\next\space \pr@version\space (AUCTeX/preview-latex)]} -\next -% \end{macrocode} -% \end{macro} -% Since many parts here will not be needed as long as the package is -% inactive, we will include them enclosed with |<*active>| and -% || guards. That way, we can append all of this stuff at a -% place where it does not get loaded if not necessary. -% -%\begin{macro}{\ifPreview} -% Setting the \cmd{\ifPreview} command should not be done by the -% user, so we don't use \cmd{\newif} here. As a consequence, there -% are no \cmd{\Previewtrue} and \cmd{\Previewfalse} commands. -% \begin{macrocode} -\let\ifPreview\iffalse -% -% \end{macrocode} -%\end{macro} -%\begin{macro}{\ifpr@outer} -% We don't allow previews inside of previews. The macro -% \cmd{\ifpr@outer} can be used for checking whether we are outside -% of any preview code. -% \begin{macrocode} -%<*active> -\newif\ifpr@outer -\pr@outertrue -% -% \end{macrocode} -%\end{macro} -% -%\begin{macro}{\preview@delay} -% The usual meaning of \cmd{\preview@delay} is to just echo its -% argument in normal |preview| operation. If |preview| is inactive, -% it swallows its argument. If the |delayed| option is active, the -% contents will be passed to the \cmd{\AtBeginDocument} hook. -%\begin{macro}{\pr@advise} -% The core macro for modifying commands is \cmd{\pr@advise}. You -% pass it the original command name as first argument and what should -% be executed before the saved original command as second argument. -%\begin{macro}{\pr@advise@ship} -% The most often used macro for modifying commands is -% \cmd{\pr@advise@ship}. It receives three arguments. The first is -% the macro to modify, the second specifies some actions to be done -% inside of a box to be created before the original macro gets -% executed, the third one specifies actions after the original macro -% got executed. -%\begin{macro}{\pr@loadcfg} -% The macro \cmd{\pr@loadcfg} is used for loading in configuration -% files, unless disabled by the |noconfig| option. -% \begin{macrocode} -%<*!active> -\let\preview@delay=\@gobble -\let\pr@advise=\@gobbletwo -\long\def\pr@advise@ship#1#2#3{} -\def\pr@loadcfg#1{\InputIfFileExists{#1.cfg}{}{}} -\DeclareOption{noconfig}{\let\pr@loadcfg=\@gobble} -% \end{macrocode} -%\begin{macro}{\pr@addto@front} -% This adds code globally to the front of a macro. -% \begin{macrocode} -\long\def\pr@addto@front#1#2{% - \toks@{#2}\toks@\expandafter{\the\expandafter\toks@#1}% - \xdef#1{\the\toks@}} -% \end{macrocode} -% \end{macro} -% These commands get more interesting when |preview| is active: -% \begin{macrocode} -\DeclareOption{active}{% - \let\ifPreview\iftrue - \def\pr@advise#1{% - \expandafter\pr@adviseii\csname pr@\string#1\endcsname#1}% - \long\def\pr@advise@ship#1#2#3{\pr@advise#1{\pr@protect@ship{#2}{#3}}}% - \let\preview@delay\@firstofone} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\pr@adviseii} -% Now \cmd{\pr@advise} needs its helper macro. In order to avoid -% recursive definitions, we advise only macros that are not yet -% advised. Or, more exactly, we throw away the old advice and only -% take the new one. We use e\TeX's \cmd{\protected} where available -% for some extra robustness. -% \begin{macrocode} -\long\def\pr@adviseii#1#2#3{\preview@delay{% - \ifx#1\relax \let#1#2\fi - \toks@{#3#1}% - \ifx\@undefined\protected \else \protected\fi - \long\edef#2{\the\toks@}}} -% \end{macrocode} -%\end{macro} -% -% The |delayed| option is easy to implement: this is \emph{not} done -% with \cmd{\let} since at the course of document processing, \LaTeX\ -% redefines \cmd{\AtBeginDocument} and we want to follow that -% redefinition. -% \begin{macrocode} -\DeclareOption{delayed}{% - \ifPreview \def\preview@delay{\AtBeginDocument}\fi -} -% \end{macrocode} -% -%\begin{macro}{\ifpr@fixbb} -% Another conditional. \cmd{\ifpr@fixbb} tells us whether we want to -% surround the typeset materials with invisible rules so that Dvips -% gets the bounding boxes right for, say, pure PostScript inclusions. -% -% If you are installing this on an operating system different from -% the one |preview| has been developed on, you might want to redefine -% |\pr@markerbox| in your |prdefault.cfg| file to use a file known to -% be empty, like |/dev/null| is under Unix. Make this redefinition -% depend on \cmd{\ifpr@fixbb} since only then |\pr@markerbox| will be -% defined. -% \begin{macrocode} -\newif\ifpr@fixbb -\pr@fixbbfalse -\DeclareOption{psfixbb}{\ifPreview% - \pr@fixbbtrue - \newbox\pr@markerbox - \setbox\pr@markerbox\hbox{\special{psfile=/dev/null}}\fi -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@graphicstype} -% The |dvips| option redefines the |bop-hook| to reset the page -% size. -% \begin{macrocode} -\let\pr@graphicstype=\z@ -\DeclareOption{dvips}{% - \let\pr@graphicstype\@ne - \preview@delay{\AtBeginDvi{% - \special{!/preview@version(\pr@version)def} - \special{!userdict begin/preview-bop-level 0 def% - /bop-hook{/preview-bop-level dup load dup 0 le{/isls false def% - /vsize 792 def/hsize 612 def}if 1 add store}bind def% - /eop-hook{/preview-bop-level dup load dup 0 gt{1 sub}if - store}bind def end}}}} -% \end{macrocode} -% The |pdftex| option just sets \cmd{\pr@graphicstype}. -% \begin{macrocode} -\DeclareOption{pdftex}{% - \let\pr@graphicstype\tw@} -% \end{macrocode} -% And so does the |xetex| option. -% \begin{macrocode} -\DeclareOption{xetex}{% - \let\pr@graphicstype\thr@@} -% -% \end{macrocode} -% \end{macro} -% \subsection{The internals} -% -% Those are only needed if |preview| is active. -% \begin{macrocode} -%<*active> -% \end{macrocode} -% \begin{macro}{\pr@snippet} -% \cmd{\pr@snippet} is the current snippet number. We need a -% separate counter to \cmd{\c@page} since several other commands -% might fiddle with the page number. -% \begin{macrocode} -\newcount\pr@snippet -\global\pr@snippet=1 -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@protect} -% This macro gets one argument which is unpacked and executed in -% typesetting situations where we are not yet inside of a preview. -% \begin{macrocode} -\def\pr@protect{\ifx\protect\@typeset@protect - \ifpr@outer \expandafter\expandafter\expandafter - \@secondoftwo\fi\fi\@gobble} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@protect@ship} -% Now for the above mentioned \cmd{\pr@protect@ship}. This gets -% three arguments. The first is what to do at the beginning of the -% preview, the second what to do at the end, the third is the macro -% where we stored the original definition. -% -% In case we are not in a typesetting situation, -% \cmd{\pr@protect@ship} leaves the stored macro to fend for its -% own. No better or worse protection than the original. And we -% only do anything different when \cmd{\ifpr@outer} turns out to be -% true. -% \begin{macrocode} -\def\pr@protect@ship{\pr@protect{\@firstoftwo\pr@startbox}% - \@gobbletwo} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@insert} -% \begin{macro}{\pr@mark} -% \begin{macro}{\pr@marks} -% We don't want insertions to end up on our lists. So we disable -% them right now by replacing them with the following: -% \begin{macrocode} -\def\pr@insert{\begingroup\afterassignment\pr@insertii\count@} -\def\pr@insertii{\endgroup\setbox\pr@box\vbox} -% \end{macrocode} -% Similar things hold for marks. -% \begin{macrocode} -\def\pr@mark{{\afterassignment}\toks@} -\def\pr@marks{{\aftergroup\pr@mark\afterassignment}\count@} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \begin{macro}{\pr@box} -% \begin{macro}{\pr@startbox} -% Previews will be stored in \cmd{\box}\cmd{\pr@box}. -% \cmd{\pr@startbox} gets two arguments: code to execute immediately -% before the following stuff, code to execute afterwards. You have -% to cater for \cmd{\pr@endbox} being called at the right time -% yourself. We will use a \cmd{\vsplit} on the box later in order -% to remove any leading glues, penalties and similar stuff. For -% this reason we start off the box with an optimal break point. -% \begin{macrocode} -\newbox\pr@box -\long\def\pr@startbox#1#2{% - \ifpr@outer - \toks@{#2}% - \edef\pr@cleanup{\the\toks@}% - \setbox\pr@box\vbox\bgroup - \break - \pr@outerfalse\@arrayparboxrestore - \let\insert\pr@insert - \let\mark\pr@mark - \let\marks\pr@marks - \expandafter\expandafter\expandafter - \pr@ship@start - \expandafter\@firstofone - \else - \expandafter \@gobble - \fi{#1}} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \begin{macro}{\pr@endbox} -% Cleaning up also is straightforward. If we have to watch the -% bounding \TeX\ box, we want to remove spurious skips. We also -% want to unwrap a possible single line paragraph, so that the box -% is not full line length. We use \cmd{\vsplit} to clean up leading -% glue and stuff, and we make some attempt of removing trailing -% ones. After that, we wrap up the box including possible material -% from \cmd{\AtBeginDvi}. If the |psfixbb| option is active, we -% adorn the upper left and lower right corners with copies of -% \cmd{\pr@markerbox}. The first few lines cater for \LaTeX\ hiding -% things like like the code for \cmd{\paragraph} in \cmd{\everypar}. -% \begin{macrocode} -\def\pr@endbox{% - \let\reserved@a\relax - \ifvmode \edef\reserved@a{\the\everypar}% - \ifx\reserved@a\@empty\else - \dimen@\prevdepth - \noindent\par - \setbox\z@\lastbox\unskip\unpenalty - \prevdepth\dimen@ - \setbox\z@\hbox\bgroup\penalty-\maxdimen\unhbox\z@ - \ifnum\lastpenalty=-\maxdimen\egroup - \else\egroup\box\z@ \fi\fi\fi - \ifhmode \par\unskip\setbox\z@\lastbox - \nointerlineskip\hbox{\unhbox\z@\/}% - \else \unskip\unpenalty\unskip \fi - \egroup - \setbox\pr@box\vbox{% - \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@ - \@begindvi - \nointerlineskip - \splittopskip\z@skip\setbox\z@\vsplit\pr@box to\z@ - \unvbox\z@ - \nointerlineskip - %\color@setgroup - \box\pr@box - %\color@endgroup - }% -% \end{macrocode} -% \begin{macro}{\pr@ship@end} -% \label{sec:prshipend}At this point, \cmd{\pr@ship@end} gets -% called. You must not under any circumstances change |\box\pr@box| -% in any way that would add typeset material at the front of it, -% except for PostScript header specials, since the front of -% |\box\pr@box| may contain stuff from \cmd{\AtBeginDvi}. -% \cmd{\pr@ship@end} contains two types of code additions: stuff -% that adds to |\box\pr@box|, like the |labels| option does, and -% stuff that measures out things or otherwise takes a look at the -% finished |\box\pr@box|, like the |auctex| or |showbox| option do. -% The former should use \cmd{pr@addto@front} for adding to this -% hook, the latter use \cmd{g@addto@macro} for adding at the end of -% this hook. -% -% Note that we shift the output box up by its height via -% \cmd{\voffset}. This has three reasons: first we make sure that -% no package-inflicted non-zero value of \cmd{\voffset} or -% \cmd{\hoffset} will have any influence on the positioning of our -% box. Second we shift the box such that its basepoint will exactly -% be at the (1in,1in)~mark defined by \TeX. That way we can -% properly take ascenders into account. And the third reason is -% that \TeX\ treats a \cmd{\hbox} and a \cmd{\vbox} differently with -% regard to the treating of its depth. Shifting \cmd{\voffset} and -% \cmd{\hoffset} can be inhibited by setting |\pr@offset@override|. -% \begin{macrocode} - \pr@ship@end - {\let\protect\noexpand - \ifx\pr@offset@override\@undefined - \voffset=-\ht\pr@box - \hoffset=\z@ - \fi - \c@page=\pr@snippet - \pr@shipout - \ifpr@fixbb\hbox{% - \dimen@\wd\pr@box - \@tempdima\ht\pr@box - \@tempdimb\dp\pr@box - \box\pr@box - \llap{\raise\@tempdima\copy\pr@markerbox\kern\dimen@}% - \lower\@tempdimb\copy\pr@markerbox}% - \else \box\pr@box \fi}% - \global\advance\pr@snippet\@ne - \pr@cleanup -} -% \end{macrocode} -% \end{macro} -% \end{macro} -% Oh, and we kill off the usual meaning of \cmd{\shipout} in case -% somebody makes a special output routine. The following test is -% pretty much the same as in |everyshi.sty|. One of its implications -% is that if someone does a \cmd{\shipout} of a \emph{void} box, -% things will go horribly wrong. -% \begin{macro}{\shipout} -% \begin{macrocode} -\let\pr@shipout=\shipout -\def\shipout{\deadcycles\z@\bgroup\setbox\z@\box\voidb@x - \afterassignment\pr@shipoutegroup\setbox\z@} -\def\pr@shipoutegroup{\ifvoid\z@ \expandafter\aftergroup\fi \egroup} -% \end{macrocode} -% \end{macro} -% \subsection{Parsing commands} -% \begin{macro}{\pr@parseit} -% \begin{macro}{\pr@endparse} -% \begin{macro}{\pr@callafter} -% The following stuff is for parsing the arguments of commands we -% want to somehow surround with stuff. Usage is -% \begin{quote} -% \cmd{\pr@callafter}\meta{aftertoken}\meta{parsestring}\cmd{\pr@endparse}\\ -% \qquad\meta{macro}\meta{parameters} -% \end{quote} -% \meta{aftertoken} is stored away and gets executed once parsing -% completes, with its first argument being the parsed material. -% \meta{parsestring} would be, for example for the -% \cmd{\includegraphics} macro, |*[[!|, an optional |*| argument -% followed by two optional arguments enclosed in |[]|, followed by -% one mandatory argument. -% -% For the sake of a somewhat more intuitive syntax, we now support -% also the syntax |{*[]{}}| in the optional argument. Since \TeX\ -% strips redundant braces, we have to write |[{{}}]| in this syntax -% for a single mandatory argument. Hard to avoid. We use an -% unusual character for ending the parsing. The implementation is -% rather trivial. -% \begin{macrocode} -\def\pr@parseit#1{\csname pr@parse#1\endcsname} -\let\pr@endparse=\@percentchar -\def\next#1{% -\def\pr@callafter{% - \afterassignment\pr@parseit - \let#1= }} -\expandafter\next\csname pr@parse\pr@endparse\endcsname -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \begin{macro}{\pr@parse*} -% Straightforward, same mechanism \LaTeX\ itself employs. We take -% some care not to pass potential |#| tokens unprotected through -% macros. -% \begin{macrocode} -\long\expandafter\def\csname pr@parse*\endcsname#1\pr@endparse#2{% - \begingroup\toks@{#1\pr@endparse{#2}}% - \edef\next##1{\endgroup##1\the\toks@}% - \@ifstar{\next{\pr@parse@*}}{\next\pr@parseit}} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@parse[} -% \begin{macro}{\pr@brace} -% Copies optional parameters in brackets if present. The additional -% level of braces is necessary to ensure that braces the user might -% have put to hide a~|]| bracket in an optional argument don't get -% lost. There will be no harm if such braces were not there at the -% start. -% \begin{macrocode} -\long\expandafter\def\csname pr@parse[\endcsname#1\pr@endparse#2{% - \begingroup\toks@{#1\pr@endparse{#2}}% - \edef\next##1{\endgroup##1\the\toks@}% - \@ifnextchar[{\next\pr@bracket}{\next\pr@parseit}} -\long\def\pr@bracket#1\pr@endparse#2[#3]{% - \pr@parseit#1\pr@endparse{#2[{#3}]}} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \begin{macro}{\pr@parse]} -% This is basically a do-nothing, so that we may use the syntax -% |{*[][]!}| in the optional argument instead of the more concise -% but ugly |*[[!| which confuses the brace matchers of editors. -% \begin{macrocode} -\expandafter\let\csname pr@parse]\endcsname=\pr@parseit -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@parse} -% \begin{macro}{\pr@parse!} -% Mandatory arguments are perhaps easiest to parse. -% \begin{macrocode} -\long\def\pr@parse#1\pr@endparse#2#3{% - \pr@parseit#1\pr@endparse{#2{#3}}} -\expandafter\let\csname pr@parse!\endcsname=\pr@parse -% \end{macrocode} -% \end{macro} -% \end{macro} -% \begin{macro}{\pr@parse?} -% \begin{macro}{\pr@parsecond} -% This does an explicit call of |\@ifnextchar| and forks into the -% given two alternatives as a result. -% \begin{macrocode} -\long\expandafter\def\csname pr@parse?\endcsname#1#2\pr@endparse#3{% - \begingroup\toks@{#2\pr@endparse{#3}}% - \@ifnextchar#1{\pr@parsecond\@firstoftwo}% - {\pr@parsecond\@secondoftwo}} -\def\pr@parsecond#1{\expandafter\endgroup - \expandafter\expandafter\expandafter\pr@parseit - \expandafter#1\the\toks@} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \begin{macro}{\pr@parse@} -% This makes it possible to insert literal material into the -% argument list. -% \begin{macrocode} - \long\def\pr@parse@#1#2\pr@endparse#3{% - \pr@parseit #2\pr@endparse{#3#1}} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@parse-} -% This will just drop the next token. -% \begin{macrocode} -\long\expandafter\def\csname pr@parse-\endcsname - #1\pr@endparse#2{\begingroup - \toks@{\endgroup\pr@parseit #1\pr@endparse{#2}}% - {\aftergroup\the\aftergroup\toks@ \afterassignment}% - \let\next= } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@parse:} -% The following is a transform rule. A macro is being defined with -% the given argument list and replacement, and the transformed -% version replaces the original. The result of the transform is -% still subject to being parsed. -% \begin{macrocode} -\long\expandafter\def\csname pr@parse:\endcsname - #1#2#3\pr@endparse#4{\begingroup - \toks@{\endgroup \pr@parseit#3\pr@endparse{#4}}% - \long\def\next#1{#2}% - \the\expandafter\toks@\next} -% \end{macrocode} -% \end{macro} -% \edef\next{\noexpand\begin{macro}{\noexpand -% \pr@parse\string#}} -% \next -% Another transform rule, but this passes the transformed material -% into the token list. -% \begin{macrocode} -\long\expandafter\def\csname pr@parse#\endcsname - #1#2#3\pr@endparse#4{\begingroup - \toks@{#4}% - \long\edef\next##1{\toks@{\the\toks@##1}}% - \toks@{\endgroup \pr@parseit#3\pr@endparse}% - \long\def\reserved@a#1{{#2}}% - \the\expandafter\next\reserved@a} -% -% \end{macrocode} -% \end{macro} -% -% \subsection{Selection options} -% The |displaymath| option. The |equation| environments in AMS\LaTeX\ -% already do too much before our hook gets to interfere, so we hook -% earlier. Some juggling is involved to ensure we get the original -% |\everydisplay| tokens only once and where appropriate. -% -% The incredible hack with |\dt@ptrue| is necessary for working around -% bug `amslatex/3425'. -% \begin{macrocode} -%<*!active> -\begingroup -\catcode`\*=11 -\@firstofone{\endgroup -\DeclareOption{displaymath}{% - \preview@delay{\toks@{% - \pr@startbox{\noindent$$% - \aftergroup\pr@endbox\@gobbletwo}{$$}\@firstofone}% - \everydisplay\expandafter{\the\expandafter\toks@ - \expandafter{\the\everydisplay}}}% - \pr@advise@ship\equation{\begingroup\aftergroup\pr@endbox - \def\dt@ptrue{\m@ne=\m@ne}\noindent}% - {\endgroup}% - \pr@advise@ship\equation*{\begingroup\aftergroup\pr@endbox - \def\dt@ptrue{\m@ne=\m@ne}\noindent}% - {\endgroup}% - \PreviewOpen[][\def\dt@ptrue{\m@ne=\m@ne}\noindent#1]\[% - \PreviewClose\]% - \PreviewEnvironment[][\noindent#1]{eqnarray}% - \PreviewEnvironment[][\noindent#1]{eqnarray*}% - \PreviewEnvironment{displaymath}% -}} -% \end{macrocode} -% -% The |textmath| option. Some folderol in order to define the active -% |$| -% math mode delimiter. \cmd\pr@textmathcheck is used for checking -% whether we have a single |$| or double |$$|. -% In the latter case, we enter display math (this sort of display math -% is not allowed inside of \LaTeX\ because of inconsistent spacing, -% but surprisingly many people use it nevertheless). Strictly -% speaking, this is incorrect, since not every -% |$$| actually means display math. For example, |\hbox{$$}| will -% because of restricted horizontal mode rather yield an empty text -% math formula. Since our implementation moved the sequence inside of -% a |\vbox|, the interpretation will change. People should just not -% enter rubbish like that. -% \begin{macrocode} -\begingroup -\def\next#1#2{% - \endgroup - \DeclareOption{textmath}{% - \PreviewEnvironment{math}% - \preview@delay{\ifx#1\@undefined \let#1=$%$ - \fi\catcode`\$=\active - \ifx\xyreuncatcodes\@undefined\else - \edef\next{\catcode`@=\the\catcode`@\relax}% - \makeatother\expandafter\xyreuncatcodes\next\fi}% - \pr@advise@ship\(\pr@endaftergroup{}% \) - \pr@advise@ship#1{\@firstoftwo{\let#1=#2% - \futurelet\reserved@a\pr@textmathcheck}}{}}% - \def\pr@textmathcheck{\expandafter\pr@endaftergroup - \ifx\reserved@a#1{#2#2}\expandafter\@gobbletwo\fi#2}} -\lccode`\~=`\$ -\lowercase{\expandafter\next\expandafter~}% - \csname pr@\string$%$ - \endcsname -% -% \end{macrocode} -% \begin{macro}{\pr@endaftergroup} -% This justs ends the box after the group opened by |#1| is closed -% again. -% \begin{macrocode} -%<*active> -\def\pr@endaftergroup#1{#1\aftergroup\pr@endbox} -% -% \end{macrocode} -% \end{macro} -% -% The |graphics| option. -% \begin{macrocode} -%<*!active> -\DeclareOption{graphics}{% - \PreviewMacro[*[[!]{\includegraphics}%]] -} -% \end{macrocode} -% The |floats| option. The complications here are merely to spare us -% bug reports about broken document classes that use |\let| on -% |\endfigure| and similar. Notable culprits that have not been -% changed in years in spite of reports are |elsart.cls| and -% |IEEEtran.cls|. Complain when you are concerned. -% \begin{macrocode} -\def\pr@floatfix#1#2{\ifx#1#2% - \ifx#1\@undefined\else - \PackageWarningNoLine{preview}{% -Your document class has a bad definition^^J -of \string#1, most likely^^J -\string\let\string#1=\string#2^^J -which has now been changed to^^J -\string\def\string#1{\string#2}^^J -because otherwise subsequent changes to \string#2^^J -(like done by several packages changing float behaviour)^^J -can't take effect on \string#1.^^J -Please complain to your document class author}% - \def#1{#2}\fi\fi} -\begingroup -\def\next#1#2{\endgroup - \DeclareOption{floats}{% - \pr@floatfix\endfigure\end@float - \pr@floatfix\endtable\end@float - \pr@floatfix#1\end@dblfloat - \pr@floatfix#2\end@dblfloat - \PreviewSnarfEnvironment[![]{@float}%] - \PreviewSnarfEnvironment[![]{@dblfloat}%] - }} -\expandafter\next\csname endfigure*\expandafter\endcsname - \csname endtable*\endcsname -% \end{macrocode} -% The |sections| option. Two optional parameters might occur in -% |memoir.cls|. -% \begin{macrocode} -\DeclareOption{sections}{% - \PreviewMacro[!!!!!!*[[!]{\@startsection}%]] - \PreviewMacro[*[[!]{\chapter}%]] -} -% \end{macrocode} -% We now interpret any further options as driver files we load. Note -% that these driver files are loaded even when |preview| is not -% active. The reason is that they might define commands (like -% \cmd{\PreviewCommand}) that should be available even in case of an -% inactive package. Large parts of the |preview| package will not -% have been loaded in this case: you have to cater for that. -% \begin{macrocode} -\DeclareOption* - {\InputIfFileExists{pr\CurrentOption.def}{}{\OptionNotUsed}} -% \end{macrocode} -% -% \subsection{Preview attaching commands} -% \begin{macro}{\PreviewMacro} -% As explained above. Detect possible |*| and call appropriate -% macro. -% \begin{macrocode} -\def\PreviewMacro{\@ifstar\pr@starmacro\pr@macro} -% \end{macrocode} -% The version without |*| is now rather straightforward. -% \begin{macro}{\pr@macro} -% \begin{macro}{\pr@domacro} -% \begin{macro}{\pr@macroii} -% \begin{macro}{\pr@endmacro} -% \begin{macrocode} -\long\def\pr@domacro#1#2{% - \long\def\next##1{#2}% - \pr@callafter\next#1]\pr@endparse} -\newcommand\pr@macro[1][]{% - \toks@{\pr@domacro{#1}}% - \long\edef\next[##1]##2{% - \noexpand\pr@advise@ship{##2}{\the\toks@{##1\noexpand\pr@endbox}}{}}% - \@ifnextchar[\next\pr@macroii} -\def\pr@macroii{\next[##1]} -\long\def\pr@endmacro#1{#1\pr@endbox} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \begin{macro}{PreviewMacro*} -% \begin{macro}{\pr@protect@domacro} -% \begin{macro}{\pr@starmacro} -% The version with |*| has to parse the arguments, then throw them -% away. Some internal macros first, then the interface call. -% \begin{macrocode} -\long\def\pr@protect@domacro#1#2{\pr@protect{% - \long\def\next##1{#2}% - \pr@callafter\next#1]\pr@endparse}} -\newcommand\pr@starmacro[1][]{\toks@{\pr@protect@domacro{#1}}% - \long\edef\next[##1]##2{% - \noexpand\pr@advise##2{\the\toks@{##1}}}% - \@ifnextchar[\next{\next[]}} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \begin{macro}{\PreviewOpen} -% As explained above. Detect possible |*| and call appropriate macro. -% \begin{macrocode} -\def\PreviewOpen{\@ifstar\pr@starmacro\pr@open} -% \end{macrocode} -% The version without |*| is now rather straightforward. -% \begin{macro}{\pr@open} -% \begin{macrocode} -\newcommand\pr@open[1][]{% - \toks@{\pr@domacro{#1}}% - \long\edef\next[##1]##2{% - \noexpand\pr@advise##2{\begingroup - \noexpand\pr@protect@ship - {\the\toks@{\begingroup\aftergroup\noexpand\pr@endbox##1}}% - {\endgroup}}}% - \@ifnextchar[\next\pr@macroii} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \begin{macro}{\PreviewClose} -% As explained above. Detect possible |*| and call appropriate -% macro. -% \begin{macrocode} -\def\PreviewClose{\@ifstar\pr@starmacro\pr@close} -% \end{macrocode} -% The version without |*| is now rather straightforward. -% \begin{macro}{\pr@close} -% \begin{macrocode} -\newcommand\pr@close[1][]{% - \toks@{\pr@domacro{#1}}% - \long\edef\next[##1]##2{% - \noexpand\pr@advise{##2}{\the\toks@{##1\endgroup}}}% - \@ifnextchar[\next\pr@macroii} -% \end{macrocode} -% \end{macro} -% \end{macro} -% \begin{macro}{\PreviewEnvironment} -% Actually, this ignores any syntax argument. But don't tell -% anybody. Except for the |*|~variant, it respects (actually -% ignores) any argument! Of course, we'll need to deactivate -% |\end{|\meta{environment}|}| as well. -% \begin{macrocode} -\def\PreviewEnvironment{\@ifstar\pr@starenv\pr@env} -\newcommand\pr@starenv[1][]{\toks@{\pr@starmacro[{#1}]}% - \long\edef\next##1##2{% - \the\toks@[{##2}]##1}% - \begingroup\pr@starenvii} -\newcommand\pr@starenvii[2][]{\endgroup - \expandafter\next\csname#2\endcsname{#1}% - \expandafter\pr@starmacro\csname end#2\endcsname} -\newcommand\pr@env[1][]{% - \toks@{\pr@domacro{#1}}% - \long\edef\next[##1]##2{% - \noexpand\expandafter\noexpand\pr@advise@ship - \noexpand\csname##2\noexpand\endcsname{\the\toks@ - {\begingroup\aftergroup\noexpand\pr@endbox##1}}{\endgroup}}% - \@ifnextchar[\next\pr@macroii %] - } -% \end{macrocode} -% \end{macro} -% \begin{macro}{\PreviewSnarfEnvironment} -% This is a nuisance since we have to advise \emph{both} the -% environment and its end. -% \begin{macrocode} -\newcommand{\PreviewSnarfEnvironment}[2][]{% - \expandafter\pr@advise - \csname #2\endcsname{\pr@snarfafter{#1}}% - \expandafter\pr@advise - \csname end#2\endcsname{\pr@endsnarf}} -% -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@snarfafter} -% \begin{macro}{\pr@startsnarf} -% \begin{macro}{\pr@endsnarf} -% Ok, this looks complicated, but we have to start a group in order -% to be able to hook \cmd{\pr@endbox} into the game only when -% \cmd{\ifpr@outer} has triggered the start. And we need to get our -% start messages out before parsing the arguments. -% \begin{macrocode} -%<*active> -\let\pr@endsnarf\relax -\long\def\pr@snarfafter#1{\ifpr@outer - \pr@ship@start - \let\pr@ship@start\relax - \let\pr@endsnarf\endgroup - \else - \let\pr@endsnarf\relax - \fi - \pr@protect{\pr@callafter\pr@startsnarf#1]\pr@endparse}} -\def\pr@startsnarf#1{#1\begingroup - \pr@startbox{\begingroup\aftergroup\pr@endbox}{\endgroup}% - \ignorespaces} -% -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \begin{macro}{\pr@ship@start} -% \begin{macro}{\pr@ship@end} -% The hooks \cmd{\pr@ship@start} and \cmd{\pr@ship@end} can be added -% to by option files by the help of the \cmd{\g@addto@macro} command -% from \LaTeX, and by the \cmd{\pr@addto@front} command from -% |preview.sty| itself. They are called just before starting to -% process some preview, and just after it. Here is the policy for -% adding to them: \cmd{\pr@ship@start} is called inside of the vbox -% |\pr@box| before typeset material gets produced. It is, however, -% preceded by a break command that is intended for usage in -% \cmd{\vsplit}, so that any following glue might disappear. In -% case you want to add any material on the list, you have to precede -% it with \cmd{\unpenalty} and have to follow it with \cmd{\break}. -% You have make sure that under no circumstances any other legal -% breakpoints appear before that, and your material should -% contribute no nonzero dimensions to the page. For the policies of -% the \cmd{\pr@ship@end} hook, see the description on -% page~\pageref{sec:prshipend}. -% \begin{macrocode} -%<*!active> -\let\pr@ship@start\@empty -\let\pr@ship@end\@empty -% \end{macrocode} -% \end{macro} -% \end{macro} -% \begin{environment}{preview} -% \begin{environment}{nopreview} -% First we write the definitions of these environments when -% |preview| is inactive. We will redefine them if |preview| gets -% activated. -% \begin{macrocode} -\newenvironment{preview}{\ignorespaces}{\ifhmode\unskip\fi} -\newenvironment{nopreview}{\ignorespaces}{\ifhmode\unskip\fi} -% \end{macrocode} -% \end{environment} -% \end{environment} -% -% We now process the options and finish in case we are not active. -% \begin{macrocode} -\ProcessOptions\relax -\ifPreview\else\expandafter\endinput\fi -% -% \end{macrocode} -% Now for the redefinition of the |preview| and |endpreview| -% environments: -% \begin{macrocode} -%<*active> -\renewenvironment{preview}{\begingroup - \pr@startbox{\begingroup\aftergroup\pr@endbox}% - {\endgroup}% - \ignorespaces}% - {\ifhmode\unskip\fi\endgroup} -\renewenvironment{nopreview}{\pr@outerfalse\ignorespaces}% - {\ifhmode\unskip\fi} -% \end{macrocode} -% We use the normal output routine, but hijack it a bit for our -% purposes to preserve \cmd{\AtBeginDvi} hooks and not get previews -% while in output: that could become rather ugly. -% -% The main work of disabling normal output relies on a \cmd{\shipout} -% redefinition. -% \begin{macro}{\pr@output} -% \begin{macrocode} -\newtoks\pr@output -\pr@output\output -\output{% - \pr@outerfalse - \let\@begindvi\@empty - \the\pr@output} -\let\output\pr@output -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@typeinfos} -% Then we have some document info that style files might want to -% output. -% \begin{macrocode} -\def\pr@typeinfos{\typeout{Preview: Fontsize \f@size pt}% - \ifnum\mag=\@m\else\typeout{Preview: Magnification \number\mag}\fi - \ifx\pdfoutput\@undefined - \ifx\XeTeXversion\@undefined \else - % FIXME: The message should not be emitted if XeTeX does not produce - % PDF. There does not seem to be a primitive for that, though. - \typeout{Preview: PDFoutput 1}% - \fi - \else - \ifx\pdfoutput\relax \else - \ifnum\pdfoutput>\z@ - \typeout{Preview: PDFoutput 1}% - \fi - \fi - \fi -} -\AtBeginDocument{\pr@typeinfos} -% \end{macrocode} -% \end{macro} -% And at the end we load the default configuration file, so that it -% may override settings from this package: -% \begin{macrocode} -\pr@loadcfg{prdefault} -% -% -% \end{macrocode} -% -% \section{The option files} -% \subsection{The \texttt{auctex} option} -% The AUC\TeX\ option will cause error messages to spew. We want them -% on the terminal, but we don't want \LaTeX\ to stop its automated -% run. We delay \cmd{\nonstopmode} in case the user has any -% pseudo-interactive folderol like reading in of file names in his -% preamble. Because we are so good-hearted, we will not break this as -% long as the document has not started, but after that we need the -% error message mechanism operative. -% -% The |\nofiles| command here tries to avoid clobbering input files -% used for references and similar. It will come too late if you call -% the package with \cmd{\AtBeginDocument}, so you'll need to issue -% |\nofiles| yourself in that case. Previously, this was done -% unconditionally in the main style file, but since we don't know what -% the package may be used for, this was inappropriate. -% -% So here is the contents of the |prauctex.def| file: -% \begin{macrocode} -%\ifPreview\else\expandafter\endinput\fi -%\nofiles -%\preview@delay{\nonstopmode} -% \end{macrocode} -% Ok, here comes creative error message formatting. It turns out a -% sizable portion of the runtime is spent in I/O. Making the error -% messages short is an advantage. It is not possible to convince -% \TeX\ to make shorter error messages than this: \TeX\ always wants -% to include context. This is about the shortest \ae sthetic one we -% can muster. -% \begin{macrocode} -%\begingroup -%\lccode`\~=`\- -%\lccode`\{=`\< -%\lccode`\}=`\> -%\lowercase{\endgroup -% \def\pr@msgi{{~}}} -%\def\pr@msgii{Preview: -% Snippet \number\pr@snippet\space} -%\begingroup -%\catcode`\-=13 -%\catcode`\<=13 -%\@firstofone{\endgroup -%\def\pr@msg#1{{% -% \let<\pr@msgi -% \def-{\pr@msgii#1}% -% \errhelp{Not a real error.}% -% \errmessage<}}} -%\g@addto@macro\pr@ship@start{\pr@msg{started}} -%\g@addto@macro\pr@ship@end{\pr@msg{ended.% -% (\number\ht\pr@box+\number\dp\pr@box x\number\wd\pr@box)}} -% \end{macrocode} -% This looks pretty baffling, but it produces something short and -% semi-graphical, namely |<-><->|. That is a macro |<| that expands -% into |<->|, where |<| and |>| are the braces around an -% \cmd{\errmessage} argument and |-| is a macro expanding to the full -% text of the error message. Cough cough. You did not really want to -% know, did you? -% -% Since over/underfull boxes are about the messiest things to parse, -% we disable them by setting the appropriate badness limits and making -% the variables point to junk. We also disable other stuff. While we -% set \cmd{\showboxbreadth} and \cmd{\showboxdepth} to indicate as -% little diagnostic output as possible, we keep them operative, so -% that the user retains the option of debugging using this stuff. The -% other variables concerning the generation of warnings and -% daignostics, however, are more often set by commonly employed -% packages and macros such as \cmd{\sloppy}. So we kill them off for -% good. -% \begin{macrocode} -%\hbadness=\maxdimen -%\newcount\hbadness -%\vbadness=\maxdimen -%\let\vbadness=\hbadness -%\hfuzz=\maxdimen -%\newdimen\hfuzz -%\vfuzz=\maxdimen -%\let\vfuzz=\hfuzz -%\showboxdepth=-1 -%\showboxbreadth=-1 -% \end{macrocode} -% Ok, now we load a possible configuration file. -% \begin{macrocode} -%\pr@loadcfg{prauctex} -% \end{macrocode} -% And here we cater for several frequently used commands in -% |prauctex.cfg|: -% \begin{macrocode} -%\PreviewMacro*[[][#1{}]\footnote -%\PreviewMacro*[?[{@{[]}}{}][#1]\item -%\PreviewMacro*\emph -%\PreviewMacro*\textrm -%\PreviewMacro*\textit -%\PreviewMacro*\textsc -%\PreviewMacro*\textsf -%\PreviewMacro*\textsl -%\PreviewMacro*\texttt -%\PreviewMacro*\textcolor -%\PreviewMacro*\mbox -%\PreviewMacro*[][#1{}]\author -%\PreviewMacro*[][#1{}]\title -%\PreviewMacro*\and -%\PreviewMacro*\thanks -%\PreviewMacro*[][#1{}]\caption -%\preview@delay{\@ifundefined{pr@\string\@startsection}{% -% \PreviewMacro*[!!!!!!*][#1{}]\@startsection}{}} -%\preview@delay{\@ifundefined{pr@\string\chapter}{% -% \PreviewMacro*[*][#1{}]\chapter}{}} -%\PreviewMacro*\index -% \end{macrocode} -% -% \subsection{The \texttt{lyx} option} -% The following is the option providing LyX with info for its preview -% implementation. -% \begin{macrocode} -%\ifPreview\else\expandafter\endinput\fi -%\pr@loadcfg{prlyx} -%\g@addto@macro\pr@ship@end{\typeout{Preview: -% Snippet \number\pr@snippet\space -% \number\ht\pr@box\space \number\dp\pr@box \space\number\wd\pr@box}} -% \end{macrocode} -% -% \subsection{The \texttt{counters} option} -% This outputs a checkpoint. We do this by saving all counter -% registers in backup macros starting with |\pr@c@| in their name. A -% checkpoint first writes out all changed counters (previously -% unchecked counters are not written out unless different from zero), -% then saves all involved counter values. \LaTeX\ tracks its counters -% in the global variable \cmd{\cl@ckpt}. -% \begin{macrocode} -%\ifPreview\else\expandafter\endinput\fi -%\def\pr@eltprint#1{\expandafter\@gobble\ifnum\value{#1}=0% -% \csname pr@c@#1\endcsname\else\relax -% \space{#1}{\arabic{#1}}\fi} -%\def\pr@eltdef#1{\expandafter\xdef -% \csname pr@c@#1\endcsname{\arabic{#1}}} -%\def\pr@ckpt#1{{\let\@elt\pr@eltprint\edef\next{\cl@@ckpt}% -% \ifx\next\@empty\else\typeout{Preview: Counters\next#1}% -% \let\@elt\pr@eltdef\cl@@ckpt\fi}} -%\pr@addto@front\pr@ship@start{\pr@ckpt:} -%\pr@addto@front\pr@ship@end{\pr@ckpt.} -% \end{macrocode} -% -% \subsection{Debugging options} -% Those are for debugging the operation of |preview|, and thus are -% mostly of interest for people that want to use |preview| for their -% own purposes. Since debugging output is potentially confusing to -% the error message parsing from AUC\TeX, you should not turn on -% |\tracingonline| or switch from |\nonstopmode| unless you are -% certain your package will never be used with \previewlatex. -% -% \paragraph{The \texttt{showbox} option} will generate diagnostic -% output for every produced box. It does not delay the resetting of -% the |\showboxbreadth| and |\showboxdepth| parameters so that you can -% still change them after the loading of the package. It does, -% however, move them to the end of the package loading, so that they -% will not be affected by the |auctex| option. -% \begin{macrocode} -%\ifPreview\else\expandafter\endinput\fi -%\AtEndOfPackage{% -% \showboxbreadth\maxdimen -% \showboxdepth\maxdimen} -%\g@addto@macro\pr@ship@end{\showbox\pr@box} -% \end{macrocode} -% -% \paragraph{The \texttt{tracingall} option} is for the really heavy -% diagnostic stuff. For the reasons mentioned above, we do not want -% to change the setting of the interaction mode, nor of the -% |tracingonline| flag. If the user wants them different, he should -% set them outside of the preview boxes. -% \begin{macrocode} -%\ifPreview\else\expandafter\endinput\fi -%\pr@addto@front\pr@ship@start{\let\tracingonline\count@ -% \let\errorstopmode\@empty\tracingall} -% \end{macrocode} -% -% \subsection{Supporting conversions} -% It is not uncommon to want to use the results of |preview| as -% images. One possibility is to generate a flurry of EPS files with -% \begin{quote} -% |dvips -E -i -Ppdf -o| \meta{outputfile}|.000| \meta{inputfile} -% \end{quote} -% However, in case those are to be processed further into graphic -% image files by Ghostscript, this process is inefficient. One cannot -% use Ghostscript in a single run for generating the files, however, -% since one needs to set the page size (or full size pages will be -% produced). The |tightpage| option will set the page dimensions at -% the start of each PostScript page so that the output will be sized -% appropriately. That way, a single pass of Dvips followed by a -% single pass of Ghostscript will be sufficient for generating all -% images. -% -% You will have to specify the output driver to be used, either -% |dvips| or |pdftex|. -% -% \begin{macro}{\PreviewBorder} -% \begin{macro}{\PreviewBbAdjust} -% We start this off with the user tunable parameters which get -% defined even in the case of an inactive package, so that -% redefinitions and assignments to them will always work: -% \begin{macrocode} -%\ifx\PreviewBorder\@undefined -% \newdimen\PreviewBorder -% \PreviewBorder=0.50001bp -%\fi -%\ifx\PreviewBbAdjust\@undefined -% \def\PreviewBbAdjust{-\PreviewBorder -\PreviewBorder -% \PreviewBorder \PreviewBorder} -%\fi -% \end{macrocode} -% \end{macro} -% \end{macro} -% Here is stuff used for parsing this: -% \begin{macrocode} -%\ifPreview\else\expandafter\endinput\fi -%\def\pr@nextbb{\edef\next{\next\space\number\dimen@}% -% \expandafter\xdef\csname pr@bb@% -% \romannumeral\count@\endcsname{\the\dimen@}% -% \advance\count@\@ne\ifnum\count@<5 -% \afterassignment\pr@nextbb\dimen@=\fi} -% \end{macrocode} -% And here is the stuff that we fudge into our hook. Of course, we -% have to do it in a box, and we start this box off with our special. -% There is one small consideration here: it might come before any -% |\AtBeginDvi| stuff containing header specials. It turns out Dvips -% rearranges this amicably: header code specials get transferred to -% the appropriate header section, anyhow, so this ensures that we come -% right after the bop section. We insert the 7~numbers here: the -% 4~bounding box adjustments, and the 3~\TeX\ box dimensions. In case -% the box adjustments have changed since the last time, we write them -% out to the console. -% \begin{macrocode} -%\ifnum\pr@graphicstype=\z@ -% \ifcase -% \ifx\XeTeXversion\@undefined -% \ifx\pdfoutput\@undefined \@ne\fi -% \ifx\pdfoutput\relax \@ne\fi -% \ifnum\pdfoutput>\z@ \tw@\fi \@ne -% \else \thr@@\fi -% \or \ExecuteOptions{dvips}\relax -% \or \ExecuteOptions{pdftex}\relax -% \or \ExecuteOptions{xetex}\relax\fi\fi -%\global\let\pr@bbadjust\@empty -%\pr@addto@front\pr@ship@end{\begingroup -% \let\next\@gobble -% \count@\@ne\afterassignment\pr@nextbb -% \dimen@\PreviewBbAdjust -% \ifx\pr@bbadjust\next -% \else \global\let\pr@bbadjust\next -% \typeout{Preview: Tightpage \pr@bbadjust}% -% \fi\endgroup} -%\ifcase\pr@graphicstype -%\or -% \g@addto@macro\pr@ship@end{\setbox\pr@box\hbox{% -% \special{ps::\pr@bbadjust\space -% \number\ifdim\ht\pr@box>\z@ \ht\pr@box -% \else \z@ -% \fi \space -% \number\ifdim\dp\pr@box>\z@ \dp\pr@box -% \else \z@ -% \fi \space -% \number\ifdim\wd\pr@box>\z@ \wd\pr@box -% \else \z@ -% \fi}\box\pr@box}} -%\or -% \g@addto@macro\pr@ship@end{{\dimen@\ht\pr@box -% \ifdim\dimen@<\z@ \dimen@\z@\fi -% \advance\dimen@\pr@bb@iv -% \dimen@ii=\dimen@ -% \global\pdfvorigin\dimen@ -% \dimen@\dp\pr@box -% \ifdim\dimen@<\z@ \dimen@\z@\fi -% \advance\dimen@-\pr@bb@ii -% \advance\dimen@\dimen@ii -% \global\pdfpageheight\dimen@ -% \dimen@\wd\pr@box -% \ifdim\dimen@<\z@ \dimen@=\z@\fi -% \advance\dimen@-\pr@bb@i -% \advance\dimen@\pr@bb@iii -% \global\pdfpagewidth\dimen@ -% \global\pdfhorigin-\pr@bb@i}} -%\or -% \g@addto@macro\pr@ship@end{\dimen@\ht\pr@box -% \ifdim\dimen@<\z@ \dimen@\z@\fi -% \advance\dimen@\pr@bb@iv -% \dimen@ii=\dimen@ -% \voffset=-1in -% \advance\voffset\dimen@ -% \advance\voffset-\ht\pr@box -% \dimen@\dp\pr@box -% \ifdim\dimen@<\z@ \dimen@\z@\fi -% \advance\dimen@-\pr@bb@ii -% \advance\dimen@\dimen@ii -% \global\pdfpageheight\dimen@ -% \global\paperheight\dimen@ -% \dimen@\wd\pr@box -% \ifdim\dimen@<\z@ \dimen@=\z@\fi -% \advance\dimen@-\pr@bb@i -% \advance\dimen@\pr@bb@iii -% \global\pdfpagewidth\dimen@ -% \hoffset=-1in -% \advance\hoffset-\pr@bb@i -% \let\pr@offset@override\@empty} -%\fi -% \end{macrocode} -% Ok, here comes the beef. First we fish the 7~numbers from the file -% with |token| and convert them from \TeX~|sp| to PostScript points. -% \begin{macrocode} -%\ifnum\pr@graphicstype=\@ne -%\preview@delay{\AtBeginDvi{% -% \end{macrocode} -% Backwards-compatibility. Once we are certain that dvipng-1.6 or -% later is widely used, the three following specials can be exchanged -% for the simple |\special{!/preview@tightpage true def}| -% \begin{macrocode} -% \special{!/preview@tightpage true def (% -% compatibility PostScript comment for dvipng<=1.5 } -% \special{!userdict begin/bop-hook{% -% 7{currentfile token not{stop}if -% 65781.76 div DVImag mul}repeat -% 72 add 72 2 copy gt{exch}if 4 2 roll -% neg 2 copy lt{exch}if dup 0 gt{pop 0 exch}% -% {exch dup 0 lt{pop 0}if}ifelse 720 add exch 720 add -% 3 1 roll -% 4{5 -1 roll add 4 1 roll}repeat -% < /PageOffset[7 -2 roll [1 1 dtransform exch]% -% {0 ge{neg}if exch}forall]>>setpagedevice% -% //bop-hook exec}bind def end} -% \special{!userdict (some extra code to avoid -% dvipng>=1.6 unknown special: -% 7{currentfile token not{stop}if 65781.76 div })) pop} -% \end{macrocode} -% The ``userdict'' at the start of the last special is also there to -% avoid an unknown special in dvipng<=1.6. This is the end of the -% backwards-compatibility code. -% \begin{macrocode} -% \special{!userdict begin/bop-hook{% -% preview-bop-level 0 le{% -% 7{currentfile token not{stop}if -% 65781.76 div DVImag mul}repeat -% \end{macrocode} -% Next we produce the horizontal part of the bounding box as -% \[ (1\mathrm{in},1\mathrm{in}) + -% \bigl(\min(|\wd\pr@box|,0),\max(|\wd\pr@box|,0)\bigr) \] -% and roll it to the bottom of the stack: -% \begin{macrocode} -% 72 add 72 2 copy gt{exch}if 4 2 roll -% \end{macrocode} -% Next is the vertical part of the bounding box. Depth counts in -% negatively, and we again take $\min$ and $\max$ of possible extents -% in the vertical direction, limited by 0. 720 corresponds to -% $10\,\mathrm{in}$ and is the famous $1\,\mathrm{in}$ distance away -% from the edge of letterpaper. -% \begin{macrocode} -% neg 2 copy lt{exch}if dup 0 gt{pop 0 exch}% -% {exch dup 0 lt{pop 0}if}ifelse 720 add exch 720 add -% 3 1 roll -% \end{macrocode} -% Ok, we now have the bounding box on the stack in the proper order -% llx, lly, urx, ury. We add the adjustments: -% \begin{macrocode} -% 4{5 -1 roll add 4 1 roll}repeat -% \end{macrocode} -% The page size is calculated as the appropriate differences, the page -% offset consists of the coordinates of the lower left corner, with -% those coordinates negated that would be reckoned positive in the -% device coordinate system. -% \begin{macrocode} -% < /PageOffset[7 -2 roll [1 1 dtransform exch]% -% {0 ge{neg}if exch}forall]>>setpagedevice}if% -% \end{macrocode} -% So we now bind the old definition of |bop-hook| into our new -% definition and finish it. -% \begin{macrocode} -% //bop-hook exec}bind def end}}} -%\fi -% \end{macrocode} -% -% \subsection{The \texttt{showlabels} option} -% During the editing process, some people like to see the label names -% in their equations, figures and the like. Now if you are using -% Emacs for editing, and in particular \previewlatex, I'd strongly -% recommend that you check out the Ref\TeX\ package which pretty much -% obliterates the need for this kind of functionality. If you still -% want it, standard \LaTeX\ provides it with the |showkeys| package, -% and there is also the less encompassing |showlabels| package. -% Unfortunately, since those go to some pain not to change the page -% layout and spacing, they also don't change |preview|'s idea of the -% \TeX\ dimensions of the involved boxes. -% -% So those packages are mostly useless. So we present here an -% alternative hack that will get the labels through. -% \begin{macro}{\pr@labelbox} -% This works by collecting them into a separate box which we then -% tack to the right of the previews. -% \begin{macrocode} -%\ifPreview\else\expandafter\endinput\fi -%\newbox\pr@labelbox -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@label} -% We follow up with our own definition of the \cmd{\label} macro -% which will be active only in previews. The original definition is -% stored in |\pr@@label|. |\pr@lastlabel| contains the last typeset -% label in order to avoid duplication in certain environments, and -% we keep the stuff in |\pr@labelbox|. -% \begin{macrocode} -%\def\pr@label#1{\pr@@label{#1}% -% \end{macrocode} -% Ok, now we generate the box, by placing the label below any existing -% stuff. -% \begin{macrocode} -% \ifpr@setbox\z@{#1}% -% \global\setbox\pr@labelbox\vbox{\unvbox\pr@labelbox -% \box\z@}\egroup\fi} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\ifpr@setbox} -% |\ifpr@setbox| receives two arguments, |#1| is the box into which -% to set a label, |#2| is the label text itself. If a label needs -% to be set (if it is not a duplicate in the current box, and is -% nonempty, and we are in the course of typesetting and so on), we -% are left in a true conditional and an open group with the preset -% box. If nothing should be set, no group is opened, and we get -% into skipping to the closing of the conditional. Since -% |\ifpr@setbox| is a macro, you should not place the call to it -% into conditional text, since it will not pair up with |\fi| until -% being expanded. -% -% We have some trickery involved here. |\romannumeral\z@| expands -% to empty, and will also remove everything between the two of them -% that also expands to empty, like a chain of |\fi|. -% \begin{macrocode} -%\def\ifpr@setbox#1#2{% -% \romannumeral% -% \ifx\protect\@typeset@protect\ifpr@outer\else -% \end{macrocode} -% Ignore empty labels\dots -% \begin{macrocode} -% \z@\bgroup -% \protected@edef\next{#2}\@onelevel@sanitize\next -% \ifx\next\@empty\egroup\romannumeral\else -% \end{macrocode} -% and labels equal to the last one. -% \begin{macrocode} -% \ifx\next\pr@lastlabel\egroup\romannumeral\else -% \global\let\pr@lastlabel\next -% \setbox#1\pr@boxlabel\pr@lastlabel -% \expandafter\expandafter\romannumeral\fi\fi\fi\fi -% \z@\iffalse\iftrue\fi} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@boxlabel} -% Now the actual typesetting of a label box is done. We use a small -% typewriter font inside of a framed box (the default frame/box -% separating distance is a bit large). -% \begin{macrocode} -%\def\pr@boxlabel#1{\hbox{\normalfont -% \footnotesize\ttfamily\fboxsep0.4ex\relax\fbox{#1}}} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@maketag} -% And here is a version for |amsmath| equations. They look better -% when the label is right beside the tag, so we place it there, but -% augment |\box\pr@labelbox| with an appropriate placeholder. -% \begin{macrocode} -%\def\pr@maketag#1{\pr@@maketag{#1}% -% \ifpr@setbox\z@{\df@label}% -% \global\setbox\pr@labelbox\vbox{% -% \hrule\@width\wd\z@\@height\z@ -% \unvbox\pr@labelbox}% -% \end{macrocode} -% Set the width of the box to empty so that the label placement gets -% not disturbed, then append it. -% \begin{macrocode} -% \wd\z@\z@\box\z@ \egroup\fi} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\pr@lastlabel} -% Ok, here is how we activate this: we clear out box and label info -% \begin{macrocode} -%\g@addto@macro\pr@ship@start{% -% \global\setbox\pr@labelbox\box\voidb@x -% \xdef\pr@lastlabel{}% -% \end{macrocode} -% The definitions above are global because we might be in any amount -% of nesting. We then reassign the appropriate labelling macros: -% \begin{macrocode} -% \global\let\pr@@label\label \let\label\pr@label -% \global\let\pr@@maketag\maketag@@@ -% \let\maketag@@@\pr@maketag -%} -% \end{macrocode} -% \end{macro} -% Now all we have to do is to add the stuff to the box in question. -% The stuff at the front works around a bug in |ntheorem.sty|. -% \begin{macrocode} -%\pr@addto@front\pr@ship@end{% -% \ifx \label\pr@label \global\let\label\pr@@label \fi -% \ifx \maketag@@@\pr@maketag -% \global\let\maketag@@@\pr@@maketag \fi -% \ifvoid\pr@labelbox -% \else \setbox\pr@box\hbox{% -% \box\pr@box\,\box\pr@labelbox}% -% \fi} -% \end{macrocode} -% \subsection{The \texttt{footnotes} option} -% This is rather simplistic right now. It overrides the default -% footnote action (which is to disable footnotes altogether for better -% visibility). -% \begin{macrocode} -%\PreviewMacro[[!]\footnote %] -% \end{macrocode} -% -% \section{Various driver files} -% The installer, in case it is missing. If it is to be used via -% |make|, we don't specify an installation path, since -% \begin{quote} -% |make install| -% \end{quote} -% is supposed to cater for the installation itself. -% \begin{macrocode} -% \input docstrip -% \askforoverwritefalse -% \generate{ -% \file{preview.drv}{\from{preview.dtx}{driver}} -% \usedir{tex/latex/preview} -% \file{preview.sty}{\from{preview.dtx}{style} -% \from{preview.dtx}{style,active}} -% \file{prauctex.def}{\from{preview.dtx}{auctex}} -% \file{prauctex.cfg}{\from{preview.dtx}{auccfg}} -% \file{prshowbox.def}{\from{preview.dtx}{showbox}} -% \file{prshowlabels.def}{\from{preview.dtx}{showlabels}} -% \file{prtracingall.def}{\from{preview.dtx}{tracingall}} -% \file{prtightpage.def}{\from{preview.dtx}{tightpage}} -% \file{prlyx.def}{\from{preview.dtx}{lyx}} -% \file{prcounters.def}{\from{preview.dtx}{counters}} -% \file{prfootnotes.def}{\from{preview.dtx}{footnotes}} -% } -% \endbatchfile -% \end{macrocode} -% And here comes the documentation driver. -% \begin{macrocode} -% \documentclass{ltxdoc} -% \usepackage{preview} -% \let\ifPreview\relax -% \newcommand\previewlatex{\texttt{preview-latex}} -% \begin{document} -% \DocInput{preview.dtx} -% \end{document} -% \end{macrocode} -% \Finale{} -% \iffalse -% Local Variables: -% mode: doctex -% TeX-master: "preview.drv" -% End: -% \fi diff --git a/build/preview/preview.ins b/build/preview/preview.ins deleted file mode 100644 index 1d4229d..0000000 --- a/build/preview/preview.ins +++ /dev/null @@ -1,44 +0,0 @@ -%% -%% This is file `preview.ins', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% preview.dtx (with options: `installer') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from preview.ins. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file preview.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . - \input docstrip - \generate{ - \file{preview.drv}{\from{preview.dtx}{driver}} - \usedir{tex/latex/preview} - \file{preview.sty}{\from{preview.dtx}{style} - \from{preview.dtx}{style,active}} - \file{prauctex.def}{\from{preview.dtx}{auctex}} - \file{prauctex.cfg}{\from{preview.dtx}{auccfg}} - \file{prshowbox.def}{\from{preview.dtx}{showbox}} - \file{prshowlabels.def}{\from{preview.dtx}{showlabels}} - \file{prtracingall.def}{\from{preview.dtx}{tracingall}} - \file{prtightpage.def}{\from{preview.dtx}{tightpage}} - \file{prlyx.def}{\from{preview.dtx}{lyx}} - \file{prcounters.def}{\from{preview.dtx}{counters}} - \file{prfootnotes.def}{\from{preview.dtx}{footnotes}} - } - \endbatchfile -\endinput -%% -%% End of file `preview.ins'. diff --git a/build/preview/preview.sty.do b/build/preview/preview.sty.do deleted file mode 100644 index cf10bef..0000000 --- a/build/preview/preview.sty.do +++ /dev/null @@ -1,4 +0,0 @@ -redo-ifchange preview.dtx preview.ins -KEEP="preview.dtx preview.ins preview.sty.do" -find * -maxdepth 0 $(for x in $KEEP; do echo "-not -name $x"; done) | xargs rm >&2 -latex -interaction=batchmode preview.ins >&2 diff --git a/build/template.html5 b/build/template.html5 deleted file mode 100644 index 970848f..0000000 --- a/build/template.html5 +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - -$for(author-meta)$ - -$endfor$ -$if(date-meta)$ - -$endif$ - $if(title-prefix)$$title-prefix$ - $endif$$pagetitle$ - - -$if(quotes)$ - -$endif$ -$if(highlighting-css)$ - -$endif$ -$for(css)$ - -$endfor$ -$if(math)$ - $math$ -$endif$ -$for(header-includes)$ - $header-includes$ -$endfor$ - - -$for(include-before)$ -$include-before$ -$endfor$ -$if(title)$ -
-

dirty-haskell.org: $title$

-
-$endif$ -$if(toc)$ - -$endif$ -$body$ -$for(include-after)$ -$include-after$ -$endfor$ - - diff --git a/build/tex-filter.hs b/build/tex-filter.hs deleted file mode 100755 index 1e2face..0000000 --- a/build/tex-filter.hs +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env runhaskell -{-# LANGUAGE OverloadedStrings #-} - -import Text.Pandoc.JSON - -import Control.Monad -import Control.Applicative -import qualified Data.ByteString.Char8 as BS -import Crypto.Hash -import qualified System.IO as SIO -import System.IO.Strict hiding (writeFile, readFile) -import System.Directory -import System.FilePath -import Text.Printf - -import qualified Data.Text - -import Prelude - -type TeX = String -type RawHTML = String - -texToPath :: FilePath -> TeX -> FilePath -texToPath base s = base "tex" (show ( hash (BS.pack s) :: Digest SHA1)) - -texToSVGPath :: FilePath -> TeX -> FilePath -texToSVGPath b s = texToPath b s "image.svg" - -texToAlignPath :: FilePath -> TeX -> FilePath -texToAlignPath b s = texToPath b s "vertical-align" - -texToExprPath :: FilePath -> TeX -> FilePath -texToExprPath b s = texToPath b s "image.expr" - -compileToSVG :: FilePath -> MathType -> TeX -> IO RawHTML -compileToSVG basepath t s = let tex = Data.Text.unpack $ Data.Text.strip $ Data.Text.pack s - path = texToPath basepath tex - svg_path = texToSVGPath basepath tex - svg_web_path = texToSVGPath "" tex - align_path = texToAlignPath basepath tex - expr_path = texToExprPath basepath tex - - display DisplayMath = "\\displaystyle\n" - display InlineMath = "" - in do createDirectoryIfMissing True path - any (/= True) <$> mapM doesFileExist [svg_path, align_path, expr_path] >>= (flip when) - (do writeFile expr_path $ (display t) ++ tex - writeFile align_path "0") - alignment <- head.lines <$> readFile align_path - SIO.hPutStrLn SIO.stdout path - return $ printf "%s" svg_web_path alignment tex - -texify :: [String] -> Inline -> IO Inline -texify [basepath] (Math t s) = do svg <- compileToSVG basepath t s - return $ Span ("", [classOf t], []) [RawInline (Format "html") svg] - where classOf DisplayMath = "display-math" - classOf InlineMath = "inline-math" -texify [_] x = return x - -main :: IO () -main = toJSONFilter texify diff --git a/clean.do b/clean.do deleted file mode 100644 index 3444aab..0000000 --- a/clean.do +++ /dev/null @@ -1,4 +0,0 @@ -find -name '*.html' -not -path './nginx/*' -not -path './htdocs/*' -delete -find -name '*.md' -not -path './posts/*' -not -name 'about.md' -delete -find -name '*.rss' -not -path './htdocs/*' -delete -rm tex -rf \ No newline at end of file diff --git a/default.html.do b/default.html.do deleted file mode 100644 index e900e4a..0000000 --- a/default.html.do +++ /dev/null @@ -1,15 +0,0 @@ -redo-ifchange $2.md build/tex-filter.hs build/template.html5 - -CSS=/style.css - -pandoc -t json $2.md | build/tex-filter.hs "$(pwd)" \ - | while read -r x; do - [[ -z "${x}" ]] && continue - echo $x/image.svg - echo $x/image.svg >&2 - done \ - | xargs -d '\n' redo-ifchange - -pandoc -S -f markdown -t json $2.md \ - | build/tex-filter.hs "$(pwd)" \ - | pandoc --template=build/template.html5 --base-header-level=3 --standalone --email-obfuscation=none -f json -t html5 -c $CSS >$3 2>/dev/null diff --git a/default.nix b/default.nix index f808b8b..d3604c3 100644 --- a/default.nix +++ b/default.nix @@ -1,12 +1,18 @@ let pkgs = import {}; - stdenv = pkgs.stdenv; - hs = pkgs.haskellPackages; + overrideCabal = drv: f: (drv.override (args: args // { + mkDerivation = drv: args.mkDerivation (drv // f drv); + })) // { + overrideScope = scope: overrideCabal (drv.overrideScope scope) f; + }; + dontCheck = drv: overrideCabal drv (drv: { doCheck = false; }); in rec { - blogEnv = stdenv.mkDerivation rec { - name = "blog-env"; - version = "1"; - src = ./.; - buildInputs = [ hs.pandoc hs.pandocTypes hs.cryptohash hs.strict hs.feed ]; - }; + beuteltier = pkgs.stdenv.lib.overrideDerivation ( + (pkgs.haskellngPackages.callPackage ./blog.nix {}).override (attrs: attrs // { + hakyll = dontCheck pkgs.haskellngPackages.hakyll; + }) + ) (attrs : { + src = ./.; + } + ); } diff --git a/default.svg.do b/default.svg.do deleted file mode 100644 index 76a3b0b..0000000 --- a/default.svg.do +++ /dev/null @@ -1,28 +0,0 @@ -redo-ifchange $2.expr build/preview/preview.sty build/preview/prtightpage.def build/preamble.tex -INPUT=$(realpath $2.expr) -TDIR=$(mktemp -d --tmpdir=/tmp) -PREAMBLE=$(realpath build/preamble.tex) - -pushd $(dirname $2) >/dev/null -TEXDIR=$(pwd) -popd >/dev/null - -cp build/preview/preview.sty build/preview/prtightpage.def $TDIR - -pushd $TDIR >/dev/null -latex -jobname=image >/dev/null <&1 | sed -e '/depth=/!d;s/^.*depth=\(.*\)$/\1/' > $TEXDIR/vertical-align -cat $TDIR/image.svg -popd >/dev/null - -rm -rf $TDIR \ No newline at end of file diff --git a/do b/do deleted file mode 100755 index 5f20bb8..0000000 --- a/do +++ /dev/null @@ -1,177 +0,0 @@ -#!/bin/sh -# -# A minimal alternative to djb redo that doesn't support incremental builds. -# For the full version, visit http://github.com/apenwarr/redo -# -# The author disclaims copyright to this source file and hereby places it in -# the public domain. (2010 12 14) -# - -# By default, no output coloring. -green="" -bold="" -plain="" - -if [ -n "$TERM" -a "$TERM" != "dumb" ] && tty <&2 >/dev/null 2>&1; then - green="$(printf '\033[32m')" - bold="$(printf '\033[1m')" - plain="$(printf '\033[m')" -fi - -_dirsplit() -{ - base=${1##*/} - dir=${1%$base} -} - -dirname() -( - _dirsplit "$1" - dir=${dir%/} - echo "${dir:-.}" -) - -_dirsplit "$0" -export REDO=$(cd "${dir:-.}" && echo "$PWD/$base") - -DO_TOP= -if [ -z "$DO_BUILT" ]; then - DO_TOP=1 - [ -n "$*" ] || set all # only toplevel redo has a default target - export DO_BUILT=$PWD/.do_built - : >>"$DO_BUILT" - echo "Removing previously built files..." >&2 - sort -u "$DO_BUILT" | tee "$DO_BUILT.new" | - while read f; do printf "%s\0%s.did\0" "$f" "$f"; done | - xargs -0 rm -f 2>/dev/null - mv "$DO_BUILT.new" "$DO_BUILT" - DO_PATH=$DO_BUILT.dir - export PATH=$DO_PATH:$PATH - rm -rf "$DO_PATH" - mkdir "$DO_PATH" - for d in redo redo-ifchange; do - ln -s "$REDO" "$DO_PATH/$d"; - done - [ -e /bin/true ] && TRUE=/bin/true || TRUE=/usr/bin/true - for d in redo-ifcreate redo-stamp redo-always; do - ln -s $TRUE "$DO_PATH/$d"; - done -fi - - -_find_dofile_pwd() -{ - dofile=default.$1.do - while :; do - dofile=default.${dofile#default.*.} - [ -e "$dofile" -o "$dofile" = default.do ] && break - done - ext=${dofile#default} - ext=${ext%.do} - base=${1%$ext} -} - - -_find_dofile() -{ - local prefix= - while :; do - _find_dofile_pwd "$1" - [ -e "$dofile" ] && break - [ "$PWD" = "/" ] && break - target=${PWD##*/}/$target - tmp=${PWD##*/}/$tmp - prefix=${PWD##*/}/$prefix - cd .. - done - base=$prefix$base -} - - -_run_dofile() -{ - export DO_DEPTH="$DO_DEPTH " - export REDO_TARGET=$PWD/$target - local line1 - set -e - read line1 <"$PWD/$dofile" || true - cmd=${line1#"#!/"} - if [ "$cmd" != "$line1" ]; then - /$cmd "$PWD/$dofile" "$@" >"$tmp.tmp2" - else - :; . "$PWD/$dofile" >"$tmp.tmp2" - fi -} - - -_do() -{ - local dir=$1 target=$2 tmp=$3 - if [ ! -e "$target" ] || [ -d "$target" -a ! -e "$target.did" ]; then - printf '%sdo %s%s%s%s\n' \ - "$green" "$DO_DEPTH" "$bold" "$dir$target" "$plain" >&2 - echo "$PWD/$target" >>"$DO_BUILT" - dofile=$target.do - base=$target - ext= - [ -e "$target.do" ] || _find_dofile "$target" - if [ ! -e "$dofile" ]; then - echo "do: $target: no .do file" >&2 - return 1 - fi - [ ! -e "$DO_BUILT" ] || [ ! -d "$(dirname "$target")" ] || - : >>"$target.did" - ( _run_dofile "$target" "$base" "$tmp.tmp" ) - rv=$? - if [ $rv != 0 ]; then - printf "do: %s%s\n" "$DO_DEPTH" \ - "$dir$target: got exit code $rv" >&2 - rm -f "$tmp.tmp" "$tmp.tmp2" - return $rv - fi - mv "$tmp.tmp" "$target" 2>/dev/null || - ! test -s "$tmp.tmp2" || - mv "$tmp.tmp2" "$target" 2>/dev/null - rm -f "$tmp.tmp2" - else - echo "do $DO_DEPTH$target exists." >&2 - fi -} - - -# Make corrections for directories that don't actually exist yet. -_dir_shovel() -{ - local dir base - xdir=$1 xbase=$2 xbasetmp=$2 - while [ ! -d "$xdir" -a -n "$xdir" ]; do - _dirsplit "${xdir%/}" - xbasetmp=${base}__$xbase - xdir=$dir xbase=$base/$xbase - echo "xbasetmp='$xbasetmp'" >&2 - done -} - - -_redo() -{ - set +e - for i in "$@"; do - _dirsplit "$i" - _dir_shovel "$dir" "$base" - dir=$xdir base=$xbase basetmp=$xbasetmp - ( cd "$dir" && _do "$dir" "$base" "$basetmp" ) - [ "$?" = 0 ] || return 1 - done -} - - -_redo "$@" -[ "$?" = 0 ] || exit 1 - -if [ -n "$DO_TOP" ]; then - echo "Removing stamp files..." >&2 - [ ! -e "$DO_BUILT" ] || - while read f; do printf "%s.did\0" "$f"; done <"$DO_BUILT" | - xargs -0 rm -f 2>/dev/null -fi diff --git a/getopts_long.sh b/getopts_long.sh deleted file mode 100644 index ce2f7f0..0000000 --- a/getopts_long.sh +++ /dev/null @@ -1,701 +0,0 @@ -#! /bin/echo Usage:. -# -# getopts_long -- POSIX shell getopts with GNU-style long option support -# -# Copyright 2005-2009 Stephane Chazelas -# -# Permission to use, copy, modify, distribute, and sell this software and -# its documentation for any purpose is hereby granted without fee, provided -# that the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation. No representations are made about the suitability of this -# software for any purpose. It is provided "as is" without express or -# implied warranty. - -# History: -# 2005 ?? - 1.0 -# first version -# 2009-08-12 - 1.1 -# thanks to ujqm8360@netwtc.net for helping fix a few bugs: -# - -ab x where -b accepts arguments wasn't handled properly. Also, -# $OPTLIND wasn't set properly (at least not the same way as most -# getopts implementation do). -# - The handling of ambiguous long options was incorrect. - -getopts_long() { - # args: shortopts, var, [name, type]*, "", "$@" - # - # getopts_long parses command line arguments. It works like the - # getopts shell built-in command except that it also recognises long - # options a la GNU. - # - # You must provide getopts_long with the list of supported single - # letter options in the same format as getopts', followed by the - # variable name you want getopts_long to return the current processed - # option in, followed by the list of long option names (without the - # leading "--") and types (0 or no_argument, 1 or required_argument, - # 2 or optional_argument). The end of the long option specification - # is indicated by an empty argument. Then follows the list of - # arguments to be parsed. - # - # The $OPTLIND variable must be set to 1 before the first call of the - # getopts_long function to process a given list of arguments. - # - # getopts_long returns the value of the current option in the variable - # whose name is provided as its second argument (be careful to avoid - # variables that have a special signification to getopts_long or the - # shell or any other tool you may call from your script). If the - # current option is a single letter option, then it is returned - # without the leading "-". If it's a long option (possibly - # abbreviated), then the full name of the option (without the leading - # "--") is returned. If the option has an argument, then it is stored - # in the $OPTLARG variable. If the current option is not recognised, - # or if it is provided with an argument while it is not expecting one - # (as in --opt=value) or if it is not provided with an argument while - # it is expecting one, or if the option is so abbreviated that it is - # impossible to identify the option uniquely, then: - # - if the short option specifications begin with ":", getopts_long - # returns ":" in the output variable and $OPTLARG contains the - # faulty option name (in full except in the case of the ambiguous - # or bad option) and $OPTLERR contains the error message. - # - if not, then getopts_long behaves the same as above except that - # it returns "?" instead of ":", leaves $OPTLARG unset and - # displays the error message on stderr. - # - # The exit status of getopts_long is 0 unless the end of options is - # reached or an error is encountered in the syntax of the getopts_long - # call. - # - # After getopts_long has finished processing the options, $OPTLIND - # contains the index of the first non-option argument or $# + 1 if - # there's no non-option argument. - # - # The "=" character is not allowed in a long option name. Any other - # character is. "-" and ":" are not allowed as short option names. Any - # other character is. If a short option appears more than once in the - # specification, the one with the greatest number of ":"s following it - # is retained. If a long option name is provided more than once, only - # the first one is taken into account. Note that if you have both a -a - # and --a option, there's no way to differentiate them. Beside the - # $OPTLIND, $OPTLARG, and $OPTLERR, getopts_long uses the $OPTLPENDING - # variable to hold the remaining options to be processed for arguments - # with several one-letter options. That variable shouldn't be used - # anywhere else in your script. Those 4 variables are the only ones - # getopts_long may modify. - # - # Dependency: only POSIX utilities are called by that function. They - # are "set", "unset", "shift", "break", "return", "eval", "command", - # ":", "printf" and "[". Those are generally built in the POSIX - # shells. Only "printf" has been known not to be in some old versions - # of bash, zsh or ash based shells. - # - # Differences with the POSIX getopts: - # - if an error is detected during the parsing of command line - # arguments, the error message is stored in the $OPTLERR variable - # and if the first character of optstring is ':', ':' is returned in - # any case. - # - in the single-letter option specification, if a letter is - # followed by 2 colons ("::"), then the option can have an optional - # argument as in GNU getopt(3). In that case, the argument must - # directly follow the option as in -oarg (not -o arg). - # - there must be an empty argument to mark the end of the option - # specification. - # - long options starting with "--" are supported. - # - # Differences with GNU getopt_long(3): - # - getopts_long doesn't allow options to be interspersed with other - # arguments (as if POSIXLY_CORRECT was set for GNU getopt_long(3)) - # - there's no linkage of any sort between the short and long - # options. The caller is responsible of that (see example below). - # - # Compatibility: - # getopts_long code is (hopefully) POSIX.2/SUSv3 compliant. It won't - # work with the Bourne/SystemV shell. Use /usr/xpg4/bin/sh or ksh or - # bash on Solaris. - # It has been tested successfully with: - # - bash 3.0 (patch level 16) on Cygwin - # - zsh 4.2.4 on Solaris 2.7 - # - /usr/xpg4/bin/sh (same as /usr/bin/ksh) (ksh88i) on Solaris 2.7 - # - /usr/dt/bin/dtksh (ksh93d) on Solaris 2.7 - # - /usr/bin/ksh (pdksh 5.2.14) on Linux - # - zsh 3.0.6 on Solaris 2.8 - # - bash 2.0.3 on Solaris 2.8 - # - dash 0.5.2 on Linux - # - bash 2.05b (patch level 0) on Linux - # - ksh93p and ksh93q on Linux (ksh93t+ crashes) - # - # It is known to fail with those non-POSIX compliant shells: - # - /bin/sh on Solaris - # - /usr/bin/sh on Cygwin - # - bash 1.x - # - # Bugs: - # please report them to - # - # Example: - # - # verbose=false opt_bar=false bar=default_bar foo=default_foo - # opt_s=false opt_long=false - # OPTLIND=1 - # while getopts_long :sf:b::vh opt \ - # long 0 \ - # foo required_argument \ - # bar 2 \ - # verbose no_argument \ - # help 0 "" "$@" - # do - # case "$opt" in - # s) opt_s=true;; - # long) opt_long=true;; - # v|verbose) verbose=true;; - # h|help) usage; exit 0;; - # f|foo) foo=$OPTLARG;; - # b|bar) bar=${OPTLARG-$bar};; - # :) printf >&2 '%s: %s\n' "${0##*/}" "$OPTLERR" - # usage - # exit 1;; - # esac - # done - # shift "$(($OPTLIND - 1))" - # # process the remaining arguments - - [ -n "${ZSH_VERSION+z}" ] && emulate -L sh - - unset OPTLERR OPTLARG || : - - case "$OPTLIND" in - "" | 0 | *[!0-9]*) - # First time in the loop. Initialise the parameters. - OPTLIND=1 - OPTLPENDING= - ;; - esac - - if [ "$#" -lt 2 ]; then - printf >&2 'getopts_long: not enough arguments\n' - return 1 - fi - - # validate variable name. Need to fix locale for character ranges. - LC_ALL=C command eval ' - case "$2" in - *[!a-zA-Z_0-9]*|""|[0-9]*) - printf >&2 "getopts_long: invalid variable name: \`%s'\''\n" "$2" - return 1 - ;; - esac' - - # validate short option specification - case "$1" in - ::*|*:::*|*-*) - printf >&2 "getopts_long: invalid option specification: \`%s'\n" "$1" - return 1 - ;; - esac - - # validate long option specifications - - # POSIX shells only have $1, $2... as local variables, hence the - # extensive use of "set" in that function. - - set 4 "$@" - while :; do - if - [ "$1" -gt "$#" ] || { - eval 'set -- "${'"$1"'}" "$@"' - [ -n "$1" ] || break - [ "$(($2 + 2))" -gt "$#" ] - } - then - printf >&2 "getopts_long: long option specifications must end in an empty argument\n" - return 1 - fi - eval 'set -- "${'"$(($2 + 2))"'}" "$@"' - # $1 = type, $2 = name, $3 = $@ - case "$2" in - *=*) - printf >&2 "getopts_long: invalid long option name: \`%s'\n" "$2" - return 1 - ;; - esac - case "$1" in - 0 | no_argument) ;; - 1 | required_argument) ;; - 2 | optional_argument) ;; - *) - printf >&2 "getopts_long: invalid long option type: \`%s'\n" "$1" - return 1 - ;; - esac - eval "shift 3; set $(($3 + 2))"' "$@"' - done - shift - - eval "shift; set $(($1 + $OPTLIND))"' "$@"' - - # unless there are pending short options to be processed (in - # $OPTLPENDING), the current option is now in ${$1} - - if [ -z "$OPTLPENDING" ]; then - [ "$1" -le "$#" ] || return 1 - eval 'set -- "${'"$1"'}" "$@"' - - case "$1" in - --) - OPTLIND=$(($OPTLIND + 1)) - return 1 - ;; - --*) - OPTLIND=$(($OPTLIND + 1)) - ;; - -?*) - OPTLPENDING="${1#-}" - shift - ;; - *) - return 1 - ;; - esac - fi - - if [ -n "$OPTLPENDING" ]; then - # WA for zsh and bash 2.03 bugs: - OPTLARG=${OPTLPENDING%"${OPTLPENDING#?}"} - set -- "$OPTLARG" "$@" - OPTLPENDING="${OPTLPENDING#?}" - unset OPTLARG - - # $1 = current option = ${$2+1}, $3 = $@ - - [ -n "$OPTLPENDING" ] || - OPTLIND=$(($OPTLIND + 1)) - - case "$1" in - [-:]) - OPTLERR="bad option: \`-$1'" - case "$3" in - :*) - eval "$4=:" - OPTLARG="$1" - ;; - *) - printf >&2 '%s\n' "$OPTLERR" - eval "$4='?'" - ;; - esac - ;; - - *) - case "$3" in - *"$1"::*) # optional argument - eval "$4=\"\$1\"" - if [ -n "$OPTLPENDING" ]; then - # take the argument from $OPTLPENDING if any - OPTLARG="$OPTLPENDING" - OPTLPENDING= - OPTLIND=$(($OPTLIND + 1)) - fi - ;; - - *"$1":*) # required argument - if [ -n "$OPTLPENDING" ]; then - # take the argument from $OPTLPENDING if any - OPTLARG="$OPTLPENDING" - eval "$4=\"\$1\"" - OPTLPENDING= - OPTLIND=$(($OPTLIND + 1)) - else - # take the argument from the next argument - if [ "$(($2 + 2))" -gt "$#" ]; then - OPTLERR="option \`-$1' requires an argument" - case "$3" in - :*) - eval "$4=:" - OPTLARG="$1" - ;; - *) - printf >&2 '%s\n' "$OPTLERR" - eval "$4='?'" - ;; - esac - else - OPTLIND=$(($OPTLIND + 1)) - eval "OPTLARG=\"\${$(($2 + 2))}\"" - eval "$4=\"\$1\"" - fi - fi - ;; - - *"$1"*) # no argument - eval "$4=\"\$1\"" - ;; - *) - OPTLERR="bad option: \`-$1'" - case "$3" in - :*) - eval "$4=:" - OPTLARG="$1" - ;; - *) - printf >&2 '%s\n' "$OPTLERR" - eval "$4='?'" - ;; - esac - ;; - esac - ;; - esac - else # long option - - # remove the leading "--" - OPTLPENDING="$1" - shift - set 6 "${OPTLPENDING#--}" "$@" - OPTLPENDING= - - while - eval 'set -- "${'"$1"'}" "$@"' - [ -n "$1" ] - do - # $1 = option name = ${$2+1}, $3 => given option = ${$4+3}, $5 = $@ - - case "${3%%=*}" in - "$1") - OPTLPENDING=EXACT - break;; - esac - - # try to see if the current option can be seen as an abbreviation. - case "$1" in - "${3%%=*}"*) - if [ -n "$OPTLPENDING" ]; then - [ "$OPTLPENDING" = AMBIGUOUS ] || eval '[ "${'"$(($OPTLPENDING + 1))"'}" = "$1" ]' || - OPTLPENDING=AMBIGUOUS - # there was another different option matching the current - # option. The eval thing is in case one option is provided - # twice in the specifications which is OK as per the - # documentation above - else - OPTLPENDING="$2" - fi - ;; - esac - eval "shift 2; set $(($2 + 2)) "'"$@"' - done - - case "$OPTLPENDING" in - AMBIGUOUS) - OPTLERR="option \`--${3%%=*}' is ambiguous" - case "$5" in - :*) - eval "$6=:" - OPTLARG="${3%%=*}" - ;; - *) - printf >&2 '%s\n' "$OPTLERR" - eval "$6='?'" - ;; - esac - OPTLPENDING= - return 0 - ;; - EXACT) - eval 'set "${'"$(($2 + 2))"'}" "$@"' - ;; - "") - OPTLERR="bad option: \`--${3%%=*}'" - case "$5" in - :*) - eval "$6=:" - OPTLARG="${3%%=*}" - ;; - *) - printf >&2 '%s\n' "$OPTLERR" - eval "$6='?'" - ;; - esac - OPTLPENDING= - return 0 - ;; - *) - # we've got an abbreviated long option. - shift - eval 'set "${'"$(($OPTLPENDING + 1))"'}" "${'"$OPTLPENDING"'}" "$@"' - ;; - esac - - OPTLPENDING= - - # $1 = option type, $2 = option name, $3 unused, - # $4 = given option = ${$5+4}, $6 = $@ - - case "$4" in - *=*) - case "$1" in - 1 | required_argument | 2 | optional_argument) - eval "$7=\"\$2\"" - OPTLARG="${4#*=}" - ;; - *) - OPTLERR="option \`--$2' doesn't allow an argument" - case "$6" in - :*) - eval "$7=:" - OPTLARG="$2" - ;; - *) - printf >&2 '%s\n' "$OPTLERR" - eval "$7='?'" - ;; - esac - ;; - esac - ;; - - *) - case "$1" in - 1 | required_argument) - if [ "$(($5 + 5))" -gt "$#" ]; then - OPTLERR="option \`--$2' requires an argument" - case "$6" in - :*) - eval "$7=:" - OPTLARG="$2" - ;; - *) - printf >&2 '%s\n' "$OPTLERR" - eval "$7='?'" - ;; - esac - else - OPTLIND=$(($OPTLIND + 1)) - eval "OPTLARG=\"\${$(($5 + 5))}\"" - eval "$7=\"\$2\"" - fi - ;; - *) - # optional argument (but obviously not provided) or no - # argument - eval "$7=\"\$2\"" - ;; - esac - ;; - esac - fi - return 0 -} - -# testing code -if [ -n "$test_getopts_long" ]; then -test_getopts_long() { - expected="$1" had= - shift - OPTLIND=1 - - while err="$(set +x;getopts_long "$@" 2>&1 > /dev/null)" - getopts_long "$@" 2> /dev/null; do - eval "opt=\"\$$2\"" - had="$had|$opt@${OPTLARG-unset}@${OPTLIND-unset}@${OPTLERR-unset}@$err" - done - had="$had|${OPTLIND-unset}|$err" - - if [ "$had" = "$expected" ]; then - echo PASS - else - echo FAIL - printf 'Expected: %s\n Got: %s\n' "$expected" "$had" - fi -} -while IFS= read -r c && IFS= read -r e; do - printf '+ %-72s ' "$c" - #set -x - eval "test_getopts_long \"\$e\" $c" -done << \EOF -: a -|1|getopts_long: long option specifications must end in an empty argument -:a opt "" -a -|a@unset@2@unset@|2| -:a opt "" -a b -|a@unset@2@unset@|2| -:a opt "" -a -a -|a@unset@2@unset@|a@unset@3@unset@|3| -:a opt "" -ab -|a@unset@1@unset@|:@b@2@bad option: `-b'@|2| -:a: opt "" -ab -|a@b@2@unset@|2| -:a: opt "" -a b -|a@b@3@unset@|3| -:a: opt "" -a -a -|a@-a@3@unset@|3| -:a: opt "" -a -|:@a@2@option `-a' requires an argument@|2| -:a:: opt "" -a -|a@unset@2@unset@|2| -:a:: opt "" -ab -|a@b@2@unset@|2| -:a:: opt "" -a b -|a@unset@2@unset@|2| -:ab: opt "" -ab c -|a@unset@1@unset@|b@c@3@unset@|3| -:a:: opt "" -a -a -|a@unset@2@unset@|a@unset@3@unset@|3| -:a:: opt "" -:a: -|:@:@1@bad option: `-:'@|a@:@2@unset@|2| -:= opt "" -|1| -:: opt "" -|1|getopts_long: invalid option specification: `::' -: opt "" -|1| -:a:a opt "" -a -|:@a@2@option `-a' requires an argument@|2| -:a::a opt "" -a -|a@unset@2@unset@|2| -:ab:c:: opt "" -abc -cba -bac -|a@unset@1@unset@|b@c@2@unset@|c@ba@3@unset@|b@ac@4@unset@|4| -: opt abc 0 "" --abc -|abc@unset@2@unset@|2| -: opt abc no_argument "" --abc -|abc@unset@2@unset@|2| -: opt abc no_argument "" --abc=foo -|:@abc@2@option `--abc' doesn't allow an argument@|2| -: opt abc no_argument "" --abc foo -|abc@unset@2@unset@|2| -: opt abc 1 "" --abc=foo -|abc@foo@2@unset@|2| -: opt abc required_argument "" --abc foo -|abc@foo@3@unset@|3| -: opt abc required_argument "" --abc= -|abc@@2@unset@|2| -: opt abc required_argument "" --abc -|:@abc@2@option `--abc' requires an argument@|2| -: opt abc 2 "" --abc -|abc@unset@2@unset@|2| -: opt abc optional_argument "" --abc= -|abc@@2@unset@|2| -: opt abc optional_argument "" --abc=foo -|abc@foo@2@unset@|2| -: opt abc optional_argument "" --abc --abc -|abc@unset@2@unset@|abc@unset@3@unset@|3| -: opt abc 0 abcd 0 "" --abc -|abc@unset@2@unset@|2| -: opt abc 0 abd 0 "" --ab -|:@ab@2@option `--ab' is ambiguous@|2| -: opt abc 0 abcd 0 "" --ab -|:@ab@2@option `--ab' is ambiguous@|2| -: opt abc 0 abc 1 "" --ab -|abc@unset@2@unset@|2| -: opt abc 0 abc 1 "" --abc -|abc@unset@2@unset@|2| -: opt abc 0 abc 1 "" --ab -|abc@unset@2@unset@|2| -: opt abc 0 acd 0 "" --ab -|abc@unset@2@unset@|2| -:abc:d:e::f:: opt ab 0 ac 1 bc 2 cd 1 cde 2 "" -abcdef -a -f -c --a --a= --b=foo -fg -|a@unset@1@unset@|b@unset@1@unset@|c@def@2@unset@|a@unset@3@unset@|f@unset@4@unset@|c@--a@6@unset@|:@a@7@option `--a' is ambiguous@|bc@foo@8@unset@|f@g@9@unset@|9| -a opt "" -a -|a@unset@2@unset@|2| -a opt "" -a b -|a@unset@2@unset@|2| -a opt "" -a -a -|a@unset@2@unset@|a@unset@3@unset@|3| -a opt "" -ab -|a@unset@1@unset@|?@unset@2@bad option: `-b'@bad option: `-b'|2| -a: opt "" -ab -|a@b@2@unset@|2| -a: opt "" -a b -|a@b@3@unset@|3| -a: opt "" -a -a -|a@-a@3@unset@|3| -a: opt "" -a -|?@unset@2@option `-a' requires an argument@option `-a' requires an argument|2| -a:: opt "" -a -|a@unset@2@unset@|2| -a:: opt "" -ab -|a@b@2@unset@|2| -a:: opt "" -a b -|a@unset@2@unset@|2| -a:: opt "" -a -a -|a@unset@2@unset@|a@unset@3@unset@|3| -a:: opt "" -:a: -|?@unset@1@bad option: `-:'@bad option: `-:'|a@:@2@unset@|2| -= opt "" -|1| -: opt "" -|1| -'' opt "" -|1| -a:a opt "" -a -|?@unset@2@option `-a' requires an argument@option `-a' requires an argument|2| -a::a opt "" -a -|a@unset@2@unset@|2| -ab:c:: opt "" -abc -cba -bac -|a@unset@1@unset@|b@c@2@unset@|c@ba@3@unset@|b@ac@4@unset@|4| -'' opt abc 0 "" --abc -|abc@unset@2@unset@|2| -'' opt abc no_argument "" --abc -|abc@unset@2@unset@|2| -'' opt abc no_argument "" --abc=foo -|?@unset@2@option `--abc' doesn't allow an argument@option `--abc' doesn't allow an argument|2| -'' opt abc no_argument "" --abc foo -|abc@unset@2@unset@|2| -'' opt abc 1 "" --abc=foo -|abc@foo@2@unset@|2| -'' opt abc required_argument "" --abc foo -|abc@foo@3@unset@|3| -'' opt abc required_argument "" --abc= -|abc@@2@unset@|2| -'' opt abc required_argument "" --abc -|?@unset@2@option `--abc' requires an argument@option `--abc' requires an argument|2| -'' opt abc 2 "" --abc -|abc@unset@2@unset@|2| -'' opt abc optional_argument "" --abc= -|abc@@2@unset@|2| -'' opt abc optional_argument "" --abc=foo -|abc@foo@2@unset@|2| -'' opt abc optional_argument "" --abc --abc -|abc@unset@2@unset@|abc@unset@3@unset@|3| -'' opt abc 0 abcd 0 "" --abc -|abc@unset@2@unset@|2| -'' opt abc 0 abd 0 "" --ab -|?@unset@2@option `--ab' is ambiguous@option `--ab' is ambiguous|2| -'' opt abc 0 abcd 0 "" --ab -|?@unset@2@option `--ab' is ambiguous@option `--ab' is ambiguous|2| -'' opt abc 0 abc 1 "" --ab -|abc@unset@2@unset@|2| -'' opt abc 0 abc 1 "" --abc -|abc@unset@2@unset@|2| -'' opt abc 0 abc 1 "" --ab -|abc@unset@2@unset@|2| -'' opt abc 0 acd 0 "" --ab -|abc@unset@2@unset@|2| -abc:d:e::f:: opt ab 0 ac 1 bc 2 cd 1 cde 2 "" -abcdef -a -f -c --a --a= --b=foo -fg -|a@unset@1@unset@|b@unset@1@unset@|c@def@2@unset@|a@unset@3@unset@|f@unset@4@unset@|c@--a@6@unset@|?@unset@7@option `--a' is ambiguous@option `--a' is ambiguous|bc@foo@8@unset@|f@g@9@unset@|9| -: '' '' a -|1|getopts_long: invalid variable name: `' -: 1a '' -|1|getopts_long: invalid variable name: `1a' -- a -|1|getopts_long: invalid option specification: `-' -:a::a:abcd o ab 1 abc 1 abd 1 abe 1 abc 2 '' -aa --ab 1 --abc -|a@a@2@unset@|ab@1@4@unset@|:@abc@5@option `--abc' requires an argument@|5| -: -|1|getopts_long: not enough arguments -'\[$' o -- 0 ' ' 1 '#' required_argument '' '-\\\[$' --\ =a --\#=\$\$ -|\@unset@1@unset@|\@unset@1@unset@|\@unset@1@unset@|[@unset@1@unset@|$@unset@2@unset@| @a@3@unset@|#@$$@4@unset@|4| -: o a 1 b 2 c -|1|getopts_long: long option specifications must end in an empty argument -: o a 1 b 2 -|1|getopts_long: long option specifications must end in an empty argument -: o a 1 b 2 c 3 '' --c -|1|getopts_long: invalid long option type: `3' -": " o " " 1 '' "- " "-- =1" -| @unset@1@unset@| @unset@2@unset@| @1@3@unset@|3| -: o a 1 '' --c -|:@c@2@bad option: `--c'@|2| -: o a 1 '' --c=foo -|:@c@2@bad option: `--c'@|2| -: o ab 1 ac 1 ad 1 a 1 '' --a=1 -|a@1@2@unset@|2| -EOF -fi diff --git a/htdocs.do b/htdocs.do deleted file mode 100644 index 280bfee..0000000 --- a/htdocs.do +++ /dev/null @@ -1,3 +0,0 @@ -redo-ifchange all -find . \( -name '*.html' -or -name '*.css' -or -name '*.svg' -or -name '*.rss' \) -and -not \( -path '*/.cabal-sandbox/*' -or -path '*/htdocs/*' -or -path '*/build/*' \) -print0 | \ -xargs -0 -I '{}' -- rsync -Rav --delete '{}' htdocs >&2 diff --git a/index.md.do b/index.md.do deleted file mode 100644 index 3155cb7..0000000 --- a/index.md.do +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -LISTS=() -while read -r -d $'\0'; do - LISTS+=("$REPLY") -done < <(find lists -maxdepth 1 -mindepth 1 -type d -not -name '.*' -print0 | sort -z) - -for x in "${LISTS[@]}"; do - printf "%s.html\0" "$x" - printf "rss/%s.rss\0" "$(basename $x)" -done | xargs -r -0 redo-ifchange - -cat < if you so choose. - -EOF - -for x in "${LISTS[@]}"; do - printf "* [%s](%s) ([RSS](rss/%s))\n" "$(<$x/title)" "$x.html" "$(basename $x).rss" - while read -r -d $'\n'; do - printf " %s\n" "$REPLY" - done < "$x/preview" -done diff --git a/lists.sh b/lists.sh deleted file mode 100755 index c07870a..0000000 --- a/lists.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env bash - -shopt -s extglob nullglob - -. ./getopts_long.sh - -find_lists() { - LISTS=() - while read -r -d $'\0'; do - local list=$(realpath --relative-to=. "$REPLY") - LISTS+=("$list") - done < <(find lists -maxdepth 1 -mindepth 1 -type d -not -name '.*' -print0 | sort -z) -} - -find_posts() { - local list="$1" - shift 1 - - POSTS=() - for p in "$list"/!(*[!0-9]*); do - POSTS+=( "$p" ) - done -} - -print_lists() { - find_lists - for x in "${LISTS[@]}"; do - printf "%s: %s\n" "$x" "$(<$x/title)" - done -} - -print_posts() { - find_posts "$1" - for p in "${POSTS[@]}"; do - local post=$(readlink "$p") - printf "%s: %s\n" "${p##*/}" "${post##*/}" - done -} - -add_list() { - local list="$1" - mkdir lists/"$list" - shift 1 - echo "$@" >lists/"$list"/title -} - -while getopts_long ":la:" opt \ - posts required_argument \ - "" "$@" -do - case $opt in - l) - print_lists - exit 0;; - a) - shift "$(($OPTLIND - 1))" - add_list "$OPTLARG" "$@" - exit 0;; - posts) - print_posts "$OPTLARG" - ;; - :) - printf >&2 '%s: %s\n' "${0##*/}" "$OPTLERR" - exit 1;; - esac -done diff --git a/posts.sh b/posts.sh deleted file mode 100755 index 464def8..0000000 --- a/posts.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -shopt -s extglob nullglob - -add_to_list() { - list=$(basename "$1") - file=$(basename "$2") - last_link=$(find ./lists/"$list" -regex '.*/[0-9]*$' -printf '%f\n' | sort | tail -n1) - new_link=$(printf '%03d\n' $(($last_link + 1))) - ln -s ../../posts/"$file" ./lists/"$list"/"$new_link" -} - -new_post() { - filename="$1" - shift 1 - cat >posts/$filename <&2 '%s: %s\n' "${0##*/}" "$OPTLERR" - exit 1;; - esac -done diff --git a/rss/default.rss.do b/rss/default.rss.do deleted file mode 100644 index a10b032..0000000 --- a/rss/default.rss.do +++ /dev/null @@ -1,4 +0,0 @@ -redo-ifchange ../lists/$2.html - -find ../lists/$2 -maxdepth 1 -mindepth 1 -not -name 'preview' -not -name 'title' -print0 | \ - xargs -x -0 -- ../build/generate-rss.hs "$(printf "Dirty-Haskell.org — %s" "$(cat ../lists/$2/title)")" diff --git a/src/Site.hs b/src/Site.hs new file mode 100644 index 0000000..d1afbce --- /dev/null +++ b/src/Site.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE OverloadedStrings #-} + +import Hakyll + +main :: IO () +main = hakyllWith config $ do + match "/posts/*" $ do + route $ setExtension ".html" + compile $ do + pandocCompiler + >>= saveSnapshot "content" + >>= loadAndApplyTemplate "templates/default.html" defaultContext + >>= relativizeUrls + +config :: Configuration +config = defaultConfiguration diff --git a/style.css b/style.css deleted file mode 100644 index 7b89107..0000000 --- a/style.css +++ /dev/null @@ -1,40 +0,0 @@ -body { - margin: auto; - padding-right: 1em; - padding-left: 1em; - font: normal 1.1em monospace; - max-width: 60em; - text-align: justify; -} - -.display-math { - display: block; - margin-top: 0.2em; - margin-bottm: 0.2em; - text-align: center; -} - -.inline-math { - display: inline; -} - -a { - color: inherit; -} - -p { - margin-bottom: 0 -} - -p + p { - text-indent: 1.5em; - margin-top: 0; -} - -pre { - margin-left: 1.5em; -} - -p code { - font-style:italic; -} \ No newline at end of file diff --git a/sync.do b/sync.do deleted file mode 100644 index 58a69e0..0000000 --- a/sync.do +++ /dev/null @@ -1,2 +0,0 @@ -redo-ifchange htdocs -rsync -rz -e ssh --delete htdocs/ yggdrasil.li:/var/www/dirty-haskell.org/ \ No newline at end of file diff --git a/templates/default.html b/templates/default.html new file mode 100644 index 0000000..970848f --- /dev/null +++ b/templates/default.html @@ -0,0 +1,55 @@ + + + + + + +$for(author-meta)$ + +$endfor$ +$if(date-meta)$ + +$endif$ + $if(title-prefix)$$title-prefix$ - $endif$$pagetitle$ + + +$if(quotes)$ + +$endif$ +$if(highlighting-css)$ + +$endif$ +$for(css)$ + +$endfor$ +$if(math)$ + $math$ +$endif$ +$for(header-includes)$ + $header-includes$ +$endfor$ + + +$for(include-before)$ +$include-before$ +$endfor$ +$if(title)$ +
+

dirty-haskell.org: $title$

+
+$endif$ +$if(toc)$ + +$endif$ +$body$ +$for(include-after)$ +$include-after$ +$endfor$ + + -- cgit v1.2.3