From ad0f5d57fe98d2b2eda92e55d7a3128f956e7cd2 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 21 Jun 2016 16:00:57 +0100 Subject: [PATCH] make a little update --- fileinfo.go | 4 ++-- page.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fileinfo.go b/fileinfo.go index ee558231..8bc2bde1 100644 --- a/fileinfo.go +++ b/fileinfo.go @@ -165,7 +165,7 @@ func (fi FileInfo) serveSingleFile(w http.ResponseWriter, r *http.Request, c *Co templates := []string{"single", "actions", "base"} for _, t := range templates { - code, err := page.AddTemplate(t, Asset) + code, err := page.AddTemplate(t, Asset, nil) if err != nil { return code, err } @@ -228,7 +228,7 @@ func (fi FileInfo) serveListing(w http.ResponseWriter, r *http.Request, c *Confi templates := []string{"listing", "actions", "base"} for _, t := range templates { - code, err := page.AddTemplate(t, Asset) + code, err := page.AddTemplate(t, Asset, nil) if err != nil { return code, err } diff --git a/page.go b/page.go index c268c45c..a65aa80a 100644 --- a/page.go +++ b/page.go @@ -72,7 +72,7 @@ func (p PageInfo) PreviousLink() string { } // AddTemplate adds a template file to the page template -func (p *Page) AddTemplate(name string, assets AssetFunc) (int, error) { +func (p *Page) AddTemplate(name string, assets AssetFunc, functions template.FuncMap) (int, error) { // Get the template from the assets page, err := assets("templates/" + name + ".tmpl") @@ -86,7 +86,7 @@ func (p *Page) AddTemplate(name string, assets AssetFunc) (int, error) { // If it's the first iteration, creates a new template and add the // functions map if p.Tpl == nil { - p.Tpl, err = template.New(name).Parse(string(page)) + p.Tpl, err = template.New(name).Funcs(functions).Parse(string(page)) } else { p.Tpl, err = p.Tpl.Parse(string(page)) }