PLAYGROUND (experimental)

str_template

Renders a template string with lowercase placeholders {{.key}} replaced by values from dictionary using Go's template engine (with if and range). Use html=true to wrap in HTML document structure.
str_template(
    template, 
    data, 
    [html=false]
) -> STRING

Renders a template string with lowercase placeholders {{.key}} replaced by values from dictionary using Go's template engine (with if and range). Use html=true to wrap in HTML document structure.

Syntaxe

var result = str_template(data={Name:"Richnou"}, template="Hello {{.name}}") ;

Arguments

NameTypeRequiredDefaultDescription
templateyes-Template string with {{.Key}} placeholders
datayes-Dictionary with replacement values
html-falseIf true, wrap in simple HTML document structure