go(handlers): split get,set funcMap funcs
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2215383c5d
commit
46cc1d663f
@ -39,7 +39,11 @@ func listAllTmpls() []string {
|
|||||||
|
|
||||||
// TODO: mimic https://github.com/drone/funcmap/blob/master/funcmap.go
|
// TODO: mimic https://github.com/drone/funcmap/blob/master/funcmap.go
|
||||||
func setFuncMap(t *template.Template) {
|
func setFuncMap(t *template.Template) {
|
||||||
t.Funcs(template.FuncMap{
|
t.Funcs(getFuncMap())
|
||||||
|
}
|
||||||
|
|
||||||
|
func getFuncMap() template.FuncMap {
|
||||||
|
return template.FuncMap{
|
||||||
"ifIE": func() template.HTML { return template.HTML("<!--[if IE]>") },
|
"ifIE": func() template.HTML { return template.HTML("<!--[if IE]>") },
|
||||||
"endifIE": func() template.HTML { return template.HTML("<![endif]>") },
|
"endifIE": func() template.HTML { return template.HTML("<![endif]>") },
|
||||||
"htmlSafe": func(html string) template.HTML {
|
"htmlSafe": func(html string) template.HTML {
|
||||||
@ -50,7 +54,7 @@ func setFuncMap(t *template.Template) {
|
|||||||
"pageIs": func(want, got string) bool {
|
"pageIs": func(want, got string) bool {
|
||||||
return want == got
|
return want == got
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func initTemplates(f fs.FS) {
|
func initTemplates(f fs.FS) {
|
||||||
|
Loading…
Reference in New Issue
Block a user