From e802599795b970cf721bc9aeed6a4c441269a804 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 22 Jul 2024 11:18:12 +0800 Subject: [PATCH] Refactor statement attributes copying logic in SUI core --- sui/core/build.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sui/core/build.go b/sui/core/build.go index 664faaa41..a400d1e23 100644 --- a/sui/core/build.go +++ b/sui/core/build.go @@ -307,6 +307,16 @@ func (page *Page) parseProps(from *goquery.Selection, to *goquery.Selection, ext continue } + // Copy for and if statements + if strings.HasPrefix(attr.Key, "s:for") || attr.Key == "s:if" || attr.Key == "s:else" || attr.Key == "s:elif" { + to.SetAttr(attr.Key, attr.Val) + transKey := fmt.Sprintf("s:trans-attr-%s", attr.Key) + if trans, has := from.Attr(transKey); has { + to.SetAttr(transKey, trans) + } + continue + } + if strings.HasPrefix(attr.Key, "s:") || attr.Key == "is" || attr.Key == "parsed" { continue }