diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-03-01 10:57:10 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-03-01 10:57:10 -0800 |
commit | 89ccbc171b8224001048693ae599b7bc413c36f5 (patch) | |
tree | 13ab7d5ed170a24840691878d4bf3cec1ca01869 /src | |
parent | 5769ce9e55bd220f26747fe8ef50c17c8089310e (diff) | |
download | pandoc-89ccbc171b8224001048693ae599b7bc413c36f5.tar.gz |
Make `--fail-if-warnings` work for PDF output.
Closes #5343.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/PDF.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs index e9c0d8889..ace7c6456 100644 --- a/src/Text/Pandoc/PDF.hs +++ b/src/Text/Pandoc/PDF.hs @@ -94,22 +94,28 @@ makePDF program pdfargs writer opts doc = do if '~' `elem` tmp then withTempDirectory "." templ action else withSystemTempDirectory templ action - liftIO $ withTempDir "tex2pdf." $ \tmpdir' -> do + (newCommonState, res) <- liftIO $ withTempDir "tex2pdf." $ \tmpdir' -> do #ifdef _WINDOWS -- note: we want / even on Windows, for TexLive let tmpdir = changePathSeparators tmpdir' #else let tmpdir = tmpdir' #endif - source <- runIOorExplode $ do + (source, newCommonState) + <- runIOorExplode $ do putCommonState commonState doc' <- handleImages tmpdir doc - writer opts doc' - case baseProg of + result <- writer opts doc' + cs <- getCommonState + return (result, cs) + res <- case baseProg of "context" -> context2pdf verbosity program pdfargs tmpdir source prog | prog `elem` ["pdflatex", "lualatex", "xelatex", "latexmk"] -> tex2pdf verbosity program pdfargs tmpdir source _ -> return $ Left $ UTF8.fromStringLazy $ "Unknown program " ++ program + return (newCommonState, res) + putCommonState newCommonState + return res makeWithWkhtmltopdf :: String -- ^ wkhtmltopdf or path -> [String] -- ^ arguments |