From 40f0a6dd66514168fe352e786b2e918a91fa98e3 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 26 Mar 2013 08:45:25 -0700 Subject: SelfContained: handle src in embed, audio, source, input tags. --- src/Text/Pandoc/SelfContained.hs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src') 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 -- cgit v1.2.3