harness-drone/server/template/template.go

17 lines
371 B
Go
Raw Normal View History

package template
2017-05-12 14:06:01 +00:00
//go:generate togo tmpl -package template -func funcMap -format html -input files/*.html
import (
"encoding/json"
"html/template"
)
2017-05-12 14:06:01 +00:00
var funcMap = template.FuncMap{"json": marshal}
2017-03-20 15:51:41 +00:00
// marshal is a helper function to render data as JSON inside the template.
func marshal(v interface{}) template.JS {
a, _ := json.Marshal(v)
return template.JS(a)
}