From 38f7fc92ff20e1d6c4412fa4346e596b9cd73934 Mon Sep 17 00:00:00 2001 From: yuin Date: Sun, 16 May 2021 11:03:36 +0900 Subject: [PATCH] Fixes #219 --- _test/options.txt | 8 ++++++++ parser/attribute.go | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/_test/options.txt b/_test/options.txt index 99bc29c..433c49f 100644 --- a/_test/options.txt +++ b/_test/options.txt @@ -60,3 +60,11 @@ //- - - - - - - - -//

Test ## {#hey .sort,class=fine,class=shell} Doesn't matter

//= = = = = = = = = = = = = = = = = = = = = = = =// + + +6: class must be a string +//- - - - - - - - -// +# Test ## {class=0#.} +//- - - - - - - - -// +

Test ## {class=0#.}

+//= = = = = = = = = = = = = = = = = = = = = = = =// diff --git a/parser/attribute.go b/parser/attribute.go index ea8c064..4c7cc24 100644 --- a/parser/attribute.go +++ b/parser/attribute.go @@ -129,6 +129,11 @@ func parseAttribute(reader text.Reader) (Attribute, bool) { if !ok { return Attribute{}, false } + if bytes.Equal(name, attrNameClass) { + if _, ok = value.([]byte); !ok { + return Attribute{}, false + } + } return Attribute{Name: name, Value: value}, true }