Add text transformation template functions.

This commit is contained in:
Vincent Batoufflet 2014-01-26 10:28:35 +01:00 committed by spf13
parent 18b9948f1e
commit 0ce6f05f59

View file

@ -170,6 +170,9 @@ func NewTemplate() Template {
"mod": func(a, b int) int { return a % b },
"mul": func(a, b int) int { return a * b },
"modBool": func(a, b int) bool { return a%b == 0 },
"lower": func(a string) string { return strings.ToLower(a) },
"upper": func(a string) string { return strings.ToUpper(a) },
"title": func(a string) string { return strings.Title(a) },
}
templates.Funcs(funcMap)