summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-12-31 01:12:14 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-12-31 01:12:14 +0000
commit4806628c8d8ef9e696a981e6f47ede2b3a6f4d48 (patch)
treec384566dedd745c892d511590f5b98bce72f6750 /src
parent359f1109745afbfb1a38754576ba875a406de122 (diff)
Added 'standalone' variable, use in templates.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1697 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs7
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs7
-rw-r--r--src/pandoc.hs5
3 files changed, 6 insertions, 13 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index fadde0760..92bf65b0a 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -62,12 +62,7 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do
, ("title", titletext)
, ("authors", intercalate "\\\\" $ map stringToLaTeX authors)
, ("date", stringToLaTeX date) ]
- let templ = if writerStandalone options
- then writerTemplate options
- else "$if(toc)$\\tableofcontents\n$endif$" ++
- "$if(before)$$before$\n$endif$" ++
- "$body$$if(after)$$after$\n$endif$"
- return $ renderTemplate context templ
+ return $ renderTemplate context $ writerTemplate options
-- escape things as needed for LaTeX
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 305b71310..a72116376 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -70,12 +70,7 @@ pandocToMarkdown opts (Pandoc meta blocks) = do
text "" $+$ refs')
, ("titleblock", render head')
]
- let templ = if writerStandalone opts
- then writerTemplate opts
- else "$if(toc)$$toc$\n$endif$" ++
- "$if(before)$$before$\n$endif$" ++
- "$body$$if(after)$$after$\n$endif$"
- return $ renderTemplate context templ
+ return $ renderTemplate context $ writerTemplate opts
-- | Return markdown representation of reference key table.
keyTableToMarkdown :: WriterOptions -> KeyTable -> State WriterState Doc
diff --git a/src/pandoc.hs b/src/pandoc.hs
index 26bf0abb8..a18e069cc 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -212,7 +212,10 @@ options =
, Option "s" ["standalone"]
(NoArg
- (\opt -> return opt { optStandalone = True }))
+ (\opt -> do
+ let newvars = ("standalone", "yes") : optVariables opt
+ return opt { optStandalone = True,
+ optVariables = newvars }))
"" -- "Include needed header and footer on output"
, Option "o" ["output"]