diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-09-12 08:25:41 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-09-12 08:25:41 -0700 |
commit | 6509501e90442ab4e4c5488b8f4b1aef16352885 (patch) | |
tree | 1ae25a5f5669d7fc1ced0631d218343b5ecc1a9f | |
parent | 5e5ec586d4ae5058e6265956ea906ae8f3453c82 (diff) | |
download | pandoc-6509501e90442ab4e4c5488b8f4b1aef16352885.tar.gz |
Use defaultLatexEngine instead of `head latexEngines`.
Partial functions make me nervous.
-rw-r--r-- | src/Text/Pandoc/App.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index 93a2a9da6..3e8d767f8 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -124,9 +124,15 @@ parseOptions options' defaults = do latexEngines :: [String] latexEngines = ["pdflatex", "lualatex", "xelatex"] +defaultLatexEngine :: String +defaultLatexEngine = "pdflatex" + htmlEngines :: [String] htmlEngines = ["wkhtmltopdf", "weasyprint", "prince"] +defaultHtmlEngine :: String +defaultHtmlEngine = "wkhtmltopdf" + pdfEngines :: [String] pdfEngines = latexEngines ++ htmlEngines ++ ["context", "pdfroff"] @@ -140,7 +146,7 @@ pdfWriterAndProg mWriter mEngine = do (Left err, _) -> panErr err (_, Left err) -> panErr err where - go Nothing Nothing = (Right "latex", Right $ head latexEngines) + go Nothing Nothing = (Right "latex", Right defaultLatexEngine) go (Just writer) Nothing = (Right writer, engineForWriter writer) go Nothing (Just engine) = (writerForEngine engine, Right engine) go (Just writer) (Just engine) = @@ -162,9 +168,9 @@ pdfWriterAndProg mWriter mEngine = do engineForWriter "context" = Right "context" engineForWriter "ms" = Right "pdfroff" - engineForWriter "latex" = Right $ head latexEngines + engineForWriter "latex" = Right defaultLatexEngine engineForWriter format - | format `elem` ["html", "html5"] = Right $ head htmlEngines + | format `elem` ["html", "html5"] = Right defaultHtmlEngine | otherwise = Left $ "cannot produce pdf output with output format " ++ format |