Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Martini Render FuncMap Function to unescape string into HTML and time converting
//needs import ("time")
m.Use(render.Renderer(render.Options{
Directory: "templates",
Layout: "layout",
Funcs: []template.FuncMap{
{
"formatTime": func(args ...interface{}) string {
t1 := time.Unix(args[0].(int64), 0)
return t1.Format(time.Stamp)
},
"unescaped": func(args ...interface{}) template.HTML {
r eturn template.HTML(args[0].(string))
},
},
},
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment