Merge pull request #671 from trheyi/main
fix the bug in handling the replaceNodeUse attribute
This commit is contained in:
commit
1b808f9239
2 changed files with 9 additions and 2 deletions
|
|
@ -135,8 +135,8 @@ func (data Data) replaceNodeUse(re *regexp.Regexp, node *html.Node) bool {
|
||||||
|
|
||||||
case html.ElementNode:
|
case html.ElementNode:
|
||||||
for i := range node.Attr {
|
for i := range node.Attr {
|
||||||
// Keepwords
|
|
||||||
if strings.HasPrefix(node.Attr[i].Key, "s:") || node.Attr[i].Key == "is" {
|
if (strings.HasPrefix(node.Attr[i].Key, "s:") || node.Attr[i].Key == "is") && !allowUsePropAttrs[node.Attr[i].Key] {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,13 @@ var keepWords = map[string]bool{
|
||||||
"s:bind": true,
|
"s:bind": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var allowUsePropAttrs = map[string]bool{
|
||||||
|
"s:if": true,
|
||||||
|
"s:elif": true,
|
||||||
|
"s:for": true,
|
||||||
|
"s:click": true,
|
||||||
|
}
|
||||||
|
|
||||||
var keepAttrs = map[string]bool{
|
var keepAttrs = map[string]bool{
|
||||||
"s:ns": true,
|
"s:ns": true,
|
||||||
"s:cn": true,
|
"s:cn": true,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue