mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-24 15:44:59 +08:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user