parent
d109c8be8f
commit
6a7f980247
1 changed files with 7 additions and 4 deletions
|
@ -63,8 +63,8 @@ import Text.Pandoc.Writers.Shared (getField, metaToJSON)
|
||||||
import Data.List (intercalate)
|
import Data.List (intercalate)
|
||||||
#endif
|
#endif
|
||||||
import Text.Pandoc.Class (PandocIO, report, runIO, runIOorExplode,
|
import Text.Pandoc.Class (PandocIO, report, runIO, runIOorExplode,
|
||||||
setMediaBag, setVerbosity,
|
setMediaBag, setVerbosity, getResourcePath,
|
||||||
fillMediaBag, extractMedia)
|
setResourcePath, fillMediaBag, extractMedia)
|
||||||
import Text.Pandoc.Logging
|
import Text.Pandoc.Logging
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
|
@ -112,8 +112,9 @@ makePDF program writer opts verbosity mediabag doc = do
|
||||||
let withTemp = if takeBaseName program == "context"
|
let withTemp = if takeBaseName program == "context"
|
||||||
then withTempDirectory "."
|
then withTempDirectory "."
|
||||||
else withTempDir
|
else withTempDir
|
||||||
|
resourcePath <- getResourcePath
|
||||||
liftIO $ withTemp "tex2pdf." $ \tmpdir -> do
|
liftIO $ withTemp "tex2pdf." $ \tmpdir -> do
|
||||||
doc' <- handleImages verbosity opts mediabag tmpdir doc
|
doc' <- handleImages verbosity opts resourcePath mediabag tmpdir doc
|
||||||
source <- runIOorExplode $ do
|
source <- runIOorExplode $ do
|
||||||
setVerbosity verbosity
|
setVerbosity verbosity
|
||||||
writer opts doc'
|
writer opts doc'
|
||||||
|
@ -126,13 +127,15 @@ makePDF program writer opts verbosity mediabag doc = do
|
||||||
|
|
||||||
handleImages :: Verbosity
|
handleImages :: Verbosity
|
||||||
-> WriterOptions
|
-> WriterOptions
|
||||||
|
-> [FilePath]
|
||||||
-> MediaBag
|
-> MediaBag
|
||||||
-> FilePath -- ^ temp dir to store images
|
-> FilePath -- ^ temp dir to store images
|
||||||
-> Pandoc -- ^ document
|
-> Pandoc -- ^ document
|
||||||
-> IO Pandoc
|
-> IO Pandoc
|
||||||
handleImages verbosity opts mediabag tmpdir doc = do
|
handleImages verbosity opts resourcePath mediabag tmpdir doc = do
|
||||||
doc' <- runIOorExplode $ do
|
doc' <- runIOorExplode $ do
|
||||||
setVerbosity verbosity
|
setVerbosity verbosity
|
||||||
|
setResourcePath resourcePath
|
||||||
setMediaBag mediabag
|
setMediaBag mediabag
|
||||||
fillMediaBag (writerSourceURL opts) doc >>=
|
fillMediaBag (writerSourceURL opts) doc >>=
|
||||||
extractMedia tmpdir
|
extractMedia tmpdir
|
||||||
|
|
Loading…
Reference in a new issue