aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2016-11-29 10:42:48 -0500
committerJohn MacFarlane <jgm@berkeley.edu>2017-01-25 17:07:40 +0100
commitd9f5f551ddfde1c614df93125553421b82f43e76 (patch)
treea4301bac6af13b430a7f249ad80f972c78ab89c7
parentd447552be1c60d5a6ba15cd2a91395e32c8e0554 (diff)
downloadpandoc-d9f5f551ddfde1c614df93125553421b82f43e76.tar.gz
Class: add setMediaBag function.
-rw-r--r--src/Text/Pandoc/Class.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Class.hs b/src/Text/Pandoc/Class.hs
index 13fdc3e50..12e6f900b 100644
--- a/src/Text/Pandoc/Class.hs
+++ b/src/Text/Pandoc/Class.hs
@@ -101,6 +101,7 @@ class (Functor m, Applicative m, Monad m, MonadError PandocExecutionError m) =>
getWarnings :: m [String]
fail :: String -> m b
glob :: String -> m [FilePath]
+ setMediaBag :: MediaBag -> m ()
insertMedia :: FilePath -> Maybe MimeType -> BL.ByteString -> m ()
--Some functions derived from Primitives:
@@ -175,6 +176,8 @@ instance PandocMonad PandocIO where
liftIO $ IO.warn msg
getWarnings = gets ioStWarnings
glob = liftIO . IO.glob
+ setMediaBag mb =
+ modify $ \st -> st{ioStMediaBag = mb}
insertMedia fp mime bs =
modify $ \st -> st{ioStMediaBag = MB.insertMedia fp mime bs (ioStMediaBag st) }
@@ -299,5 +302,8 @@ instance PandocMonad PandocPure where
fontFiles <- asks envFontFiles
return (filter (match (compile s)) fontFiles)
+ setMediaBag mb =
+ modify $ \st -> st{stMediaBag = mb}
+
insertMedia fp mime bs =
modify $ \st -> st{stMediaBag = MB.insertMedia fp mime bs (stMediaBag st) }