summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-02-28 08:52:15 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-02-28 08:59:57 +0100
commit12d00d288cec5018949be06010df7c11d8ff06f0 (patch)
treefba0437e3f411439209c87e48d7eebe028a5c8f6
parent260ff1374de71de507ffa435b8e0950aa3cb28a8 (diff)
docs: Regenerate docs helper
-rw-r--r--docs/data/docs.json48
-rw-r--r--tpl/internal/templatefuncsRegistry.go7
-rw-r--r--tpl/os/os.go12
3 files changed, 59 insertions, 8 deletions
diff --git a/docs/data/docs.json b/docs/data/docs.json
index 68a3f8cc7..b38edc86a 100644
--- a/docs/data/docs.json
+++ b/docs/data/docs.json
@@ -1688,6 +1688,7 @@
"style": "monokai",
"codeFences": true,
"noClasses": true,
+ "noHl": false,
"lineNos": false,
"lineNumbersInTable": true,
"anchorLineNos": false,
@@ -1850,7 +1851,8 @@
},
"js": {
"precision": 0,
- "keepVarNames": false
+ "keepVarNames": false,
+ "noNullishOperator": false
},
"json": {
"precision": 0,
@@ -3206,8 +3208,8 @@
],
"Examples": [
[
- "{{ if eq .Section \"blog\" }}current{{ end }}",
- "current"
+ "{{ if eq .Section \"blog\" }}current-section{{ end }}",
+ "current-section"
]
]
},
@@ -3222,7 +3224,7 @@
],
"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!"
]
]
@@ -3745,6 +3747,14 @@
]
}
},
+ "diagrams": {
+ "Goat": {
+ "Description": "",
+ "Args": null,
+ "Aliases": null,
+ "Examples": null
+ }
+ },
"encoding": {
"Base64Decode": {
"Description": "Base64Decode returns the base64 decoding of the given content.",
@@ -4255,6 +4265,12 @@
]
]
},
+ "Counter": {
+ "Description": "",
+ "Args": null,
+ "Aliases": null,
+ "Examples": null
+ },
"Div": {
"Description": "Div divides two numbers.",
"Args": [
@@ -4505,8 +4521,9 @@
},
"partials": {
"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": [
+ "ctx",
"name",
"contextList"
],
@@ -4521,8 +4538,9 @@
]
},
"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": [
+ "ctx",
"name",
"context",
"variants"
@@ -4847,6 +4865,12 @@
"Aliases": null,
"Examples": null
},
+ "Home": {
+ "Description": "",
+ "Args": null,
+ "Aliases": null,
+ "Examples": null
+ },
"Hugo": {
"Description": "",
"Args": null,
@@ -5418,6 +5442,12 @@
}
},
"transform": {
+ "CanHighlight": {
+ "Description": "",
+ "Args": null,
+ "Aliases": null,
+ "Examples": null
+ },
"Emojify": {
"Description": "Emojify returns a copy of s with all emoji codes replaced with actual emojis.\n\nSee http://www.emoji-cheat-sheet.com/",
"Args": [
@@ -5495,6 +5525,12 @@
],
"Examples": []
},
+ "HighlightCodeBlock": {
+ "Description": "",
+ "Args": null,
+ "Aliases": null,
+ "Examples": null
+ },
"Markdownify": {
"Description": "Markdownify renders a given input from Markdown to HTML.",
"Args": [
diff --git a/tpl/internal/templatefuncsRegistry.go b/tpl/internal/templatefuncsRegistry.go
index df300a5bb..fe5dfe7ca 100644
--- a/tpl/internal/templatefuncsRegistry.go
+++ b/tpl/internal/templatefuncsRegistry.go
@@ -163,6 +163,10 @@ func (namespaces TemplateFuncsNamespaces) MarshalJSON() ([]byte, error) {
return buf.Bytes(), nil
}
+var ignoreFuncs = map[string]bool{
+ "Reset": true,
+}
+
func (t *TemplateFuncsNamespace) toJSON() ([]byte, error) {
var buf bytes.Buffer
@@ -179,6 +183,9 @@ func (t *TemplateFuncsNamespace) toJSON() ([]byte, error) {
ctxType := reflect.TypeOf(ctx)
for i := 0; i < ctxType.NumMethod(); i++ {
method := ctxType.Method(i)
+ if ignoreFuncs[method.Name] {
+ continue
+ }
f := goDocFunc{
Name: method.Name,
}
diff --git a/tpl/os/os.go b/tpl/os/os.go
index 8b195a527..2da792ac1 100644
--- a/tpl/os/os.go
+++ b/tpl/os/os.go
@@ -28,9 +28,17 @@ import (
// New returns a new instance of the os-namespaced template functions.
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{
- readFileFs: afero.NewReadOnlyFs(afero.NewCopyOnWriteFs(d.PathSpec.BaseFs.Content.Fs, d.PathSpec.BaseFs.Work)),
- workFs: d.PathSpec.BaseFs.Work,
+ readFileFs: readFileFs,
+ workFs: workFs,
deps: d,
}
}