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)) }