let a = (
this: "This",
that: "That",
random: MustacheLambda { Bool.random() ? "{{this}}" : "{{that}}" }
)
let template = try MustacheTemplate(string: "{{random}}")
let output = template.render(a)
print(output)
Results in either
This
or
That
Section lambda
let a = [
"bold": MustachLambda { text in "<b>\(text)</b>" }
]
let template = try MustacheTemplate(string: "{{#bold}}text to render{{/bold}}")
let output = template.render(a)
print(output)
Variable lambda
Results in either
or
Section lambda
Results in