24 lines
611 B
Go
24 lines
611 B
Go
|
package template
|
||
|
|
||
|
import "html/template"
|
||
|
|
||
|
func FuncMap() template.FuncMap {
|
||
|
return template.FuncMap{
|
||
|
"ifIE": func() template.HTML { return template.HTML("<!--[if IE]>") },
|
||
|
"endifIE": func() template.HTML { return template.HTML("<![endif]>") },
|
||
|
"htmlSafe": func(html string) template.HTML {
|
||
|
return template.HTML( //nolint:gosec
|
||
|
bluemondayPolicy.Sanitize(html),
|
||
|
)
|
||
|
},
|
||
|
"pageIs": func(want, got string) bool {
|
||
|
return want == got
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// TODO: mimic https://github.com/drone/funcmap/blob/master/funcmap.go
|
||
|
func setFuncMap(t *template.Template) { //nolint:unused
|
||
|
t.Funcs(FuncMap())
|
||
|
}
|