Merge pull request #555 from trheyi/main
Update regular expressions in data.go
This commit is contained in:
commit
47796a1886
2 changed files with 12 additions and 2 deletions
|
|
@ -11,8 +11,9 @@ import (
|
||||||
"github.com/yaoapp/kun/log"
|
"github.com/yaoapp/kun/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
var stmtRe = regexp.MustCompile(`\{\{([^}]+)\}\}`)
|
// If set the map value, should keep the space at the end of the statement
|
||||||
var propRe = regexp.MustCompile(`\[\{([^}]+)\}\]`)
|
var stmtRe = regexp.MustCompile(`\{\{([\s\S]*?)\}\}`)
|
||||||
|
var propRe = regexp.MustCompile(`\[\{([\s\S]*?)\}\]`)
|
||||||
|
|
||||||
// Data data for the template
|
// Data data for the template
|
||||||
type Data map[string]interface{}
|
type Data map[string]interface{}
|
||||||
|
|
|
||||||
|
|
@ -331,6 +331,9 @@ func (parser *TemplateParser) ifStatementNode(sel *goquery.Selection) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if res == true {
|
if res == true {
|
||||||
|
parser.removeParsed(sel)
|
||||||
|
parser.parseElementAttrs(sel)
|
||||||
|
parser.parsed(sel)
|
||||||
parser.show(sel)
|
parser.show(sel)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -345,6 +348,9 @@ func (parser *TemplateParser) ifStatementNode(sel *goquery.Selection) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if res == true {
|
if res == true {
|
||||||
|
parser.removeParsed(elifNode)
|
||||||
|
parser.parseElementAttrs(elifNode)
|
||||||
|
parser.parsed(elifNode)
|
||||||
parser.show(elifNode)
|
parser.show(elifNode)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -352,6 +358,9 @@ func (parser *TemplateParser) ifStatementNode(sel *goquery.Selection) {
|
||||||
|
|
||||||
// else
|
// else
|
||||||
if elseNode != nil {
|
if elseNode != nil {
|
||||||
|
parser.removeParsed(elseNode)
|
||||||
|
parser.parseElementAttrs(elseNode)
|
||||||
|
parser.parsed(elseNode)
|
||||||
parser.show(elseNode)
|
parser.show(elseNode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue