3
0

Add sprig to txt templates

This commit is contained in:
Tomaž Jerman
2021-04-02 12:06:08 +02:00
parent 332f204dea
commit e5578d3d94
+4 -1
View File
@@ -4,6 +4,8 @@ import (
"io"
"io/ioutil"
"text/template"
"github.com/Masterminds/sprig"
)
func preprocPlainTemplate(tpl io.Reader, pp map[string]io.Reader) (*template.Template, error) {
@@ -12,7 +14,8 @@ func preprocPlainTemplate(tpl io.Reader, pp map[string]io.Reader) (*template.Tem
return nil, err
}
gtpl := template.New("text/plain_render")
gtpl := template.New("text/plain_render").
Funcs(sprig.TxtFuncMap())
// Prep the original template
t, err := gtpl.Parse(string(bb))