HTML writer: Don't create invalid data- attribute...

for empty attribute key. (It would be better to make these
unrepresentable in the type system, but for now this is
an improvement.)

Closes #7546.
This commit is contained in:
John MacFarlane 2021-11-19 08:50:18 -08:00
parent 25bba0cc62
commit df5ae1c186
2 changed files with 7 additions and 0 deletions

View file

@ -633,6 +633,7 @@ toAttrs kvs = do
return (keys, attrs)
else return (Set.insert k keys, addAttr html5 mbEpubVersion k v attrs)
addAttr html5 mbEpubVersion x y
| T.null x = id -- see #7546
| html5
= if x `Set.member` (html5Attributes <> rdfaAttributes)
|| T.any (== ':') x -- e.g. epub: namespace

6
test/command/7546.md Normal file
View file

@ -0,0 +1,6 @@
```
% pandoc -t html -f native
Span ("", [], [("","")]) []
^D
<span></span>
```