From 5dda97db8322de992ef36d65dd1162ff7d94780d Mon Sep 17 00:00:00 2001 From: rjp Date: Fri, 1 Apr 2022 14:07:47 +0100 Subject: [PATCH] `attrRe` is too strict re: attribute names --- display.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/display.go b/display.go index 0be946c..3a491bd 100644 --- a/display.go +++ b/display.go @@ -21,7 +21,9 @@ type Displayer interface { } func ParseDisplayer(cmd string) error { - attrRe := regexp.MustCompile(`attr\{([a-zA-Z\-]+)\}`) + // Attribute names can be almost anything. + // cf https://www.w3.org/TR/2012/WD-html5-20120329/syntax.html#syntax-attribute-name + attrRe := regexp.MustCompile(`attr\{([^\s"'>/=\p{Cc}]+)\}`) if cmd == "text{}" { pupDisplayer = TextDisplayer{} } else if cmd == "json{}" {