BUGFIX: order of locals and globasl in template parsing

This commit is contained in:
Simon Martens
2024-12-03 21:43:26 +01:00
parent 5f6886a144
commit 591b637652
11 changed files with 14 additions and 17 deletions

View File

@@ -93,12 +93,13 @@ func (c *TemplateContext) Globals() map[string]string {
}
func (c *TemplateContext) Template(fsys fs.FS, funcmap *template.FuncMap) (*template.Template, error) {
t, err := readTemplates(fsys, nil, c.globals, funcmap)
// TODO: locals need to be in order: root, head, body
t, err := readTemplates(fsys, nil, c.locals, funcmap)
if err != nil {
return nil, err
}
t, err = readTemplates(fsys, t, c.locals, funcmap)
t, err = readTemplates(fsys, t, c.globals, funcmap)
if err != nil {
return nil, err
}