hugo/common
Bjørn Erik Pedersen 02eaddc2fb
tpl/tplimpl: Fix template truth logic
Before this commit, due to a bug in Go's `text/template` package, this would print different output for typed nil interface values:

```
{{ if .AuthenticatedUser }}User is authenticated!{{ else }}{{ end }}
{{ if not .AuthenticatedUser }}{{ else }}}User is authenticated!{{ end }}
```

This commit works around this by wrapping every `if` and `with` with a custom `getif` template func with truth logic that matches `not`, `and` and `or`.

Those 3 template funcs from Go's stdlib are now pulled into Hugo's source tree and adjusted to support custom zero values, e.g. types that implement `IsZero`.

This means that you can now do:

```
{{ with .Date }}{{ . }}{{ end }}
```

And it would work as expected.

Fixes #5738
2019-03-06 22:52:38 +01:00
..
collections common/collections: Fix defines typo 2018-11-29 09:57:51 +01:00
herrors common/herrors: Fix args order in strings.TrimPrefix 2019-02-02 09:55:31 +01:00
hreflect tpl/tplimpl: Fix template truth logic 2019-03-06 22:52:38 +01:00
hugio Add a consolidated file cache 2018-11-13 14:19:42 +01:00
hugo releaser: Prepare repository for 0.55.0-DEV 2019-02-01 09:42:55 +00:00
loggers More spelling corrections 2018-11-13 18:28:40 +01:00
maps Add /config dir support 2018-12-11 13:08:36 +01:00
math Add a newScratch template func 2018-07-06 17:51:38 +02:00
terminal Fix ANSI character output regression on Windows 2018-11-02 09:09:02 +01:00
text Add file (line/col) info to ref/relref errors 2018-11-01 21:06:35 +01:00
types tpl/tplimpl: Fix template truth logic 2019-03-06 22:52:38 +01:00
urls Add file (line/col) info to ref/relref errors 2018-11-01 21:06:35 +01:00