]> Cypherpunks repositories - gostls13.git/commit
exp/template/html: allow quotes on either side of conditionals and dynamic HTML names
authorMike Samuel <mikesamuel@gmail.com>
Mon, 19 Sep 2011 02:10:15 +0000 (19:10 -0700)
committerMike Samuel <mikesamuel@gmail.com>
Mon, 19 Sep 2011 02:10:15 +0000 (19:10 -0700)
commitb4e1ca25b1fe02f37dcf6371732727fdd5036909
tree8d6c02b2126ac1011316858a9941434bfc17a356
parent52a46bb77352bd911a478d870acb7453234c52f3
exp/template/html: allow quotes on either side of conditionals and dynamic HTML names

This addresses several use cases:

(1) <h{{.HeaderLevel}}> used to build hierarchical documents.
(2) <input on{{.EventType}}=...> used in widgets.
(3) <div {{" dir=ltr"}}> used to embed bidi-hints.

It also makes sure that we treat the two templates below the same:

<img src={{if .Avatar}}"{{.Avatar}}"{{else}}"anonymous.png"{{end}}>
<img src="{{if .Avatar}}{{.Avatar}}{{else}}anonymous.png{{end}}">

This splits up tTag into a number of sub-states and adds testcases.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5043042
src/pkg/exp/template/html/content.go
src/pkg/exp/template/html/content_test.go
src/pkg/exp/template/html/context.go
src/pkg/exp/template/html/escape.go
src/pkg/exp/template/html/escape_test.go
src/pkg/exp/template/html/html.go
src/pkg/exp/template/html/transition.go