Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(100)

Issue 5043042: code review 5043042: exp/template/html: allow quotes on either side of condi... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 11 months ago by MikeSamuel
Modified:
13 years, 11 months ago
Reviewers:
CC:
nigeltao, golang-dev
Visibility:
Public.

Description

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.

Patch Set 1 #

Patch Set 2 : diff -r 68ba2ebd1645 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 68ba2ebd1645 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 68ba2ebd1645 https://go.googlecode.com/hg/ #

Total comments: 12

Patch Set 5 : diff -r 2e00b068ff36 https://go.googlecode.com/hg/ #

Total comments: 10

Patch Set 6 : diff -r 2e00b068ff36 https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r 2e00b068ff36 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+288 lines, -42 lines) Patch
M src/pkg/exp/template/html/content.go View 1 2 3 4 3 chunks +8 lines, -1 line 0 comments Download
M src/pkg/exp/template/html/content_test.go View 1 12 chunks +26 lines, -0 lines 0 comments Download
M src/pkg/exp/template/html/context.go View 1 2 3 4 5 10 chunks +50 lines, -5 lines 0 comments Download
M src/pkg/exp/template/html/escape.go View 1 2 3 4 5 5 chunks +49 lines, -0 lines 0 comments Download
M src/pkg/exp/template/html/escape_test.go View 1 2 3 4 2 chunks +62 lines, -1 line 0 comments Download
M src/pkg/exp/template/html/html.go View 1 1 chunk +19 lines, -0 lines 0 comments Download
M src/pkg/exp/template/html/transition.go View 1 2 chunks +74 lines, -35 lines 0 comments Download

Messages

Total messages: 7
MikeSamuel
Hello nigeltao@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 11 months ago (2011-09-17 02:14:47 UTC) #1
nigeltao
http://codereview.appspot.com/5043042/diff/3/src/pkg/exp/template/html/content.go File src/pkg/exp/template/html/content.go (right): http://codereview.appspot.com/5043042/diff/3/src/pkg/exp/template/html/content.go#newcode28 src/pkg/exp/template/html/content.go:28: // for example: dir="ltr". Enclose the example in `` ...
13 years, 11 months ago (2011-09-18 02:42:12 UTC) #2
nigeltao
Thinking out loud: "nudge" is shorter than "forceEpsilon", and might work just as well. Or ...
13 years, 11 months ago (2011-09-18 09:19:01 UTC) #3
MikeSamuel
Incremental diffs at http://codereview.appspot.com/5043042/diff2/3:4/src/pkg/exp/template/html/content.go http://codereview.appspot.com/5043042/diff/3/src/pkg/exp/template/html/content.go File src/pkg/exp/template/html/content.go (right): http://codereview.appspot.com/5043042/diff/3/src/pkg/exp/template/html/content.go#newcode28 src/pkg/exp/template/html/content.go:28: // for example: dir="ltr". On ...
13 years, 11 months ago (2011-09-18 20:01:30 UTC) #4
nigeltao
LGTM. As for functions vs methods, there's no big difference either way. What you have ...
13 years, 11 months ago (2011-09-19 01:10:42 UTC) #5
MikeSamuel
http://codereview.appspot.com/5043042/diff/4/src/pkg/exp/template/html/context.go File src/pkg/exp/template/html/context.go (right): http://codereview.appspot.com/5043042/diff/4/src/pkg/exp/template/html/context.go#newcode315 src/pkg/exp/template/html/context.go:315: return fmt.Sprintf("illegal attr %d", a) On 2011/09/19 01:10:43, nigeltao ...
13 years, 11 months ago (2011-09-19 01:53:46 UTC) #6
MikeSamuel
13 years, 11 months ago (2011-09-19 02:10:20 UTC) #7
*** Submitted as http://code.google.com/p/go/source/detail?r=e357d4d799ec ***

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
http://codereview.appspot.com/5043042
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b