mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-15 00:27:29 -06:00
Noescape (#88)
* disable html escaping for short description * provide noescape function for templates * move template functions before template loading * go fmt * linter fixes
This commit is contained in:
parent
bdba3ff9a9
commit
f05b255511
4 changed files with 19 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ package router
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
|
@ -21,3 +22,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) {
|
||||
engine.SetFuncMap(template.FuncMap{
|
||||
"noescape": noescape,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue