diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2023-12-24 12:26:35 -0800 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2023-12-24 12:26:35 -0800 |
| commit | 3c178690e307f6f2e43d64c341712b1bf609e7fc (patch) | |
| tree | 365c3e14de9a3612b038eb0a77c5793175da67db /src/Text | |
| parent | 4672f35143dad0772c1acbb226feba717ae1feca (diff) | |
T.P.PDF: Ensure that we find all the LaTeX warnings requiring rerun.
This should fix a regression from 3.1.9 that led to incorrect
alignments in tables (and possibly other issues).
Closes #9284.
Diffstat (limited to 'src/Text')
| -rw-r--r-- | src/Text/Pandoc/PDF.hs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs index 060262449..bdbe019df 100644 --- a/src/Text/Pandoc/PDF.hs +++ b/src/Text/Pandoc/PDF.hs @@ -425,18 +425,23 @@ runTeXProgram program args tmpDir = do logContents <- if logExists then readFileLazy logFile else return mempty - needsRerun <- checkForRerun logContents - if needsRerun && runNumber < 3 - then go file env'' programArgs (runNumber + 1) + let rerunWarnings = checkForRerun logContents + if not (null rerunWarnings) && runNumber < 3 + then do + report $ MakePDFInfo "Rerun needed" + (T.intercalate "\n" + (map (UTF8.toText . BC.toStrict) rerunWarnings)) + go file env'' programArgs (runNumber + 1) else do let pdfFile = replaceExtension file ".pdf" (log', pdf) <- getResultingPDF (Just logFile) pdfFile return (exit, fromMaybe out log', pdf) - checkForRerun log' = pure $ any isRerunWarning $ BC.lines log' + checkForRerun log' = filter isRerunWarning $ BC.lines log' - isRerunWarning ln = BC.isPrefixOf "LaTeX Warning:" ln && - BS.isInfixOf "Rerun to" (BL.toStrict ln) + isRerunWarning ln = + let ln' = BL.toStrict ln + in BS.isInfixOf "Warning:" ln' && BS.isInfixOf "Rerun" ln' generic2pdf :: (PandocMonad m, MonadIO m) => String |
