aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua/Module/MediaBag.hs
diff options
context:
space:
mode:
authordespresc <[email protected]>2019-11-04 16:12:37 -0500
committerJohn MacFarlane <[email protected]>2019-11-12 16:03:45 -0800
commit90e436d49604e3fd1ef9432fb23f6d7f6245c7fd (patch)
tree4e7f0692f989643189f1fc6786050d95e239a0ea /src/Text/Pandoc/Lua/Module/MediaBag.hs
parentd3966372f5049eea56213b069fc4d70d8af9144c (diff)
Switch to new pandoc-types and use Text instead of String [API change].
PR #5884. + Use pandoc-types 1.20 and texmath 0.12. + Text is now used instead of String, with a few exceptions. + In the MediaBag module, some of the types using Strings were switched to use FilePath instead (not Text). + In the Parsing module, new parsers `manyChar`, `many1Char`, `manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`, `mantyUntilChar` have been added: these are like their unsuffixed counterparts but pack some or all of their output. + `glob` in Text.Pandoc.Class still takes String since it seems to be intended as an interface to Glob, which uses strings. It seems to be used only once in the package, in the EPUB writer, so that is not hard to change.
Diffstat (limited to 'src/Text/Pandoc/Lua/Module/MediaBag.hs')
-rw-r--r--src/Text/Pandoc/Lua/Module/MediaBag.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Lua/Module/MediaBag.hs b/src/Text/Pandoc/Lua/Module/MediaBag.hs
index 261785665..951571ddd 100644
--- a/src/Text/Pandoc/Lua/Module/MediaBag.hs
+++ b/src/Text/Pandoc/Lua/Module/MediaBag.hs
@@ -15,7 +15,6 @@ module Text.Pandoc.Lua.Module.MediaBag
import Prelude
import Control.Monad (zipWithM_)
-import Data.Maybe (fromMaybe)
import Foreign.Lua (Lua, NumResults, Optional, liftIO)
import Text.Pandoc.Class (CommonState (..), fetchItem, putCommonState,
runIOorExplode, setMediaBag)
@@ -25,6 +24,7 @@ import Text.Pandoc.Lua.Util (addFunction)
import Text.Pandoc.MIME (MimeType)
import qualified Data.ByteString.Lazy as BL
+import qualified Data.Text as T
import qualified Foreign.Lua as Lua
import qualified Text.Pandoc.MediaBag as MB
@@ -113,7 +113,7 @@ mediaDirectoryFn = do
Lua.push "length" *> Lua.push contentLength *> Lua.rawset (-3)
Lua.rawseti (-2) idx
-fetch :: String
+fetch :: T.Text
-> Lua NumResults
fetch src = do
commonState <- getCommonState
@@ -122,6 +122,6 @@ fetch src = do
putCommonState commonState
setMediaBag mediaBag
fetchItem src
- Lua.push $ fromMaybe "" mimeType
+ Lua.push $ maybe "" T.unpack mimeType
Lua.push bs
return 2 -- returns 2 values: contents, mimetype