refactor: Create context if not exists in SUI page build
This commit is contained in:
parent
28537e2163
commit
35e23f29ae
1 changed files with 5 additions and 3 deletions
|
|
@ -22,6 +22,11 @@ var langAttrRe = regexp.MustCompile(`'::(.*?)'`)
|
|||
// Build is the struct for the public
|
||||
func (page *Page) Build(ctx *BuildContext, option *BuildOption) (*goquery.Document, []string, error) {
|
||||
|
||||
// Create the context if not exists
|
||||
if ctx == nil {
|
||||
ctx = NewBuildContext(nil)
|
||||
}
|
||||
|
||||
warnings := []string{}
|
||||
html, err := page.BuildHTML(option)
|
||||
if err != nil {
|
||||
|
|
@ -34,9 +39,6 @@ func (page *Page) Build(ctx *BuildContext, option *BuildOption) (*goquery.Docume
|
|||
warnings = append(warnings, err.Error())
|
||||
}
|
||||
|
||||
// Add components scripts and styles
|
||||
ctx.doc = doc
|
||||
|
||||
// Append the nested html
|
||||
err = page.parse(ctx, doc, option, warnings)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue