diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-31 21:18:36 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-31 21:18:36 +0000 |
commit | bdd448ea2cf41324a63bd09771b5ac553e65f540 (patch) | |
tree | 694c12cce932a0a9ac04e7c8c6893a8cf667ced9 /src/Text/Pandoc/Writers/LaTeX.hs | |
parent | 07fe1aedd0d3b393d7cc82c8aa81b309e6eab956 (diff) | |
download | pandoc-bdd448ea2cf41324a63bd09771b5ac553e65f540.tar.gz |
LaTeX writer: Only require listings package if needed.
That is, if literate Haskell code is used.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1759 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Writers/LaTeX.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 1c8604c8a..b9e7e42a8 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -49,6 +49,7 @@ data WriterState = , stLink :: Bool -- true if document has links , stUrl :: Bool -- true if document has visible URL link , stGraphics :: Bool -- true if document contains images + , stLHS :: Bool -- true if document has literate haskell code } -- | Convert Pandoc to LaTeX. @@ -58,7 +59,8 @@ writeLaTeX options document = WriterState { stInNote = False, stOLLevel = 1, stOptions = options, stVerbInNote = False, stEnumerate = False, stTable = False, stStrikeout = False, stSubscript = False, - stLink = False, stUrl = False, stGraphics = False } + stLink = False, stUrl = False, stGraphics = False, + stLHS = False } pandocToLaTeX :: WriterOptions -> Pandoc -> State WriterState String pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do @@ -88,6 +90,7 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do [ ("subscript", "yes") | stSubscript st ] ++ [ ("links", "yes") | stLink st ] ++ [ ("url", "yes") | stUrl st ] ++ + [ ("lhs", "yes") | stLHS st ] ++ [ ("graphics", "yes") | stGraphics st ] return $ if writerStandalone options then renderTemplate context $ writerTemplate options @@ -139,7 +142,9 @@ blockToLaTeX (CodeBlock (_,classes,_) str) = do st <- get env <- if writerLiterateHaskell (stOptions st) && "haskell" `elem` classes && "literate" `elem` classes - then return "code" + then do + modify $ \s -> s{ stLHS = True } + return "code" else if stInNote st then do modify $ \s -> s{ stVerbInNote = True } |