structure example
This commit is contained in:
20
html/template.go
Normal file
20
html/template.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package html
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"strings"
|
||||
|
||||
"github.com/russross/blackfriday/v2"
|
||||
)
|
||||
|
||||
func Parse(templates ...string) *template.Template {
|
||||
return template.Must(template.New("ALL").Funcs(FuncMap()).ParseFiles(templates...))
|
||||
}
|
||||
|
||||
func FuncMap() template.FuncMap {
|
||||
return template.FuncMap{
|
||||
"lowercase": strings.ToLower,
|
||||
"uppercase": strings.ToUpper,
|
||||
"markdown": blackfriday.Run,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user