From 77396199e746e5aa4489e6d483bec6157448bc82 Mon Sep 17 00:00:00 2001 From: fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> Date: Sat, 2 Jan 2010 18:19:24 +0000 Subject: [PATCH] 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 --- src/markdown2pdf.hs | 6 ++++-- 1 file 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