aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-04-23 10:08:25 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-04-23 10:08:25 -0700
commitd88a601642c30b954bbc057892a359447d0cef4f (patch)
tree9a2bb1e781f6de275fcd198be6b851be3f7d8741 /src/Text/Pandoc
parentdd344715f64039d00f57fb39519db7bc60a3c121 (diff)
downloadpandoc-d88a601642c30b954bbc057892a359447d0cef4f.tar.gz
Allow use of -output-directory in --pdf-engine-opt.
This is currently possible with `mklatex` and `-outdir`, but was not yet possible with xelatex and `-output-directory`. Closes #5462.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/PDF.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index 97daa6859..516cc4002 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -47,7 +47,7 @@ import Text.Pandoc.Writers.Shared (getField, metaToJSON)
#ifdef _WINDOWS
import Data.List (intercalate)
#endif
-import Data.List (isPrefixOf)
+import Data.List (isPrefixOf, find)
import Text.Pandoc.Class (PandocIO, extractMedia, fillMediaBag, getCommonState,
getVerbosity, putCommonState, report,
runIOorExplode, setVerbosity)
@@ -330,10 +330,12 @@ getResultingPDF logFile pdfFile = do
runTeXProgram :: Verbosity -> String -> [String] -> Int -> Int -> FilePath
-> Text -> PandocIO (ExitCode, ByteString, Maybe ByteString)
runTeXProgram verbosity program args runNumber numRuns tmpDir' source = do
+ let isOutdirArg x = "-outdir=" `isPrefixOf` x ||
+ "-output-directory=" `isPrefixOf` x
let tmpDir =
- case [x | x <- args, "-outdir=" `isPrefixOf` x] of
- [x] -> drop 8 x
- _ -> tmpDir'
+ case find isOutdirArg args of
+ Just x -> drop 1 $ dropWhile (/='=') x
+ Nothing -> tmpDir'
liftIO $ createDirectoryIfMissing True tmpDir
let file = tmpDir ++ "/input.tex" -- note: tmpDir has / path separators
exists <- liftIO $ doesFileExist file