aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/config.go10
-rw-r--r--lib/templates/template.go4
-rw-r--r--widgets/compose.go6
3 files changed, 15 insertions, 5 deletions
diff --git a/config/config.go b/config/config.go
index f46af09..32d07fc 100644
--- a/config/config.go
+++ b/config/config.go
@@ -319,7 +319,9 @@ func (config *AercConfig) LoadConfig(file *ini.File) error {
return err
}
templateDirs := templatesSec.Key("template-dirs").String()
- config.Templates.TemplateDirs = strings.Split(templateDirs, ":")
+ if templateDirs != "" {
+ config.Templates.TemplateDirs = strings.Split(templateDirs, ":")
+ }
for key, val := range templatesSec.KeysHash() {
if key == "template-dirs" {
continue
@@ -404,6 +406,12 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
{"Subject"},
},
},
+
+ Templates: TemplateConfig{
+ TemplateDirs: []string{path.Join(sharedir, "templates")},
+ QuotedReply: "quoted_reply",
+ Forwards: "forward_as_body",
+ },
}
// These bindings are not configurable
config.Bindings.AccountWizard.ExKey = KeyStroke{
diff --git a/lib/templates/template.go b/lib/templates/template.go
index c09bf4d..e19b5ae 100644
--- a/lib/templates/template.go
+++ b/lib/templates/template.go
@@ -132,8 +132,8 @@ func ParseTemplateFromFile(templateName string, templateDirs []string, data inte
if err != nil {
return nil, err
}
- emailTemplate, err :=
- template.New(templateName).Funcs(templateFuncs).ParseFiles(templateFile)
+ emailTemplate, err := template.New(templateName).
+ Funcs(templateFuncs).ParseFiles(templateFile)
if err != nil {
return nil, err
}
diff --git a/widgets/compose.go b/widgets/compose.go
index a55d147..cae5103 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -54,7 +54,8 @@ type Composer struct {
}
func NewComposer(aerc *Aerc, conf *config.AercConfig,
- acct *config.AccountConfig, worker *types.Worker, template string, defaults map[string]string) (*Composer, error) {
+ acct *config.AccountConfig, worker *types.Worker, template string,
+ defaults map[string]string) (*Composer, error) {
if defaults == nil {
defaults = make(map[string]string)
@@ -173,7 +174,8 @@ func (c *Composer) AddTemplate(template string, data interface{}) error {
return nil
}
- templateText, err := templates.ParseTemplateFromFile(template, c.config.Templates.TemplateDirs, data)
+ templateText, err := templates.ParseTemplateFromFile(
+ template, c.config.Templates.TemplateDirs, data)
if err != nil {
return err
}