diff --git a/cmd/configure/configure.go b/cmd/configure/configure.go index 97f94f0667..5c6ade40d2 100644 --- a/cmd/configure/configure.go +++ b/cmd/configure/configure.go @@ -116,7 +116,7 @@ var configTmpl string // RenderConfiguration creates a yaml configuration func (c *Configure) RenderConfiguration() ([]byte, error) { - tmpl, err := template.New("yaml").Funcs(sprout.TxtFuncMap()).Parse(configTmpl) + tmpl, err := template.New("yaml").Funcs(sprout.FuncMap()).Parse(configTmpl) if err != nil { panic(err) } diff --git a/cmd/dump.go b/cmd/dump.go index eedb1b7644..76934cdf90 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -70,7 +70,7 @@ func runDump(cmd *cobra.Command, args []string) { tmpl := template.Must( template.New("dump"). - Funcs(sprout.TxtFuncMap()). + Funcs(sprout.FuncMap()). Parse(dumpTmpl)) out := new(bytes.Buffer) diff --git a/cmd/eebus.go b/cmd/eebus.go index 51977deb93..0e1f0a27aa 100644 --- a/cmd/eebus.go +++ b/cmd/eebus.go @@ -42,7 +42,7 @@ func generateEEBUSCert() { log.FATAL.Fatal("could not process generated certificate", err) } - t := template.Must(template.New("out").Funcs(sprout.TxtFuncMap()).Parse(tmpl)) + t := template.Must(template.New("out").Funcs(sprout.FuncMap()).Parse(tmpl)) if err := t.Execute(os.Stdout, map[string]interface{}{ "public": pubKey, "private": privKey, diff --git a/push/hub.go b/push/hub.go index 1b141da56f..1376a4218d 100644 --- a/push/hub.go +++ b/push/hub.go @@ -38,10 +38,10 @@ type Hub struct { func NewHub(cc map[string]EventTemplateConfig, vv Vehicles, cache *util.Cache) (*Hub, error) { // instantiate all event templates for k, v := range cc { - if _, err := template.New("out").Funcs(sprout.TxtFuncMap()).Parse(v.Title); err != nil { + if _, err := template.New("out").Funcs(sprout.FuncMap()).Parse(v.Title); err != nil { return nil, fmt.Errorf("invalid event title: %s (%w)", k, err) } - if _, err := template.New("out").Funcs(sprout.TxtFuncMap()).Parse(v.Msg); err != nil { + if _, err := template.New("out").Funcs(sprout.FuncMap()).Parse(v.Msg); err != nil { return nil, fmt.Errorf("invalid event message: %s (%w)", k, err) } } diff --git a/util/templates/documentation.go b/util/templates/documentation.go index 0308690a51..004d7a18d9 100644 --- a/util/templates/documentation.go +++ b/util/templates/documentation.go @@ -44,7 +44,7 @@ func (t *Template) RenderDocumentation(product Product, lang string) ([]byte, er var modbusRender string if modbusChoices := t.ModbusChoices(); len(modbusChoices) > 0 { if i, _ := t.ParamByName(ParamModbus); i > -1 { - modbusTmpl, err := template.New("yaml").Funcs(sprout.TxtFuncMap()).Parse(documentationModbusTmpl) + modbusTmpl, err := template.New("yaml").Funcs(sprout.FuncMap()).Parse(documentationModbusTmpl) if err != nil { panic(err) } diff --git a/util/templates/template.go b/util/templates/template.go index 519b9d4618..b982a8f291 100644 --- a/util/templates/template.go +++ b/util/templates/template.go @@ -208,7 +208,7 @@ var proxyTmpl string // RenderProxyWithValues renders the proxy template func (t *Template) RenderProxyWithValues(values map[string]interface{}, lang string) ([]byte, error) { - tmpl, err := template.New("yaml").Funcs(sprout.TxtFuncMap()).Parse(proxyTmpl) + tmpl, err := template.New("yaml").Funcs(sprout.FuncMap()).Parse(proxyTmpl) if err != nil { panic(err) } diff --git a/util/templates/utils.go b/util/templates/utils.go index 36b5a73c5d..3058743e70 100644 --- a/util/templates/utils.go +++ b/util/templates/utils.go @@ -59,5 +59,5 @@ func FuncMap(tmpl *template.Template) *template.Template { "urlEncode": url.QueryEscape, } - return tmpl.Funcs(sprout.TxtFuncMap()).Funcs(funcMap) + return tmpl.Funcs(sprout.FuncMap()).Funcs(funcMap) }