diff --git a/_test/options.txt b/_test/options.txt index 521fd22..df4351a 100644 --- a/_test/options.txt +++ b/_test/options.txt @@ -15,6 +15,8 @@ ## Title6 ## {#id_6 .class6 attr6=value6} ## Title7 ## {#id_7 attr7="value \"7"} + +## Title8 {#id .className attrName=attrValue class="class1 class2"} //- - - - - - - - -//

Title 0

Title1

@@ -24,4 +26,5 @@

Title5

Title6

Title7

+

Title8

//= = = = = = = = = = = = = = = = = = = = = = = =// diff --git a/parser/attribute.go b/parser/attribute.go index 53141b7..e5f0250 100644 --- a/parser/attribute.go +++ b/parser/attribute.go @@ -63,11 +63,9 @@ func ParseAttributes(reader text.Reader) (Attributes, bool) { } if bytes.Equal(attr.Name, attrNameClass) { if !attrs.findUpdate(attrNameClass, func(v interface{}) interface{} { - var ret interface{} - if ret, ok = v.([][]byte); !ok { - ret = [][]byte{v.([]byte)} - } - return append(ret.([][]byte), attr.Value.([]byte)) + ret := make([]byte, 0, len(v.([]byte))+1+len(attr.Value.([]byte))) + ret = append(ret, v.([]byte)...) + return append(append(ret, ' '), attr.Value.([]byte)...) }) { attrs = append(attrs, attr) }