git.iko.soy/typeable/pandoc
on master help sign in
Use $for$ for header-includes.

Put variables in right order. We've specified that if they use -A, -B, -H multiple times, the text appears in the same order as on the command line. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1722 788f1e2b-df1e-0410-8736-df70ead52e1b

commitfbef848a3af236ca3a18e6aad7c459e93b8495fc authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateThu 31 Dec 2009, 01:15 (17 years ago) parent7baa795
6 files changed+34−21
src/pandoc.hs+10−10 templates/context.template+2−2 templates/html.template+2−2 templates/latex.template+2−2 templates/markdown.template+2−2 templates/rst.template+16−3
src/pandoc.hs+10−10
@@ -347,7 +347,7 @@ options =
347347 (\arg opt ->
348348 case break (`elem` ":=") arg of
349349 (k,_:v) -> do
350− let newvars = (k, v) : optVariables opt
350+ let newvars = optVariables opt ++ [(k,v)]
351351 return opt{ optVariables = newvars }
352352 _ -> do
353353 hPutStrLn stderr $ "Could not parse `" ++ arg ++ "' as a key/value pair (k=v or k:v)"
@@ -358,7 +358,8 @@ options =
358358 , Option "c" ["css"]
359359 (ReqArg
360360 (\arg opt -> do
361− let newvars = ("css",arg) : optVariables opt
361+ -- add new link to end, so it is included in proper order
362+ let newvars = optVariables opt ++ [("css",arg)]
362363 return opt { optVariables = newvars,
363364 optStandalone = True })
364365 "URL")
@@ -368,7 +369,8 @@ options =
368369 (ReqArg
369370 (\arg opt -> do
370371 text <- readFile arg
371− let newvars = ("header-includes",text) : optVariables opt
372+ -- add new ones to end, so they're included in order specified
373+ let newvars = optVariables opt ++ [("header-includes",text)]
372374 return opt { optVariables = newvars,
373375 optStandalone = True })
374376 "FILENAME")
@@ -379,7 +381,8 @@ options =
379381 (\arg opt -> do
380382 text <- readFile arg
381383 let oldBefore = optBefore opt
382− return opt { optBefore = text : oldBefore })
384+ -- add new text to end, so it is included in proper order
385+ return opt { optBefore = oldBefore ++ [text] })
383386 "FILENAME")
384387 "" -- "File to include before document body"
385388
@@ -388,7 +391,8 @@ options =
388391 (\arg opt -> do
389392 text <- readFile arg
390393 let oldAfter = optAfter opt
391− return opt { optAfter = text : oldAfter })
394+ -- add new text to end, so it is included in proper order
395+ return opt { optAfter = oldAfter ++ [text]})
392396 "FILENAME")
393397 "" -- "File to include after document body"
394398
@@ -625,11 +629,7 @@ main = do
625629 variables' <- if writerName' == "s5" && standalone'
626630 then do
627631 inc <- s5HeaderIncludes
628− return $ case lookup "header-includes" variables of
629− Nothing -> ("header-includes", inc) : variables
630− Just a -> ("header-includes", a ++ inc) :
631− filter ((/= "header-includes") . fst)
632− variables
632+ return $ ("header-includes", inc) : variables
633633 else return variables
634634
635635 variables'' <- case mathMethod of
templates/context.template+2−2
@@ -71,9 +71,9 @@ after={\blank[medium]},
7171
7272\protect
7373$endif$
74−$if(header-includes)$
74+$for(header-includes)$
7575$header-includes$
76−$endif$
76+$endfor$
7777
7878$if(title)$
7979\doctitle{$title$}
templates/html.template+2−2
@@ -33,9 +33,9 @@ $endif$
3333$for(css)$
3434 <link rel="stylesheet" href="$css$" type="text/css" />
3535$endfor$
36−$if(header-includes)$
36+$for(header-includes)$
3737 $header-includes$
38−$endif$
38+$endfor$
3939$if(latexmathml-script)$
4040 $latexmathml-script$
4141$endif$
templates/latex.template+2−2
@@ -31,9 +31,9 @@ $if(numbersections)$
3131$else$
3232\setcounter{secnumdepth}{0}
3333$endif$
34−$if(header-includes)$
34+$for(header-includes)$
3535$header-includes$
36−$endif$
36+$endfor$
3737
3838$if(title)$
3939\title{$title$}
templates/markdown.template+2−2
@@ -4,10 +4,10 @@ $if(titleblock)$
44% $date$
55
66$endif$
7−$if(header-includes)$
7+$for(header-includes)$
88$header-includes$
99
10−$endif$
10+$endfor$
1111$if(toc)$
1212$toc$
1313
templates/rst.template+16−3
@@ -1,5 +1,14 @@
11$if(titleblock)$
2−$titleblock$
2+$if(title)$
3+$title$
4+
5+$endif$
6+$if(authors)$
7+$authors$
8+$endif$
9+$if(date)$
10+Date: $date$
11+$endif$
312
413$endif$
514$if(math)$
@@ -7,8 +16,12 @@ $if(math)$
716 :format: html latex
817
918$endif$
10−$if(header-includes)$
11−$header-includes$
19+$if(toc)$
20+.. contents::
1221
1322$endif$
23+$for(header-includes)$
24+$header-includes$
25+
26+$endfor$
1427$body$