Skip to content

Commit df5ae1c

Browse files
committed
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.
1 parent 25bba0c commit df5ae1c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Text/Pandoc/Writers/HTML.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ toAttrs kvs = do
633633
return (keys, attrs)
634634
else return (Set.insert k keys, addAttr html5 mbEpubVersion k v attrs)
635635
addAttr html5 mbEpubVersion x y
636+
| T.null x = id -- see #7546
636637
| html5
637638
= if x `Set.member` (html5Attributes <> rdfaAttributes)
638639
|| T.any (== ':') x -- e.g. epub: namespace

test/command/7546.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```
2+
% pandoc -t html -f native
3+
Span ("", [], [("","")]) []
4+
^D
5+
<span></span>
6+
```

0 commit comments

Comments
 (0)