mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
tpl: Add time note to default func description
This commit is contained in:
parent
09c8c17bf0
commit
f3f9763afd
2 changed files with 5 additions and 5 deletions
|
@ -30,9 +30,9 @@ and other basic tools; these are listed in the
|
||||||
|
|
||||||
### default
|
### default
|
||||||
Checks whether a given value is set and returns a default value if it is not.
|
Checks whether a given value is set and returns a default value if it is not.
|
||||||
"Set" in this context means true for booleans; non-zero for numeric types;
|
"Set" in this context means true for booleans; non-zero for numeric types and
|
||||||
non-zero length for strings, arrays, slices, and maps; any struct value; or
|
times; non-zero length for strings, arrays, slices, and maps; any struct value;
|
||||||
non-nil for any other types.
|
or non-nil for any other types.
|
||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
|
|
||||||
|
|
|
@ -1241,8 +1241,8 @@ func dateFormat(layout string, v interface{}) (string, error) {
|
||||||
|
|
||||||
// dfault checks whether a given value is set and returns a default value if it
|
// dfault checks whether a given value is set and returns a default value if it
|
||||||
// is not. "Set" in this context means true for booleans; non-zero for numeric
|
// is not. "Set" in this context means true for booleans; non-zero for numeric
|
||||||
// types; non-zero length for strings, arrays, slices, and maps; any struct
|
// types and times; non-zero length for strings, arrays, slices, and maps; any
|
||||||
// value; or non-nil for any other types.
|
// struct value; or non-nil for any other types.
|
||||||
func dfault(dflt interface{}, given ...interface{}) (interface{}, error) {
|
func dfault(dflt interface{}, given ...interface{}) (interface{}, error) {
|
||||||
// given is variadic because the following construct will not pass a piped
|
// given is variadic because the following construct will not pass a piped
|
||||||
// argument when the key is missing: {{ index . "key" | default "foo" }}
|
// argument when the key is missing: {{ index . "key" | default "foo" }}
|
||||||
|
|
Loading…
Reference in a new issue