diff options
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index ddfb49b55..206a8f5d4 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -603,7 +603,7 @@ toAttrs kvs = do return $ mapMaybe (\(x,y) -> if html5 then - if x `Set.member` html5Attributes + if x `Set.member` (html5Attributes <> rdfaAttributes) || ':' `elem` x -- e.g. epub: namespace || "data-" `isPrefixOf` x then Just $ customAttribute (fromString x) (toValue y) @@ -611,7 +611,7 @@ toAttrs kvs = do (toValue y) else if mbEpubVersion == Just EPUB2 && - not (x `Set.member` html4Attributes || + not (x `Set.member` (html4Attributes <> rdfaAttributes) || "xml:" `isPrefixOf` x) then Nothing else Just $ customAttribute (fromString x) (toValue y)) @@ -1471,6 +1471,23 @@ html5Attributes = Set.fromList , "wrap" ] +-- See https://en.wikipedia.org/wiki/RDFa, https://www.w3.org/TR/rdfa-primer/ +rdfaAttributes :: Set.Set String +rdfaAttributes = Set.fromList + [ "about" + , "rel" + , "rev" + , "src" + , "href" + , "resource" + , "property" + , "content" + , "datatype" + , "typeof" + , "vocab" + , "prefix" + ] + html4Attributes :: Set.Set String html4Attributes = Set.fromList [ "abbr" |