tpl: Add docshelper for template funcs

And fix some other minor related issues.

Updates #3418
This commit is contained in:
Bjørn Erik Pedersen
2017-05-01 18:40:34 +02:00
parent e2b067f050
commit 690b0f8ff5
25 changed files with 2064 additions and 347 deletions

View File

@@ -51,8 +51,14 @@ func (t *templateFuncster) initFuncMap() {
panic(ns.Name + " is a duplicate template func")
}
funcMap[ns.Name] = ns.Context
for k, v := range ns.Aliases {
funcMap[k] = v
for _, mm := range ns.MethodMappings {
for _, alias := range mm.Aliases {
if _, exists := funcMap[alias]; exists {
panic(alias + " is a duplicate template func")
}
funcMap[alias] = mm.Method
}
}
}