summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-05-20 23:46:31 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-05-20 23:46:51 +0200
commit6a7f980247bd2e3fcb7b977edbbcd1fc17758074 (patch)
tree767d6726fbd544966c8affd3652ec74ff5e0eb4a
parentd109c8be8fe97631fa29affed0de6c4d50f56a95 (diff)
PDF: Got --resource-path working with pdf output.
See #852.
-rw-r--r--src/Text/Pandoc/PDF.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index 090bcbc6d..e8a826e4c 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -63,8 +63,8 @@ import Text.Pandoc.Writers.Shared (getField, metaToJSON)
import Data.List (intercalate)
#endif
import Text.Pandoc.Class (PandocIO, report, runIO, runIOorExplode,
- setMediaBag, setVerbosity,
- fillMediaBag, extractMedia)
+ setMediaBag, setVerbosity, getResourcePath,
+ setResourcePath, fillMediaBag, extractMedia)
import Text.Pandoc.Logging
#ifdef _WINDOWS
@@ -112,8 +112,9 @@ makePDF program writer opts verbosity mediabag doc = do
let withTemp = if takeBaseName program == "context"
then withTempDirectory "."
else withTempDir
+ resourcePath <- getResourcePath
liftIO $ withTemp "tex2pdf." $ \tmpdir -> do
- doc' <- handleImages verbosity opts mediabag tmpdir doc
+ doc' <- handleImages verbosity opts resourcePath mediabag tmpdir doc
source <- runIOorExplode $ do
setVerbosity verbosity
writer opts doc'
@@ -126,13 +127,15 @@ makePDF program writer opts verbosity mediabag doc = do
handleImages :: Verbosity
-> WriterOptions
+ -> [FilePath]
-> MediaBag
-> FilePath -- ^ temp dir to store images
-> Pandoc -- ^ document
-> IO Pandoc
-handleImages verbosity opts mediabag tmpdir doc = do
+handleImages verbosity opts resourcePath mediabag tmpdir doc = do
doc' <- runIOorExplode $ do
setVerbosity verbosity
+ setResourcePath resourcePath
setMediaBag mediabag
fillMediaBag (writerSourceURL opts) doc >>=
extractMedia tmpdir