Skip to content

Instantly share code, notes, and snippets.

Embed
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))
},
},
},
}))
@techslides

This comment has been minimized.

Copy link
Owner Author

commented Feb 11, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.