aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl/partials
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2017-05-01 18:40:34 +0200
committerBjørn Erik Pedersen <[email protected]>2017-05-01 21:44:15 +0200
commit690b0f8ff5795318dfa3834a5a75d6623e7d934a (patch)
tree1112306f4c6fecc0966d880dec702c3804633deb /tpl/partials
parente2b067f0504ba41ef45786e2f83d7002bd13a7eb (diff)
downloadhugo-690b0f8ff5795318dfa3834a5a75d6623e7d934a.tar.gz
hugo-690b0f8ff5795318dfa3834a5a75d6623e7d934a.zip
tpl: Add docshelper for template funcs
And fix some other minor related issues. Updates #3418
Diffstat (limited to 'tpl/partials')
-rw-r--r--tpl/partials/init.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/tpl/partials/init.go b/tpl/partials/init.go
index a9d1f82fe..4ee3faf19 100644
--- a/tpl/partials/init.go
+++ b/tpl/partials/init.go
@@ -24,20 +24,25 @@ func init() {
f := func(d *deps.Deps) *internal.TemplateFuncsNamespace {
ctx := New(d)
- examples := [][2]string{
- {`{{ partial "header.html" . }}`, `<title>Hugo Rocks!</title>`},
- }
-
- return &internal.TemplateFuncsNamespace{
+ ns := &internal.TemplateFuncsNamespace{
Name: name,
Context: func() interface{} { return ctx },
- Aliases: map[string]interface{}{
- "partial": ctx.Include,
- "partialCached": ctx.getCached,
- },
- Examples: examples,
}
+ ns.AddMethodMapping(ctx.Include,
+ []string{"partial"},
+ [][2]string{
+ {`{{ partial "header.html" . }}`, `<title>Hugo Rocks!</title>`},
+ },
+ )
+
+ ns.AddMethodMapping(ctx.getCached,
+ []string{"partialCached"},
+ [][2]string{},
+ )
+
+ return ns
+
}
internal.AddTemplateFuncsNamespace(f)