aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-01-03 11:35:36 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-01-03 11:35:36 -0800
commitf04e02d8d5ff893475c129aaf69ee3f175bf8d8f (patch)
tree2cccad2e05e18e01990d85348f410674da33c9a0 /src/Text/Pandoc
parent21ee2d80c25d6e7fe3be00b58de553b638c90abb (diff)
downloadpandoc-f04e02d8d5ff893475c129aaf69ee3f175bf8d8f.tar.gz
EPUB writer: recognize `Format "html4"`, `Format "html5"` as raw HTML.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index a24a872ef..6222b0690 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -1059,11 +1059,17 @@ getMediaNextNewName ext = do
let nextName = "file" ++ show nextId ++ ext
(P.fetchItem (TS.pack nextName) >> getMediaNextNewName ext) `catchError` const (return nextName)
+isHtmlFormat :: Format -> Bool
+isHtmlFormat (Format "html") = True
+isHtmlFormat (Format "html4") = True
+isHtmlFormat (Format "html5") = True
+isHtmlFormat _ = False
+
transformBlock :: PandocMonad m
=> Block
-> E m Block
transformBlock (RawBlock fmt raw)
- | fmt == Format "html" = do
+ | isHtmlFormat fmt = do
let tags = parseTags raw
tags' <- mapM transformTag tags
return $ RawBlock fmt (renderTags' tags')
@@ -1083,7 +1089,7 @@ transformInline opts x@(Math t m)
return $ Span ("",["math",mathclass],[])
[Image nullAttr [x] ("../" <> newsrc, "")]
transformInline _opts (RawInline fmt raw)
- | fmt == Format "html" = do
+ | isHtmlFormat fmt = do
let tags = parseTags raw
tags' <- mapM transformTag tags
return $ RawInline fmt (renderTags' tags')