summaryrefslogtreecommitdiff
path: root/gemini
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-09-01 12:36:46 -0600
committertjpcc <tjp@ctrl-c.club>2023-09-01 12:37:08 -0600
commit2ce5be68acd3c66d4d135d7eb68b9ecd1563aa1d (patch)
treea805f7c1d4f594c784682998737adc8055225eba /gemini
parentb8f1e92bfc9e690a318c9adc96370d60bbcdedd7 (diff)
simplify internal gemini template-handling functions
Diffstat (limited to 'gemini')
-rw-r--r--gemini/gemtext/internal/templates.go14
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 {