aboutsummaryrefslogtreecommitdiffstats
path: root/lib/templates/template.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-12-20 18:37:16 +0100
committerRobin Jarry <robin@jarry.cc>2023-01-04 22:57:31 +0100
commitd758441fe0c4da6bc3486d0643436ad7ac290a56 (patch)
tree8d8fe289a4612c2dd5b8043028cf5a813502b0f6 /lib/templates/template.go
parentae675b491d2b55a06588e8ab4ce8205aaae796c8 (diff)
downloadaerc-d758441fe0c4da6bc3486d0643436ad7ac290a56.tar.gz
templates: add more fields and functions
Add functions and fields in preparation for more than only message templates. The idea is to reuse the same symbols for the message list format and other parts of the UI. Update the man page accordingly. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'lib/templates/template.go')
-rw-r--r--lib/templates/template.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/templates/template.go b/lib/templates/template.go
index baf7c2cf..28785356 100644
--- a/lib/templates/template.go
+++ b/lib/templates/template.go
@@ -46,6 +46,10 @@ func ParseTemplateFromFile(templateName string, templateDirs []string, data inte
return &body, nil
}
+func ParseTemplate(name, content string) (*template.Template, error) {
+ return template.New(name).Funcs(templateFuncs).Parse(content)
+}
+
func CheckTemplate(templateName string, templateDirs []string) error {
if templateName != "" {
_, err := ParseTemplateFromFile(templateName, templateDirs, DummyData())