Skip to content

Commit

Permalink
fix: xml parse
Browse files Browse the repository at this point in the history
  • Loading branch information
Ackites committed Aug 24, 2024
1 parent dc55a26 commit 9208f2c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/unpack/uxml.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,15 @@ func getDomTree(node interface{}) string {
// 处理属性
if attr, ok := node["attr"].(map[string]interface{}); ok {
for key, value := range attr {
sb.WriteString(fmt.Sprintf(" %s=\"%v\"", key, value))
key = strings.TrimPrefix(key, "$wxs:")
if strings.HasPrefix(key, "$") {
continue
}
if value == nil {
sb.WriteString(fmt.Sprintf(" %s=\"\"", key))
} else {
sb.WriteString(fmt.Sprintf(" %s=\"%v\"", key, value))
}
}
}

Expand Down

0 comments on commit 9208f2c

Please sign in to comment.