move template functions before template loading

This commit is contained in:
f0x 2021-07-08 15:38:12 +02:00
commit ac1783a697
3 changed files with 13 additions and 15 deletions

View file

@ -21,3 +21,13 @@ func loadTemplates(cfg *config.Config, engine *gin.Engine) error {
engine.LoadHTMLGlob(tmPath)
return nil
}
func noescape(str string) template.HTML {
return template.HTML(str)
}
func loadTemplateFunctions(engine *gin.Engine) {
return r.engine.SetFuncMap(template.FuncMap{
"noescape": noescape,
})
}