Let Amber template call Hugo's custom functions
authorTatsushi Demachi <tdemachi@gmail.com>
Mon, 20 Jul 2015 00:07:55 +0000 (09:07 +0900)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 20 Jul 2015 09:29:15 +0000 (11:29 +0200)
Amber doesn't share text/template `FuncMap` functions and has its own
function list. This allows Amber to call Hugo's custom functions.

tpl/template.go

index 60fc91746fd56a3515aef339efcb4c1bd833d8d8..357a9fbd2a0aed6df17188c65ceda67bc5f18fa6 100644 (file)
@@ -82,6 +82,9 @@ func New() Template {
 
        localTemplates = &templates.Template
 
+       for k, v := range funcMap {
+               amber.FuncMap[k] = v
+       }
        templates.Funcs(funcMap)
        templates.LoadEmbedded()
        return templates