diff options
author | Robin Jarry <robin@jarry.cc> | 2022-12-20 18:37:16 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-01-04 22:57:31 +0100 |
commit | d758441fe0c4da6bc3486d0643436ad7ac290a56 (patch) | |
tree | 8d8fe289a4612c2dd5b8043028cf5a813502b0f6 /lib/templates/template.go | |
parent | ae675b491d2b55a06588e8ab4ce8205aaae796c8 (diff) | |
download | aerc-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.go | 4 |
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()) |