Merge pull request #519 from trheyi/main
[add] sui build process to include s:slots attribute for slot HTML
This commit is contained in:
commit
5cbd0454bb
1 changed files with 10 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/yaoapp/kun/log"
|
||||
)
|
||||
|
||||
|
|
@ -174,6 +175,15 @@ func (page *Page) parse(doc *goquery.Document, option *BuildOption, warnings []s
|
|||
|
||||
if option.KeepPageTag {
|
||||
sel.SetHtml(fmt.Sprintf("\n%s\n%s\n%s\n", style, addTabToEachLine(html), script))
|
||||
|
||||
// Set Slot HTML
|
||||
slotsAttr, err := jsoniter.MarshalToString(slots)
|
||||
if err != nil {
|
||||
warns = append(warns, err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
sel.SetAttr("s:slots", slotsAttr)
|
||||
continue
|
||||
}
|
||||
sel.ReplaceWithHtml(fmt.Sprintf("\n%s\n%s\n%s\n", style, html, script))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue