mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
docs: Regenerate docs helper
This commit is contained in:
parent
260ff1374d
commit
12d00d288c
3 changed files with 59 additions and 8 deletions
|
@ -1688,6 +1688,7 @@
|
||||||
"style": "monokai",
|
"style": "monokai",
|
||||||
"codeFences": true,
|
"codeFences": true,
|
||||||
"noClasses": true,
|
"noClasses": true,
|
||||||
|
"noHl": false,
|
||||||
"lineNos": false,
|
"lineNos": false,
|
||||||
"lineNumbersInTable": true,
|
"lineNumbersInTable": true,
|
||||||
"anchorLineNos": false,
|
"anchorLineNos": false,
|
||||||
|
@ -1850,7 +1851,8 @@
|
||||||
},
|
},
|
||||||
"js": {
|
"js": {
|
||||||
"precision": 0,
|
"precision": 0,
|
||||||
"keepVarNames": false
|
"keepVarNames": false,
|
||||||
|
"noNullishOperator": false
|
||||||
},
|
},
|
||||||
"json": {
|
"json": {
|
||||||
"precision": 0,
|
"precision": 0,
|
||||||
|
@ -3206,8 +3208,8 @@
|
||||||
],
|
],
|
||||||
"Examples": [
|
"Examples": [
|
||||||
[
|
[
|
||||||
"{{ if eq .Section \"blog\" }}current{{ end }}",
|
"{{ if eq .Section \"blog\" }}current-section{{ end }}",
|
||||||
"current"
|
"current-section"
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -3222,7 +3224,7 @@
|
||||||
],
|
],
|
||||||
"Examples": [
|
"Examples": [
|
||||||
[
|
[
|
||||||
"{{ if ge .Hugo.Version \"0.36\" }}Reasonable new Hugo version!{{ end }}",
|
"{{ if ge hugo.Version \"0.80\" }}Reasonable new Hugo version!{{ end }}",
|
||||||
"Reasonable new Hugo version!"
|
"Reasonable new Hugo version!"
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -3745,6 +3747,14 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"diagrams": {
|
||||||
|
"Goat": {
|
||||||
|
"Description": "",
|
||||||
|
"Args": null,
|
||||||
|
"Aliases": null,
|
||||||
|
"Examples": null
|
||||||
|
}
|
||||||
|
},
|
||||||
"encoding": {
|
"encoding": {
|
||||||
"Base64Decode": {
|
"Base64Decode": {
|
||||||
"Description": "Base64Decode returns the base64 decoding of the given content.",
|
"Description": "Base64Decode returns the base64 decoding of the given content.",
|
||||||
|
@ -4255,6 +4265,12 @@
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"Counter": {
|
||||||
|
"Description": "",
|
||||||
|
"Args": null,
|
||||||
|
"Aliases": null,
|
||||||
|
"Examples": null
|
||||||
|
},
|
||||||
"Div": {
|
"Div": {
|
||||||
"Description": "Div divides two numbers.",
|
"Description": "Div divides two numbers.",
|
||||||
"Args": [
|
"Args": [
|
||||||
|
@ -4505,8 +4521,9 @@
|
||||||
},
|
},
|
||||||
"partials": {
|
"partials": {
|
||||||
"Include": {
|
"Include": {
|
||||||
"Description": "Include executes the named partial.\nIf the partial contains a return statement, that value will be returned.\nElse, the rendered output will be returned:\nA string if the partial is a text/template, or template.HTML when html/template.",
|
"Description": "Include executes the named partial.\nIf the partial contains a return statement, that value will be returned.\nElse, the rendered output will be returned:\nA string if the partial is a text/template, or template.HTML when html/template.\nNote that ctx is provided by Hugo, not the end user.",
|
||||||
"Args": [
|
"Args": [
|
||||||
|
"ctx",
|
||||||
"name",
|
"name",
|
||||||
"contextList"
|
"contextList"
|
||||||
],
|
],
|
||||||
|
@ -4521,8 +4538,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"IncludeCached": {
|
"IncludeCached": {
|
||||||
"Description": "IncludeCached executes and caches partial templates. The cache is created with name+variants as the key.",
|
"Description": "IncludeCached executes and caches partial templates. The cache is created with name+variants as the key.\nNote that ctx is provided by Hugo, not the end user.",
|
||||||
"Args": [
|
"Args": [
|
||||||
|
"ctx",
|
||||||
"name",
|
"name",
|
||||||
"context",
|
"context",
|
||||||
"variants"
|
"variants"
|
||||||
|
@ -4847,6 +4865,12 @@
|
||||||
"Aliases": null,
|
"Aliases": null,
|
||||||
"Examples": null
|
"Examples": null
|
||||||
},
|
},
|
||||||
|
"Home": {
|
||||||
|
"Description": "",
|
||||||
|
"Args": null,
|
||||||
|
"Aliases": null,
|
||||||
|
"Examples": null
|
||||||
|
},
|
||||||
"Hugo": {
|
"Hugo": {
|
||||||
"Description": "",
|
"Description": "",
|
||||||
"Args": null,
|
"Args": null,
|
||||||
|
@ -5418,6 +5442,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"transform": {
|
"transform": {
|
||||||
|
"CanHighlight": {
|
||||||
|
"Description": "",
|
||||||
|
"Args": null,
|
||||||
|
"Aliases": null,
|
||||||
|
"Examples": null
|
||||||
|
},
|
||||||
"Emojify": {
|
"Emojify": {
|
||||||
"Description": "Emojify returns a copy of s with all emoji codes replaced with actual emojis.\n\nSee http://www.emoji-cheat-sheet.com/",
|
"Description": "Emojify returns a copy of s with all emoji codes replaced with actual emojis.\n\nSee http://www.emoji-cheat-sheet.com/",
|
||||||
"Args": [
|
"Args": [
|
||||||
|
@ -5495,6 +5525,12 @@
|
||||||
],
|
],
|
||||||
"Examples": []
|
"Examples": []
|
||||||
},
|
},
|
||||||
|
"HighlightCodeBlock": {
|
||||||
|
"Description": "",
|
||||||
|
"Args": null,
|
||||||
|
"Aliases": null,
|
||||||
|
"Examples": null
|
||||||
|
},
|
||||||
"Markdownify": {
|
"Markdownify": {
|
||||||
"Description": "Markdownify renders a given input from Markdown to HTML.",
|
"Description": "Markdownify renders a given input from Markdown to HTML.",
|
||||||
"Args": [
|
"Args": [
|
||||||
|
|
|
@ -163,6 +163,10 @@ func (namespaces TemplateFuncsNamespaces) MarshalJSON() ([]byte, error) {
|
||||||
return buf.Bytes(), nil
|
return buf.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ignoreFuncs = map[string]bool{
|
||||||
|
"Reset": true,
|
||||||
|
}
|
||||||
|
|
||||||
func (t *TemplateFuncsNamespace) toJSON() ([]byte, error) {
|
func (t *TemplateFuncsNamespace) toJSON() ([]byte, error) {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
|
||||||
|
@ -179,6 +183,9 @@ func (t *TemplateFuncsNamespace) toJSON() ([]byte, error) {
|
||||||
ctxType := reflect.TypeOf(ctx)
|
ctxType := reflect.TypeOf(ctx)
|
||||||
for i := 0; i < ctxType.NumMethod(); i++ {
|
for i := 0; i < ctxType.NumMethod(); i++ {
|
||||||
method := ctxType.Method(i)
|
method := ctxType.Method(i)
|
||||||
|
if ignoreFuncs[method.Name] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
f := goDocFunc{
|
f := goDocFunc{
|
||||||
Name: method.Name,
|
Name: method.Name,
|
||||||
}
|
}
|
||||||
|
|
12
tpl/os/os.go
12
tpl/os/os.go
|
@ -28,9 +28,17 @@ import (
|
||||||
|
|
||||||
// New returns a new instance of the os-namespaced template functions.
|
// New returns a new instance of the os-namespaced template functions.
|
||||||
func New(d *deps.Deps) *Namespace {
|
func New(d *deps.Deps) *Namespace {
|
||||||
|
var readFileFs, workFs afero.Fs
|
||||||
|
|
||||||
|
// The docshelper script does not have or need all the dependencies set up.
|
||||||
|
if d.PathSpec != nil {
|
||||||
|
readFileFs = afero.NewReadOnlyFs(afero.NewCopyOnWriteFs(d.PathSpec.BaseFs.Content.Fs, d.PathSpec.BaseFs.Work))
|
||||||
|
workFs = d.PathSpec.BaseFs.Work
|
||||||
|
}
|
||||||
|
|
||||||
return &Namespace{
|
return &Namespace{
|
||||||
readFileFs: afero.NewReadOnlyFs(afero.NewCopyOnWriteFs(d.PathSpec.BaseFs.Content.Fs, d.PathSpec.BaseFs.Work)),
|
readFileFs: readFileFs,
|
||||||
workFs: d.PathSpec.BaseFs.Work,
|
workFs: workFs,
|
||||||
deps: d,
|
deps: d,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue