[add] sui build IgnoreDocument support
This commit is contained in:
parent
4015573f5b
commit
46b20bb778
3 changed files with 9 additions and 3 deletions
|
|
@ -41,9 +41,13 @@ func (page *Page) Build(option *BuildOption) (*goquery.Document, []string, error
|
||||||
// BuildHTML build the html
|
// BuildHTML build the html
|
||||||
func (page *Page) BuildHTML(option *BuildOption) (string, error) {
|
func (page *Page) BuildHTML(option *BuildOption) (string, error) {
|
||||||
|
|
||||||
html := string(page.Document)
|
html := string(page.Codes.HTML.Code)
|
||||||
if page.Codes.HTML.Code != "" {
|
|
||||||
html = strings.Replace(html, "{{ __page }}", page.Codes.HTML.Code, 1)
|
if !option.IgnoreDocument {
|
||||||
|
html = string(page.Document)
|
||||||
|
if page.Codes.HTML.Code != "" {
|
||||||
|
html = strings.Replace(html, "{{ __page }}", page.Codes.HTML.Code, 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !option.IgnoreAssetRoot {
|
if !option.IgnoreAssetRoot {
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ func (page *Page) EditorRender() (*ResponseEditorRender, error) {
|
||||||
doc, warnings, err := page.Build(&BuildOption{
|
doc, warnings, err := page.Build(&BuildOption{
|
||||||
SSR: true,
|
SSR: true,
|
||||||
IgnoreAssetRoot: true,
|
IgnoreAssetRoot: true,
|
||||||
|
IgnoreDocument: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ type BuildOption struct {
|
||||||
UpdateAll bool `json:"update_all"`
|
UpdateAll bool `json:"update_all"`
|
||||||
AssetRoot string `json:"asset_root,omitempty"`
|
AssetRoot string `json:"asset_root,omitempty"`
|
||||||
IgnoreAssetRoot bool `json:"ignore_asset_root,omitempty"`
|
IgnoreAssetRoot bool `json:"ignore_asset_root,omitempty"`
|
||||||
|
IgnoreDocument bool `json:"ignore_document,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request is the struct for the request
|
// Request is the struct for the request
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue