From df5ae1c186ed625e25cf6f080ddf24549f7af22e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 19 Nov 2021 08:50:18 -0800 Subject: 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. --- src/Text/Pandoc/Writers/HTML.hs | 1 + test/command/7546.md | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 test/command/7546.md diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 0a4c47387..247cddfc9 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -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 diff --git a/test/command/7546.md b/test/command/7546.md new file mode 100644 index 000000000..aed17275e --- /dev/null +++ b/test/command/7546.md @@ -0,0 +1,6 @@ +``` +% pandoc -t html -f native +Span ("", [], [("","")]) [] +^D + +``` -- cgit v1.2.3