Closed maximargo closed 8 months ago
hmmm interesting. The only thing I can think of is the pipe call.
@Mrpye Any idea on this one?
Found two issues
First, the string needs to be
s := `{{printf "%q" . | title}}`
to
s := `{{printf "%q" (title .Data)}}`
customer data is put in the data model and with nested functions, you need to wrap in ( )
The second issue is with the code, the user functions are not getting added to the function map. looks like this got removed at some point so will need adding back in
func templateFuncMap(r *rand.Rand, fm *template.FuncMap) *template.FuncMap {
...
// Fix merge the user function maps with the template function map
for k, v := range *fm {
funcMap[k] = v
}
return &funcMap
}
Fixed v6.26.4
Hi! When I try to run the following code I get this error: "template: CodeRun:1: function "title" not defined". What I'm missing?