summaryrefslogtreecommitdiff
path: root/src/markdown2pdf.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-01-02 18:19:24 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-01-02 18:19:24 +0000
commit77396199e746e5aa4489e6d483bec6157448bc82 (patch)
treee10ad29991408a88ab06037176246256a181d61a /src/markdown2pdf.hs
parent1e0c8e21cfe028200db4313d0a5dde07ee0f45bc (diff)
markdown2pdf.hs: When --toc, run latex an extra time.
Previously --toc was broken. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1780 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/markdown2pdf.hs')
-rw-r--r--src/markdown2pdf.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/markdown2pdf.hs b/src/markdown2pdf.hs
index 1092cbe6b..769139508 100644
--- a/src/markdown2pdf.hs
+++ b/src/markdown2pdf.hs
@@ -3,7 +3,7 @@ module Main where
import Data.List (isInfixOf, intercalate, isPrefixOf)
import Data.Maybe (isNothing)
-import Control.Monad (unless, guard)
+import Control.Monad (unless, guard, when)
import Control.Exception (tryJust, bracket)
import System.IO (stderr)
@@ -91,7 +91,7 @@ checkLatex txt = (err , bib, ref, unlines $! msgs ++ tips)
ref = any (oneOf ["Warning: Reference"
,"Warning: Label"
,"Warning: There were undefined references"
- ,"--toc", "--table-of-contents"]) msgs
+ ]) msgs
checkPackages :: [String] -> [String]
checkPackages = concatMap chks
@@ -201,6 +201,8 @@ main = bracket
Left err -> exit err
Right texFile -> do
-- run pdflatex
+ when ("--toc" `elem` opts || "--table-of-contents" `elem` opts) $
+ runLatex latexProgram texFile >> return () -- toc requires extra run
latexRes <- runLatex latexProgram texFile
case latexRes of
Left err -> exit err