mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
docs: Regenerate docs helper
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
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.
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user