Skip to content

Commit 6237700

Browse files
committed
log(svgToPng): log calls to rsvg-convert with --trace
Signed-off-by: Edwin Török <[email protected]>
1 parent 3c17869 commit 6237700

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Text/Pandoc/Image.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@ import Data.Text (Text)
1818
import Text.Pandoc.Shared (tshow)
1919
import qualified Control.Exception as E
2020
import Control.Monad.IO.Class (MonadIO(liftIO))
21+
import Text.Pandoc.Class.PandocMonad
22+
import qualified Data.Text as T
2123

2224
-- | Convert svg image to png. rsvg-convert
2325
-- is used and must be available on the path.
24-
svgToPng :: MonadIO m
26+
svgToPng :: (PandocMonad m, MonadIO m)
2527
=> Int -- ^ DPI
2628
-> L.ByteString -- ^ Input image as bytestring
2729
-> m (Either Text L.ByteString)
2830
svgToPng dpi bs = do
2931
let dpi' = show dpi
32+
let args = ["-f","png","-a","--dpi-x",dpi',"--dpi-y",dpi']
33+
trace (T.intercalate " " $ map T.pack $ "rsvg-convert" : args)
3034
liftIO $ E.catch
3135
(do (exit, out) <- pipeProcess Nothing "rsvg-convert"
32-
["-f","png","-a","--dpi-x",dpi',"--dpi-y",dpi']
36+
args
3337
bs
3438
return $ if exit == ExitSuccess
3539
then Right out

0 commit comments

Comments
 (0)