]> Cypherpunks repositories - gostls13.git/commit
text/template: allow {{else if ... }} to simplify if chains
authorRob Pike <r@golang.org>
Wed, 28 Aug 2013 04:43:56 +0000 (14:43 +1000)
committerRob Pike <r@golang.org>
Wed, 28 Aug 2013 04:43:56 +0000 (14:43 +1000)
commit37cee77ac681654a20939faa047f11b308908902
treeed8aacc5c45910fd088d8f7f2cc7c33940010ddd
parentcbea724378e1586cd92f1fffddcad61af893ba1d
text/template: allow {{else if ... }} to simplify if chains
The method is simple: the parser just parses

        {{if A}}a{{else if B}}b{{end}}

to the same tree that would be produced by

        {{if A}}a{{else}}{{if B}}b{{end}}{{end}}

Thus no changes are required in text/template itself
or in html/template, only in text/template/parse.

Fixes #6085

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13327043
src/pkg/text/template/doc.go
src/pkg/text/template/exec_test.go
src/pkg/text/template/parse/parse.go
src/pkg/text/template/parse/parse_test.go