-
Rob Pike authored
Based on work by Russ Cox. From his CL: This is generally useful but especially helpful when trying to use the built-in boolean operators. It lets you write: {{if not (f 1)}} foo {{end}} {{if and (f 1) (g 2)}} bar {{end}} {{if or (f 1) (g 2)}} quux {{end}} instead of {{if f 1 | not}} foo {{end}} {{if f 1}}{{if g 2}} bar {{end}}{{end}} {{$do := 0}}{{if f 1}}{{$do := 1}}{{else if g 2}}{{$do := 1}}{{end}}{{if $do}} quux {{end}} The result can be a bit LISPy but the benefit in expressiveness and readability for such a small change justifies it. I believe no changes are required to html/template. Fixes #3276. R=golang-dev, adg, rogpeppe, minux.ma CC=golang-dev https://golang.org/cl/6482056
cc842c73