Skip to content

Commit

Permalink
Merge pull request #671 from trheyi/main
Browse files Browse the repository at this point in the history
fix the bug in handling the replaceNodeUse attribute
  • Loading branch information
trheyi authored Jul 8, 2024
2 parents c0f9105 + 9bae50b commit 1b808f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sui/core/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ func (data Data) replaceNodeUse(re *regexp.Regexp, node *html.Node) bool {

case html.ElementNode:
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
}

Expand Down
7 changes: 7 additions & 0 deletions sui/core/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ var keepWords = map[string]bool{
"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{
"s:ns": true,
"s:cn": true,
Expand Down

0 comments on commit 1b808f9

Please sign in to comment.