diff options
-rw-r--r-- | gemini/gemtext/internal/templates.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/gemini/gemtext/internal/templates.go b/gemini/gemtext/internal/templates.go index 3ca7224..4ae9f3f 100644 --- a/gemini/gemtext/internal/templates.go +++ b/gemini/gemtext/internal/templates.go @@ -22,16 +22,13 @@ func AddAllTemplates(base *template.Template, additions *template.Template) (*te return base, nil } - tmpl := base - var err error for _, addition := range additions.Templates() { - tmpl, err = tmpl.AddParseTree(addition.Name(), addition.Tree) - if err != nil { + if _, err := base.AddParseTree(addition.Name(), addition.Tree); err != nil { return nil, err } } - return tmpl, nil + return base, nil } func AddHTMLTemplates(base *htemplate.Template, additions *htemplate.Template) (*htemplate.Template, error) { @@ -39,16 +36,13 @@ func AddHTMLTemplates(base *htemplate.Template, additions *htemplate.Template) ( return base, nil } - tmpl := base - var err error for _, addition := range additions.Templates() { - tmpl, err = tmpl.AddParseTree(addition.Name(), addition.Tree) - if err != nil { + if _, err := base.AddParseTree(addition.Name(), addition.Tree); err != nil { return nil, err } } - return tmpl, nil + return base, nil } func ValidateLinks(doc gemtext.Document) error { |