From 6b9abc6cf3204d5c744cfe8c270e40bcca5a009d Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Wed, 9 Mar 2016 16:27:56 -0600 Subject: [PATCH] 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 --- content/templates/functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/templates/functions.md b/content/templates/functions.md index f719ec42d..912bb3cde 100644 --- a/content/templates/functions.md +++ b/content/templates/functions.md @@ -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.