Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2024-12-06 10:07:11 +08:00
commit ca5d906612

View file

@ -596,7 +596,7 @@ func normalizeTree(tree *parse.Tree) (yfmRootID, yfmTitle, yfmUpdated string) {
} }
continue continue
} }
if "tags" == attrK { if "tags" == attrK && nil != attrV {
var tags string var tags string
if str, ok := attrV.(string); ok { if str, ok := attrV.(string); ok {
tags = strings.TrimSpace(str) tags = strings.TrimSpace(str)
@ -614,7 +614,10 @@ func normalizeTree(tree *parse.Tree) (yfmRootID, yfmTitle, yfmUpdated string) {
tags += tagStr + "," tags += tagStr + ","
} }
tags = strings.TrimRight(tags, ",") tags = strings.TrimRight(tags, ",")
tree.Root.SetIALAttr("tags", tags) tags = strings.TrimSpace(tags)
if "" != tags {
tree.Root.SetIALAttr("tags", tags)
}
continue continue
} }