[add] sui build process to include s:slots attribute for slot HTML
This commit is contained in:
parent
6b3a8c543c
commit
794cb3a215
1 changed files with 10 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/PuerkitoBio/goquery"
|
"github.com/PuerkitoBio/goquery"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/yaoapp/kun/log"
|
"github.com/yaoapp/kun/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -174,6 +175,15 @@ func (page *Page) parse(doc *goquery.Document, option *BuildOption, warnings []s
|
||||||
|
|
||||||
if option.KeepPageTag {
|
if option.KeepPageTag {
|
||||||
sel.SetHtml(fmt.Sprintf("\n%s\n%s\n%s\n", style, addTabToEachLine(html), script))
|
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
|
continue
|
||||||
}
|
}
|
||||||
sel.ReplaceWithHtml(fmt.Sprintf("\n%s\n%s\n%s\n", style, html, script))
|
sel.ReplaceWithHtml(fmt.Sprintf("\n%s\n%s\n%s\n", style, html, script))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue