summaryrefslogtreecommitdiffstats
path: root/common/hreflect/helpers.go
AgeCommit message (Collapse)Author
2021-04-22Correct function name in commentSantiago De la Cruz
IsInt to IsNumber
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-09-29langs/i18n: Upgrade to go-i18n v2Bjørn Erik Pedersen
Fixes #5242
2019-03-06tpl/tplimpl: Fix template truth logicBjørn Erik Pedersen
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