yaml render func

This commit is contained in:
Mikaël Cluseau 2023-05-15 15:54:23 +02:00
parent 482d3c83ba
commit 50bb60823f

View File

@ -135,6 +135,11 @@ func (t *Template) Execute(contextName, elementName string, wr io.Writer, data i
indented = indent + strings.Replace(s, "\n", "\n"+indent, -1) indented = indent + strings.Replace(s, "\n", "\n"+indent, -1)
return return
}, },
"yaml": func(v any) (s string, err error) {
ba, err := yaml.Marshal(v)
s = string(ba)
return
},
} }
for name, f := range extraFuncs { for name, f := range extraFuncs {