Rename fillMedia -> fillMediaBag.

This commit is contained in:
John MacFarlane 2017-05-07 21:03:18 +02:00
parent a902109c6d
commit 6b086acae8
3 changed files with 8 additions and 7 deletions

View file

@ -70,7 +70,7 @@ import System.IO.Error (isDoesNotExistError)
import Text.Pandoc
import Text.Pandoc.Builder (setMeta)
import Text.Pandoc.Class (PandocIO, getLog, withMediaBag,
extractMedia, fillMedia)
extractMedia, fillMediaBag)
import Text.Pandoc.Highlighting (highlightingStyles)
import Text.Pandoc.Lua ( runLuaFilter )
import Text.Pandoc.PDF (makePDF)
@ -414,7 +414,7 @@ convertWithOpts opts = do
runIO' $ do
(doc, media) <- withMediaBag $ sourceToDoc sources >>=
( (if isJust (optExtractMedia opts)
then fillMedia (writerSourceURL writerOptions)
then fillMediaBag (writerSourceURL writerOptions)
else return)
>=> maybe return extractMedia (optExtractMedia opts)
>=> return . flip (foldr addMetadata) metadata

View file

@ -61,7 +61,7 @@ module Text.Pandoc.Class ( PandocMonad(..)
, runIOorExplode
, runPure
, withMediaBag
, fillMedia
, fillMediaBag
, extractMedia
) where
@ -346,8 +346,8 @@ withPaths (p:ps) action fp =
(\_ -> withPaths ps action fp)
-- | Traverse tree, filling media bag.
fillMedia :: PandocMonad m => Maybe String -> Pandoc -> m Pandoc
fillMedia sourceURL d = walkM handleImage d
fillMediaBag :: PandocMonad m => Maybe String -> Pandoc -> m Pandoc
fillMediaBag sourceURL d = walkM handleImage d
where handleImage :: PandocMonad m => Inline -> m Inline
handleImage (Image attr lab (src, tit)) = catchError
(do (bs, mt) <- fetchItem sourceURL src

View file

@ -63,7 +63,8 @@ import Text.Pandoc.Writers.Shared (getField, metaToJSON)
import Data.List (intercalate)
#endif
import Text.Pandoc.Class (PandocIO, report, runIO, runIOorExplode,
setMediaBag, setVerbosity, fillMedia, extractMedia)
setMediaBag, setVerbosity,
fillMediaBag, extractMedia)
import Text.Pandoc.Logging
#ifdef _WINDOWS
@ -138,7 +139,7 @@ handleImages verbosity opts mediabag tmpdir doc = do
doc' <- runIOorExplode $ do
setVerbosity verbosity
setMediaBag mediabag
fillMedia (writerSourceURL opts) doc >>=
fillMediaBag (writerSourceURL opts) doc >>=
extractMedia tmpdir
walkM (convertImages verbosity tmpdir) doc'