mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
tpl: Make the Namespace func signature explicit
This makes it cleaner and avoids breaking client code, such as the docs helper JSON generator.
This commit is contained in:
@@ -45,7 +45,7 @@ type TemplateFuncsNamespace struct {
|
||||
Name string
|
||||
|
||||
// This is the method receiver.
|
||||
Context interface{}
|
||||
Context func(v ...interface{}) interface{}
|
||||
|
||||
// Additional info, aliases and examples, per method name.
|
||||
MethodMappings map[string]TemplateFuncMethodMapping
|
||||
@@ -165,7 +165,7 @@ func (t *TemplateFuncsNamespace) toJSON() ([]byte, error) {
|
||||
|
||||
buf.WriteString(fmt.Sprintf(`%q: {`, t.Name))
|
||||
|
||||
ctx := t.Context.(func() interface{})()
|
||||
ctx := t.Context()
|
||||
ctxType := reflect.TypeOf(ctx)
|
||||
for i := 0; i < ctxType.NumMethod(); i++ {
|
||||
method := ctxType.Method(i)
|
||||
|
Reference in New Issue
Block a user