diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-03-26 08:45:25 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-03-26 08:45:25 -0700 |
commit | 40f0a6dd66514168fe352e786b2e918a91fa98e3 (patch) | |
tree | 06eb48a159900e9dbe3c98373f1255f379c6c10e | |
parent | 727645bc1f4f01a2e3f05a23e550b49e09f0c90c (diff) | |
download | pandoc-40f0a6dd66514168fe352e786b2e918a91fa98e3.tar.gz |
SelfContained: handle src in embed, audio, source, input tags.
-rw-r--r-- | src/Text/Pandoc/SelfContained.hs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs index f1118b974..01e03c66a 100644 --- a/src/Text/Pandoc/SelfContained.hs +++ b/src/Text/Pandoc/SelfContained.hs @@ -49,20 +49,15 @@ isOk :: Char -> Bool isOk c = isAscii c && isAlphaNum c convertTag :: Maybe FilePath -> Tag String -> IO (Tag String) -convertTag userdata t@(TagOpen "img" as) = +convertTag userdata t@(TagOpen tagname as) + | tagname `elem` ["img", "embed", "video", "input", "audio", "source"] = case fromAttrib "src" t of [] -> return t src -> do (raw, mime) <- getRaw userdata (fromAttrib "type" t) src let enc = "data:" ++ mime ++ ";base64," ++ toString (encode raw) - return $ TagOpen "img" (("src",enc) : [(x,y) | (x,y) <- as, x /= "src"]) -convertTag userdata t@(TagOpen "video" as) = - case fromAttrib "src" t of - [] -> return t - src -> do - (raw, mime) <- getRaw userdata (fromAttrib "type" t) src - let enc = "data:" ++ mime ++ ";base64," ++ toString (encode raw) - return $ TagOpen "video" (("src",enc) : [(x,y) | (x,y) <- as, x /= "src"]) + return $ TagOpen tagname + (("src",enc) : [(x,y) | (x,y) <- as, x /= "src"]) convertTag userdata t@(TagOpen "script" as) = case fromAttrib "src" t of [] -> return t |