Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCameron Moore <moorereason@gmail.com>2018-09-07 01:25:30 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-09-07 09:25:51 +0300
commitf6f22ad944a1c308fd823792b2fbff1504f42cef (patch)
tree3d233fb691e25e6818a3467e3e2c65d7c46678a9 /tpl/internal
parent400fe96aee8e38112e347e762661b8389701c938 (diff)
tpl: Fix golint godoc issues
Diffstat (limited to 'tpl/internal')
-rw-r--r--tpl/internal/templatefuncsRegistry.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/tpl/internal/templatefuncsRegistry.go b/tpl/internal/templatefuncsRegistry.go
index 0f11be65c..99877dcca 100644
--- a/tpl/internal/templatefuncsRegistry.go
+++ b/tpl/internal/templatefuncsRegistry.go
@@ -34,12 +34,16 @@ import (
"github.com/gohugoio/hugo/deps"
)
+// TemplateFuncsNamespaceRegistry describes a registry of functions that provide
+// namespaces.
var TemplateFuncsNamespaceRegistry []func(d *deps.Deps) *TemplateFuncsNamespace
+// AddTemplateFuncsNamespace adds a given function to a registry.
func AddTemplateFuncsNamespace(ns func(d *deps.Deps) *TemplateFuncsNamespace) {
TemplateFuncsNamespaceRegistry = append(TemplateFuncsNamespaceRegistry, ns)
}
+// TemplateFuncsNamespace represents a template function namespace.
type TemplateFuncsNamespace struct {
// The namespace name, "strings", "lang", etc.
Name string
@@ -51,8 +55,10 @@ type TemplateFuncsNamespace struct {
MethodMappings map[string]TemplateFuncMethodMapping
}
+// TemplateFuncsNamespaces is a slice of TemplateFuncsNamespace.
type TemplateFuncsNamespaces []*TemplateFuncsNamespace
+// AddMethodMapping adds a method to a template function namespace.
func (t *TemplateFuncsNamespace) AddMethodMapping(m interface{}, aliases []string, examples [][2]string) {
if t.MethodMappings == nil {
t.MethodMappings = make(map[string]TemplateFuncMethodMapping)
@@ -80,6 +86,8 @@ func (t *TemplateFuncsNamespace) AddMethodMapping(m interface{}, aliases []strin
}
+// TemplateFuncMethodMapping represents a mapping of functions to methods for a
+// given namespace.
type TemplateFuncMethodMapping struct {
Method interface{}
@@ -134,6 +142,7 @@ func (t goDocFunc) toJSON() ([]byte, error) {
return buf.Bytes(), nil
}
+// MarshalJSON returns the JSON encoding of namespaces.
func (namespaces TemplateFuncsNamespaces) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer