@@ -50,19 +50,26 @@ makeDataURI (mime, raw) =
5050 then mime <> ";charset=utf-8"
5151 else mime -- mime type already has charset
5252
53+isSourceAttribute :: T.Text -> (T.Text, T.Text) -> Bool
54+isSourceAttribute tagname (x,_) =
55+ x == "src" ||
56+ x == "data-src" ||
57+ (x == "href" && tagname == "link") ||
58+ x == "poster" ||
59+ x == "data-background-image"
60+
5361convertTags :: PandocMonad m => [Tag T.Text] -> m [Tag T.Text]
5462convertTags [] = return []
5563convertTags (t@TagOpen{}:ts)
5664 | fromAttrib "data-external" t == "1" = (t:) <$> convertTags ts
5765convertTags (t@(TagOpen tagname as):ts)
58− | tagname `elem`
59− ["img", "embed", "video", "input", "audio", "source", "track",
60− "section"] = do
66+ | any (isSourceAttribute tagname) as
67+ = do
6168 as' <- mapM processAttribute as
6269 rest <- convertTags ts
6370 return $ TagOpen tagname as' : rest
6471 where processAttribute (x,y) =
65− if x `elem` ["src", "data-src", "href", "poster", "data-background-image"]
72+ if isSourceAttribute tagname (x,y)
6673 then do
6774 enc <- getDataURI (fromAttrib "type" t) y
6875 return (x, enc)