27 lines
458 B
Go
Raw Normal View History

2016-11-06 18:32:32 +01:00
package funcmap
import (
"encoding/json"
"strings"
"text/template"
)
var FuncMap = template.FuncMap{
"json": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
"prettyjson": func(v interface{}) string {
a, _ := json.MarshalIndent(v, "", " ")
return string(a)
},
// yaml
// xml
// toml
"split": strings.Split,
"join": strings.Join,
"title": strings.Title,
"lower": strings.ToLower,
"upper": strings.ToUpper,
}