git.iko.soy/typeable/pandoc
on master help sign in
Fetch images when generating PDF via context.

To do this, we create the temp directory as a subdirectory of the working directory. Since context mk IV by default looks for images in the parent directory, this works. Closes #3380.

commite1304aa59c2a942be5487e8ad774f323b7740e2b authorJohn MacFarlane <jgm@berkeley.edu> dateSat 25 Feb 2017, 21:46 (10 years ago) parent654859a
1 file changed+6−3
src/Text/Pandoc/PDF.hs+6−3
src/Text/Pandoc/PDF.hs+6−3
@@ -38,7 +38,7 @@ import Data.Monoid ((<>))
3838import System.Exit (ExitCode (..))
3939import System.FilePath
4040import System.IO (stdout)
41−import System.IO.Temp (withTempFile)
41+import System.IO.Temp (withTempFile, withTempDirectory)
4242import System.Directory
4343import Data.Digest.Pure.SHA (showDigest, sha1)
4444import System.Environment
@@ -104,8 +104,11 @@ makePDF "wkhtmltopdf" writer opts verbosity _ doc@(Pandoc meta _) = liftIO $ do
104104 setVerbosity verbosity
105105 writer opts doc
106106 html2pdf verbosity args source
107−makePDF program writer opts verbosity mediabag doc =
108− liftIO $ withTempDir "tex2pdf." $ \tmpdir -> do
107+makePDF program writer opts verbosity mediabag doc = do
108+ let withTemp = if takeBaseName program == "context"
109+ then withTempDirectory "."
110+ else withTempDir
111+ liftIO $ withTemp "tex2pdf." $ \tmpdir -> do
109112 doc' <- handleImages verbosity opts mediabag tmpdir doc
110113 source <- runIOorExplode $ do
111114 setVerbosity verbosity