mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Added safeHtml template function
This commit is contained in:
parent
6274aa0a64
commit
f3db3eb4a3
1 changed files with 5 additions and 0 deletions
|
@ -78,6 +78,10 @@ func ReturnWhenSet(a interface{}, index int) interface{} {
|
|||
return ""
|
||||
}
|
||||
|
||||
func SafeHtml(text string) template.HTML {
|
||||
return template.HTML(text)
|
||||
}
|
||||
|
||||
type Template interface {
|
||||
ExecuteTemplate(wr io.Writer, name string, data interface{}) error
|
||||
Lookup(name string) *template.Template
|
||||
|
@ -108,6 +112,7 @@ func NewTemplate() Template {
|
|||
"gt": Gt,
|
||||
"isset": IsSet,
|
||||
"echoParam": ReturnWhenSet,
|
||||
"safeHtml": SafeHtml,
|
||||
}
|
||||
|
||||
templates.Funcs(funcMap)
|
||||
|
|
Loading…
Reference in a new issue