mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
docs: Regen docshelper
This commit is contained in:
parent
943ff7f7ce
commit
b6e6438f7f
3 changed files with 311 additions and 223 deletions
File diff suppressed because it is too large
Load diff
|
@ -57,10 +57,10 @@ func createLayoutExamples() any {
|
||||||
{"Home page with layout set", layouts.LayoutDescriptor{Kind: "home", Type: "page", Layout: demoLayout, OutputFormatName: "html", Suffix: "html"}},
|
{"Home page with layout set", layouts.LayoutDescriptor{Kind: "home", Type: "page", Layout: demoLayout, OutputFormatName: "html", Suffix: "html"}},
|
||||||
{"AMP home, French language", layouts.LayoutDescriptor{Kind: "home", Type: "page", Lang: "fr", OutputFormatName: "amp", Suffix: "html"}},
|
{"AMP home, French language", layouts.LayoutDescriptor{Kind: "home", Type: "page", Lang: "fr", OutputFormatName: "amp", Suffix: "html"}},
|
||||||
{"JSON home", layouts.LayoutDescriptor{Kind: "home", Type: "page", OutputFormatName: "json", Suffix: "json"}},
|
{"JSON home", layouts.LayoutDescriptor{Kind: "home", Type: "page", OutputFormatName: "json", Suffix: "json"}},
|
||||||
{"RSS home", layouts.LayoutDescriptor{Kind: "home", Type: "page", OutputFormatName: "rss", Suffix: "rss"}},
|
{"RSS home", layouts.LayoutDescriptor{Kind: "home", Type: "page", OutputFormatName: "rss", Suffix: "xml"}},
|
||||||
{"RSS section posts", layouts.LayoutDescriptor{Kind: "section", Type: "posts", OutputFormatName: "rss", Suffix: "rss"}},
|
{"RSS section posts", layouts.LayoutDescriptor{Kind: "section", Type: "posts", OutputFormatName: "rss", Suffix: "xml"}},
|
||||||
{"Taxonomy in categories", layouts.LayoutDescriptor{Kind: "taxonomy", Type: "categories", Section: "category", OutputFormatName: "rss", Suffix: "rss"}},
|
{"Taxonomy in categories", layouts.LayoutDescriptor{Kind: "taxonomy", Type: "categories", Section: "category", OutputFormatName: "rss", Suffix: "xml"}},
|
||||||
{"Term in categories", layouts.LayoutDescriptor{Kind: "term", Type: "categories", Section: "category", OutputFormatName: "rss", Suffix: "rss"}},
|
{"Term in categories", layouts.LayoutDescriptor{Kind: "term", Type: "categories", Section: "category", OutputFormatName: "rss", Suffix: "xml"}},
|
||||||
{"Section list for \"posts\" section", layouts.LayoutDescriptor{Kind: "section", Type: "posts", Section: "posts", OutputFormatName: "html", Suffix: "html"}},
|
{"Section list for \"posts\" section", layouts.LayoutDescriptor{Kind: "section", Type: "posts", Section: "posts", OutputFormatName: "html", Suffix: "html"}},
|
||||||
{"Section list for \"posts\" section with type set to \"blog\"", layouts.LayoutDescriptor{Kind: "section", Type: "blog", Section: "posts", OutputFormatName: "html", Suffix: "html"}},
|
{"Section list for \"posts\" section with type set to \"blog\"", layouts.LayoutDescriptor{Kind: "section", Type: "blog", Section: "posts", OutputFormatName: "html", Suffix: "html"}},
|
||||||
{"Section list for \"posts\" section with layout set to \"demoLayout\"", layouts.LayoutDescriptor{Kind: "section", Layout: demoLayout, Section: "posts", OutputFormatName: "html", Suffix: "html"}},
|
{"Section list for \"posts\" section with layout set to \"demoLayout\"", layouts.LayoutDescriptor{Kind: "section", Layout: demoLayout, Section: "posts", OutputFormatName: "html", Suffix: "html"}},
|
||||||
|
|
|
@ -170,15 +170,18 @@ func (namespaces TemplateFuncsNamespaces) MarshalJSON() ([]byte, error) {
|
||||||
buf.WriteString("{")
|
buf.WriteString("{")
|
||||||
|
|
||||||
for i, ns := range namespaces {
|
for i, ns := range namespaces {
|
||||||
if i != 0 {
|
|
||||||
buf.WriteString(",")
|
|
||||||
}
|
|
||||||
b, err := ns.toJSON(context.TODO())
|
b, err := ns.toJSON(context.TODO())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if b != nil {
|
||||||
|
if i != 0 {
|
||||||
|
buf.WriteString(",")
|
||||||
|
}
|
||||||
buf.Write(b)
|
buf.Write(b)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buf.WriteString("}")
|
buf.WriteString("}")
|
||||||
|
|
||||||
|
@ -202,6 +205,11 @@ func (t *TemplateFuncsNamespace) toJSON(ctx context.Context) ([]byte, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if tctx == nil {
|
||||||
|
// E.g. page.
|
||||||
|
// We should fix this, but we're going to abandon this construct in a little while.
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
ctxType := reflect.TypeOf(tctx)
|
ctxType := reflect.TypeOf(tctx)
|
||||||
for i := 0; i < ctxType.NumMethod(); i++ {
|
for i := 0; i < ctxType.NumMethod(); i++ {
|
||||||
method := ctxType.Method(i)
|
method := ctxType.Method(i)
|
||||||
|
|
Loading…
Reference in a new issue