Added 'standalone' variable, use in templates.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1697 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
parent
359f110974
commit
4806628c8d
7 changed files with 16 additions and 13 deletions
2
README
2
README
|
@ -475,6 +475,8 @@ will be replaced by the document title.
|
|||
Some variables are set automatically by pandoc. These vary somewhat
|
||||
depending on the output format, but include:
|
||||
|
||||
`standalone`
|
||||
: "yes" if the `-s/--standalone` option was specified
|
||||
`before`
|
||||
: contents specified by `-B/--include-before-body`
|
||||
`after`
|
||||
|
|
|
@ -256,6 +256,8 @@ will be replaced by the document title.
|
|||
Some variables are set automatically by pandoc. These vary somewhat
|
||||
depending on the output format, but include:
|
||||
|
||||
`standalone`
|
||||
: "yes" if the `-s/--standalone` option was specified
|
||||
`before`
|
||||
: contents specified by `-B/--include-before-body`
|
||||
`after`
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
$if(standalone)$
|
||||
$if(legacy-header)$
|
||||
$legacy-header$
|
||||
$else$
|
||||
|
@ -48,6 +49,7 @@ $endif$
|
|||
\begin{document}
|
||||
\maketitle
|
||||
|
||||
$endif$
|
||||
$if(toc)$
|
||||
\tableofcontents
|
||||
$endif$
|
||||
|
@ -58,4 +60,6 @@ $body$
|
|||
$if(after)$
|
||||
$after$
|
||||
$endif$
|
||||
$if(standalone)$
|
||||
\end{document}
|
||||
$endif$
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
$if(standalone)$
|
||||
$if(titleblock)$
|
||||
$titleblock$
|
||||
$endif$
|
||||
$if(header-includes)$
|
||||
$header-includes$
|
||||
$endif$
|
||||
$endif$
|
||||
$if(before)$
|
||||
$before$
|
||||
$endif$
|
||||
|
|
Loading…
Add table
Reference in a new issue