summaryrefslogtreecommitdiff
path: root/src/util/template.go
blob: ec5ac185b645b00c767d0d3013b95f9a3dfae23d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package util

import (
	"path"
	"strings"
	"text/template"
)

func NewTemplate(filenames ...string) *template.Template {
	return template.Must(template.New(path.Base(filenames[0])).
		Funcs(template.FuncMap{
			// Form input helpers
			"hasprefix": strings.HasPrefix,
		}).
		ParseFiles(filenames...))
}