mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 14:17:43 +00:00
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:
1 parent
89aa9203f4
commit
6b9abc6cf3
1 file changed
+1
-1
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user