tpl: fix default function

This commit fixes a few things:

1. `given` is now a variadic parameter so that piping works properly
2. add separate template tests to make sure piping works
3. support time values
4. add more tests of the dfault function
This commit is contained in:
Cameron Moore
2016-03-09 16:27:56 -06:00
committed by Bjørn Erik Pedersen
parent 0743646f32
commit 09c8c17bf0
3 changed files with 75 additions and 10 deletions

View File

@@ -37,7 +37,7 @@ non-nil for any other types.
e.g.
{{ index .Params "font" | default "Roboto" }} → default is "Roboto"
{{ default "Roboto" .Params.font }} → default is "Roboto"
{{ default "Roboto" (index .Params "font") }} → default is "Roboto"
### delimit
Loops through any array, slice or map and returns a string of all the values separated by the delimiter. There is an optional third parameter that lets you choose a different delimiter to go between the last two values.