diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-03-28 20:59:43 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-03-28 21:01:24 -0700 |
commit | 15958600590de508d0ac0ece01c5de17cf126a8e (patch) | |
tree | 78f13b76df8aa3b7c05f89e2c86225477c23d361 /src/Text/Pandoc/Writers | |
parent | 40865958cefeedcca6df582315fab8ba59d43f88 (diff) | |
download | pandoc-15958600590de508d0ac0ece01c5de17cf126a8e.tar.gz |
HTML writer: Don't add data- prefix to RDFa attributes.
Closes #5403.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-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" |