chore: deprecate TxtFuncMap
This commit is contained in:
parent
a833be77b7
commit
c04f52f851
7 changed files with 8 additions and 8 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue