git.iko.soy/typeable/pandoc
on master help sign in
PDF: Changes to error reporting, to handle non-UTF8 error output.
commit3df75bc160827fbd0322ecf48e543977cda0156f authorJohn MacFarlane <jgm@berkeley.edu> dateWed 19 Mar 2014, 11:09 (13 years ago) parent575cc7e
2 files changed+6−4
pandoc.hs+4−1 src/Text/Pandoc/PDF.hs+2−3
pandoc.hs+4−1
@@ -1172,7 +1172,10 @@ main = do
11721172 res <- makePDF latexEngine f writerOptions doc2
11731173 case res of
11741174 Right pdf -> writeBinary pdf
1175− Left err' -> err 43 $ UTF8.toStringLazy err'
1175+ Left err' -> do
1176+ B.hPutStr stderr $ err'
1177+ B.hPut stderr $ B.pack [10]
1178+ err 43 "Error producing PDF from TeX source"
11761179 | otherwise -> selfcontain (f writerOptions doc2 ++
11771180 ['\n' | not standalone'])
11781181 >>= writerFn outputFile . handleEntities
src/Text/Pandoc/PDF.hs+2−3
@@ -116,7 +116,6 @@ tex2pdf' tmpDir program source = do
116116 then 3 -- to get page numbers
117117 else 2 -- 1 run won't give you PDF bookmarks
118118 (exit, log', mbPdf) <- runTeXProgram program numruns tmpDir source
119− let msg = "Error producing PDF from TeX source.\n"
120119 case (exit, mbPdf) of
121120 (ExitFailure _, _) -> do
122121 let logmsg = extractMsg log'
@@ -125,8 +124,8 @@ tex2pdf' tmpDir program source = do
125124 x | "! Package inputenc Error" `BC.isPrefixOf` x ->
126125 "\nTry running pandoc with --latex-engine=xelatex."
127126 _ -> ""
128− return $ Left $ msg <> logmsg <> extramsg
129− (ExitSuccess, Nothing) -> return $ Left msg
127+ return $ Left $ logmsg <> extramsg
128+ (ExitSuccess, Nothing) -> return $ Left ""
130129 (ExitSuccess, Just pdf) -> return $ Right pdf
131130
132131(<>) :: ByteString -> ByteString -> ByteString