htmlAttrs: escape id and class attributes, like the others.

This commit is contained in:
John MacFarlane
2026-09-07 09:29:18 -07:00
parent b724efe93c
commit f0314bb112
+3 -2
View File
@@ -204,10 +204,11 @@ htmlAttrs :: HasChars a => Attr -> Doc a
htmlAttrs (ident, classes, kvs) = addSpaceIfNotEmpty (hsep [
if T.null ident
then empty
else "id=" <> doubleQuotes (text $ T.unpack ident)
else "id=" <> doubleQuotes (text $ T.unpack (escapeStringForXML ident))
,if null classes
then empty
else "class=" <> doubleQuotes (text $ T.unpack (T.unwords classes))
else "class=" <> doubleQuotes
(text $ T.unpack . escapeStringForXML $ T.unwords classes)
,hsep (map (\(k,v) -> formatKey k <> "=" <>
doubleQuotes (text $ T.unpack (escapeStringForXML v))) kvs)
])