git.iko.soy/typeable/pandoc
on master help sign in
EPUB writer: recognize `Format "html4"`, `Format "html5"` as raw HTML.
f04e02dJohn MacFarlane
src/Text/Pandoc/Writers/EPUB.hs+8−2
@@ -1059,11 +1059,17 @@ getMediaNextNewName ext = do
1059 let nextName = "file" ++ show nextId ++ ext
1059 let nextName = "file" ++ show nextId ++ ext
1060 (P.fetchItem (TS.pack nextName) >> getMediaNextNewName ext) `catchError` const (return nextName)
1060 (P.fetchItem (TS.pack nextName) >> getMediaNextNewName ext) `catchError` const (return nextName)
1061
1061
1062+isHtmlFormat :: Format -> Bool
1063+isHtmlFormat (Format "html") = True
1064+isHtmlFormat (Format "html4") = True
1065+isHtmlFormat (Format "html5") = True
1066+isHtmlFormat _ = False
1067+
1062transformBlock :: PandocMonad m
1068transformBlock :: PandocMonad m
1063 => Block
1069 => Block
1064 -> E m Block
1070 -> E m Block
1065transformBlock (RawBlock fmt raw)
1071transformBlock (RawBlock fmt raw)
1066− | fmt == Format "html" = do
1072+ | isHtmlFormat fmt = do
1067 let tags = parseTags raw
1073 let tags = parseTags raw
1068 tags' <- mapM transformTag tags
1074 tags' <- mapM transformTag tags
1069 return $ RawBlock fmt (renderTags' tags')
1075 return $ RawBlock fmt (renderTags' tags')
@@ -1083,7 +1089,7 @@ transformInline opts x@(Math t m)
1083 return $ Span ("",["math",mathclass],[])
1089 return $ Span ("",["math",mathclass],[])
1084 [Image nullAttr [x] ("../" <> newsrc, "")]
1090 [Image nullAttr [x] ("../" <> newsrc, "")]
1085transformInline _opts (RawInline fmt raw)
1091transformInline _opts (RawInline fmt raw)
1086− | fmt == Format "html" = do
1092+ | isHtmlFormat fmt = do
1087 let tags = parseTags raw
1093 let tags = parseTags raw
1088 tags' <- mapM transformTag tags
1094 tags' <- mapM transformTag tags
1089 return $ RawInline fmt (renderTags' tags')
1095 return $ RawInline fmt (renderTags' tags')