mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
@@ -49,7 +49,7 @@ type TemplateFuncsNamespace struct {
|
||||
Name string
|
||||
|
||||
// This is the method receiver.
|
||||
Context func(v ...interface{}) (interface{}, error)
|
||||
Context func(v ...any) (any, error)
|
||||
|
||||
// Additional info, aliases and examples, per method name.
|
||||
MethodMappings map[string]TemplateFuncMethodMapping
|
||||
@@ -59,7 +59,7 @@ type TemplateFuncsNamespace struct {
|
||||
type TemplateFuncsNamespaces []*TemplateFuncsNamespace
|
||||
|
||||
// AddMethodMapping adds a method to a template function namespace.
|
||||
func (t *TemplateFuncsNamespace) AddMethodMapping(m interface{}, aliases []string, examples [][2]string) {
|
||||
func (t *TemplateFuncsNamespace) AddMethodMapping(m any, aliases []string, examples [][2]string) {
|
||||
if t.MethodMappings == nil {
|
||||
t.MethodMappings = make(map[string]TemplateFuncMethodMapping)
|
||||
}
|
||||
@@ -88,7 +88,7 @@ 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{}
|
||||
Method any
|
||||
|
||||
// Any template funcs aliases. This is mainly motivated by keeping
|
||||
// backwards compatibility, but some new template funcs may also make
|
||||
@@ -104,7 +104,7 @@ type TemplateFuncMethodMapping struct {
|
||||
Examples [][2]string
|
||||
}
|
||||
|
||||
func methodToName(m interface{}) string {
|
||||
func methodToName(m any) string {
|
||||
name := runtime.FuncForPC(reflect.ValueOf(m).Pointer()).Name()
|
||||
name = filepath.Ext(name)
|
||||
name = strings.TrimPrefix(name, ".")
|
||||
|
Reference in New Issue
Block a user