This commit is contained in:
xing 2022-11-04 12:59:52 +08:00
parent fa24171aa3
commit f0fc4e3764

View File

@ -21,7 +21,7 @@ func NewFsTemplate(funcMap template.FuncMap) *FsTemplate {
return &FsTemplate{FuncMap: funcMap, Templates: make(map[string]*template.Template)} return &FsTemplate{FuncMap: funcMap, Templates: make(map[string]*template.Template)}
} }
func (t *FsTemplate) SetTemplate() *FsTemplate { func (t FsTemplate) SetTemplate() *FsTemplate {
mainTemplates, err := fs.Glob(TemplateFs, `*/*[^layout]/*.gohtml`) mainTemplates, err := fs.Glob(TemplateFs, `*/*[^layout]/*.gohtml`)
if err != nil { if err != nil {
panic(err) panic(err)
@ -32,7 +32,7 @@ func (t *FsTemplate) SetTemplate() *FsTemplate {
base := c[0] base := c[0]
t.Templates[include] = template.Must(template.New(name).Funcs(t.FuncMap).ParseFS(TemplateFs, include, filepath.Join(base, "layout/*.gohtml"))) t.Templates[include] = template.Must(template.New(name).Funcs(t.FuncMap).ParseFS(TemplateFs, include, filepath.Join(base, "layout/*.gohtml")))
} }
return t return &t
} }
func (t FsTemplate) Instance(name string, data any) render.Render { func (t FsTemplate) Instance(name string, data any) render.Render {