diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-05-01 18:40:34 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-05-01 21:44:15 +0200 |
commit | 690b0f8ff5795318dfa3834a5a75d6623e7d934a (patch) | |
tree | 1112306f4c6fecc0966d880dec702c3804633deb /tpl/data/init.go | |
parent | e2b067f0504ba41ef45786e2f83d7002bd13a7eb (diff) |
tpl: Add docshelper for template funcs
And fix some other minor related issues.
Updates #3418
Diffstat (limited to 'tpl/data/init.go')
-rw-r--r-- | tpl/data/init.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tpl/data/init.go b/tpl/data/init.go index 476e9ab75..e9e4ca2f9 100644 --- a/tpl/data/init.go +++ b/tpl/data/init.go @@ -24,19 +24,21 @@ func init() { f := func(d *deps.Deps) *internal.TemplateFuncsNamespace { ctx := New(d) - examples := [][2]string{ - {}, - } - - return &internal.TemplateFuncsNamespace{ + ns := &internal.TemplateFuncsNamespace{ Name: name, Context: func() interface{} { return ctx }, - Aliases: map[string]interface{}{ - "getCSV": ctx.GetCSV, - "getJSON": ctx.GetJSON, - }, - Examples: examples, } + + ns.AddMethodMapping(ctx.GetCSV, + []string{"getCSV"}, + [][2]string{}, + ) + + ns.AddMethodMapping(ctx.GetJSON, + []string{"getJSON"}, + [][2]string{}, + ) + return ns } internal.AddTemplateFuncsNamespace(f) |