diff options
author | rtz12 <koenig@fagott.pw> | 2016-11-13 17:41:51 (UTC) |
---|---|---|
committer | rtz12 <koenig@fagott.pw> | 2016-11-13 17:41:51 (UTC) |
commit | 8912ea5bca857ac509e426286768feb788539628 (patch) | |
tree | 66c5916c9821c2b45f2e7b2d43544eeff1ed9426 /frontend | |
parent | fed8f628b428d8661bf917abd7ae98aa818b883d (diff) | |
parent | aec3f635032120b0d5ca5ada7959d3f09b7fa94c (diff) |
Merge branch 'master' of projekte.fagott.pw:grilist
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/renderer.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/frontend/renderer.go b/frontend/renderer.go index 3fb79bf..d529dff 100644 --- a/frontend/renderer.go +++ b/frontend/renderer.go | |||
@@ -50,7 +50,7 @@ func (r *Renderer) SetDefaultData(data map[string]interface{}) { | |||
50 | } | 50 | } |
51 | 51 | ||
52 | // New erstellt einen neuen Renderer und sucht alle Templates aus dem gegebenen pfad. | 52 | // New erstellt einen neuen Renderer und sucht alle Templates aus dem gegebenen pfad. |
53 | func New(path string) *Renderer { | 53 | func New(path string, functions map[string]interface{}) *Renderer { |
54 | // Custom Template Funcs | 54 | // Custom Template Funcs |
55 | funcMap := template.FuncMap{ | 55 | funcMap := template.FuncMap{ |
56 | "html": func(in string) template.HTML { | 56 | "html": func(in string) template.HTML { |
@@ -73,6 +73,10 @@ func New(path string) *Renderer { | |||
73 | }, | 73 | }, |
74 | } | 74 | } |
75 | 75 | ||
76 | for k, v := range functions { | ||
77 | funcMap[k] = v | ||
78 | } | ||
79 | |||
76 | files := make([]string, 0) | 80 | files := make([]string, 0) |
77 | filepath.Walk(path, func(path string, info os.FileInfo, err error) error { | 81 | filepath.Walk(path, func(path string, info os.FileInfo, err error) error { |
78 | if info.IsDir() || !strings.HasSuffix(path, ".html") { | 82 | if info.IsDir() || !strings.HasSuffix(path, ".html") { |