git.iko.soy/typeable/pandoc
on master help sign in
markdown2pdf: always do at least two runs.

Reason: hyperref bookmarks require this. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1797 788f1e2b-df1e-0410-8736-df70ead52e1b

commit66c4f90e09a7087c4d67ff4b0787a27821271eab authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateTue 5 Jan 2010, 08:36 (17 years ago) parente1e9bfc
2 files changed+5−4
markdown2pdf+3−1 src/markdown2pdf.hs+2−3
markdown2pdf+3−1
@@ -123,8 +123,10 @@ fi
123123 fi
124124 fi
125125 fi
126− else
126+ elif [ $runs -gt 1 ]; then # always run at least twice for pdf bookmarks
127127 finished=yes
128+ else
129+ runs=$(($runs + 1))
128130 fi
129131 done
130132) || exit $?
src/markdown2pdf.hs+2−3
@@ -3,7 +3,7 @@ module Main where
33import Data.List (isInfixOf, intercalate, isPrefixOf)
44import Data.Maybe (isNothing)
55
6−import Control.Monad (unless, guard, when)
6+import Control.Monad (unless, guard)
77import Control.Exception (tryJust, bracket)
88
99import System.IO (stderr)
@@ -75,6 +75,7 @@ runLatex latexProgram file = step 3
7575 case result of
7676 Left (Left err) -> return $ Left err
7777 Left (Right _) | n > 1 -> step (n-1 :: Int)
78+ Right _ | n > 2 -> step (n-1 :: Int)
7879 Left (Right msg) -> return $ Left msg
7980 Right pdfFile -> return $ Right pdfFile
8081
@@ -201,8 +202,6 @@ main = bracket
201202 Left err -> exit err
202203 Right texFile -> do
203204 -- run pdflatex
204− when ("--toc" `elem` opts || "--table-of-contents" `elem` opts) $
205− runLatex latexProgram texFile >> return () -- toc requires extra run
206205 latexRes <- runLatex latexProgram texFile
207206 case latexRes of
208207 Left err -> exit err