aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-03-05 09:10:09 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-03-05 09:10:09 -0800
commit6fda3619770f7c07ccbfc8a51614c55e01b740d8 (patch)
tree2f0a30ddd90486aaf6ab1d7c7992d51dd17295b7 /src
parent3126b00f11a684a20633cdc3810722e2bf210d36 (diff)
downloadpandoc-6fda3619770f7c07ccbfc8a51614c55e01b740d8.tar.gz
SelfContained: Handle "poster" attribute in "video" tags.
Closes #1188.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/SelfContained.hs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
index 6112e764f..7fc9c2966 100644
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -50,14 +50,16 @@ isOk c = isAscii c && isAlphaNum c
convertTag :: Maybe FilePath -> Tag String -> IO (Tag String)
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 tagname
- (("src",enc) : [(x,y) | (x,y) <- as, x /= "src"])
+ | tagname `elem` ["img", "embed", "video", "input", "audio", "source"] = do
+ as' <- mapM processAttribute as
+ return $ TagOpen tagname as'
+ where processAttribute (x,y) =
+ if x == "src" || x == "href" || x == "poster"
+ then do
+ (raw, mime) <- getRaw userdata (fromAttrib "type" t) y
+ let enc = "data:" ++ mime ++ ";base64," ++ toString (encode raw)
+ return (x, enc)
+ else return (x,y)
convertTag userdata t@(TagOpen "script" as) =
case fromAttrib "src" t of
[] -> return t