tpl/compare: Add cond (ternary) template func

Fixes #3860
This commit is contained in:
Bjørn Erik Pedersen
2017-09-08 14:16:21 +02:00
parent 202510fdc9
commit 0462c96a5a
3 changed files with 25 additions and 0 deletions

View File

@@ -69,6 +69,13 @@ func init() {
[][2]string{},
)
ns.AddMethodMapping(ctx.Conditional,
[]string{"cond"},
[][2]string{
{`{{ cond (eq (add 2 2) 4) "2+2 is 4" "what?" | safeHTML }}`, `2+2 is 4`},
},
)
return ns
}