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

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

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