parent
5769ce9e55
commit
89ccbc171b
1 changed files with 10 additions and 4 deletions
|
@ -94,22 +94,28 @@ makePDF program pdfargs writer opts doc = do
|
||||||
if '~' `elem` tmp
|
if '~' `elem` tmp
|
||||||
then withTempDirectory "." templ action
|
then withTempDirectory "." templ action
|
||||||
else withSystemTempDirectory templ action
|
else withSystemTempDirectory templ action
|
||||||
liftIO $ withTempDir "tex2pdf." $ \tmpdir' -> do
|
(newCommonState, res) <- liftIO $ withTempDir "tex2pdf." $ \tmpdir' -> do
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
-- note: we want / even on Windows, for TexLive
|
-- note: we want / even on Windows, for TexLive
|
||||||
let tmpdir = changePathSeparators tmpdir'
|
let tmpdir = changePathSeparators tmpdir'
|
||||||
#else
|
#else
|
||||||
let tmpdir = tmpdir'
|
let tmpdir = tmpdir'
|
||||||
#endif
|
#endif
|
||||||
source <- runIOorExplode $ do
|
(source, newCommonState)
|
||||||
|
<- runIOorExplode $ do
|
||||||
putCommonState commonState
|
putCommonState commonState
|
||||||
doc' <- handleImages tmpdir doc
|
doc' <- handleImages tmpdir doc
|
||||||
writer opts doc'
|
result <- writer opts doc'
|
||||||
case baseProg of
|
cs <- getCommonState
|
||||||
|
return (result, cs)
|
||||||
|
res <- case baseProg of
|
||||||
"context" -> context2pdf verbosity program pdfargs tmpdir source
|
"context" -> context2pdf verbosity program pdfargs tmpdir source
|
||||||
prog | prog `elem` ["pdflatex", "lualatex", "xelatex", "latexmk"]
|
prog | prog `elem` ["pdflatex", "lualatex", "xelatex", "latexmk"]
|
||||||
-> tex2pdf verbosity program pdfargs tmpdir source
|
-> tex2pdf verbosity program pdfargs tmpdir source
|
||||||
_ -> return $ Left $ UTF8.fromStringLazy $ "Unknown program " ++ program
|
_ -> return $ Left $ UTF8.fromStringLazy $ "Unknown program " ++ program
|
||||||
|
return (newCommonState, res)
|
||||||
|
putCommonState newCommonState
|
||||||
|
return res
|
||||||
|
|
||||||
makeWithWkhtmltopdf :: String -- ^ wkhtmltopdf or path
|
makeWithWkhtmltopdf :: String -- ^ wkhtmltopdf or path
|
||||||
-> [String] -- ^ arguments
|
-> [String] -- ^ arguments
|
||||||
|
|
Loading…
Add table
Reference in a new issue