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

Issue 6260046: code review 6260046: exp/html: Convert \r and \r\n to \n when tokenizing

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

Description

exp/html: Convert \r and \r\n to \n when tokenizing Also escape "\r" as "
" when rendering HTML. Pass 2 additional tests.

Patch Set 1 #

Patch Set 2 : diff -r 1afae7555667 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 1afae7555667 https://go.googlecode.com/hg/ #

Total comments: 10

Patch Set 4 : diff -r 1afae7555667 https://go.googlecode.com/hg/ #

Total comments: 3

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

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+67 lines, -4 lines) Patch
M src/pkg/exp/html/escape.go View 1 2 3 2 chunks +3 lines, -1 line 0 comments Download
M src/pkg/exp/html/testlogs/plain-text-unsafe.dat.log View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/exp/html/token.go View 1 2 3 3 chunks +34 lines, -1 line 0 comments Download
M src/pkg/exp/html/token_test.go View 1 2 3 4 1 chunk +28 lines, -0 lines 1 comment Download

Messages

Total messages: 9
andybalholm
Hello nigeltao@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
11 years, 11 months ago (2012-05-29 04:27:28 UTC) #1
nigeltao
http://codereview.appspot.com/6260046/diff/5001/src/pkg/exp/html/escape.go File src/pkg/exp/html/escape.go (right): http://codereview.appspot.com/6260046/diff/5001/src/pkg/exp/html/escape.go#newcode195 src/pkg/exp/html/escape.go:195: const escapedChars = `&'<>"` + "\r" Make the RHS ...
11 years, 11 months ago (2012-05-29 06:45:29 UTC) #2
andybalholm
PTAL. http://codereview.appspot.com/6260046/diff/5001/src/pkg/exp/html/escape.go File src/pkg/exp/html/escape.go (right): http://codereview.appspot.com/6260046/diff/5001/src/pkg/exp/html/escape.go#newcode195 src/pkg/exp/html/escape.go:195: const escapedChars = `&'<>"` + "\r" On 2012/05/29 ...
11 years, 11 months ago (2012-05-29 15:13:51 UTC) #3
nigeltao
http://codereview.appspot.com/6260046/diff/8001/src/pkg/exp/html/token_test.go File src/pkg/exp/html/token_test.go (right): http://codereview.appspot.com/6260046/diff/8001/src/pkg/exp/html/token_test.go#newcode593 src/pkg/exp/html/token_test.go:593: var newlineTests = []tokenTest{ Please also test these inputs: ...
11 years, 11 months ago (2012-05-30 01:23:50 UTC) #4
nigeltao
Also, please "hg sync" before you next "hg upload", as I've just submitted an exp/html ...
11 years, 11 months ago (2012-05-30 03:02:52 UTC) #5
andybalholm
PTAL. http://codereview.appspot.com/6260046/diff/8001/src/pkg/exp/html/token_test.go File src/pkg/exp/html/token_test.go (right): http://codereview.appspot.com/6260046/diff/8001/src/pkg/exp/html/token_test.go#newcode593 src/pkg/exp/html/token_test.go:593: var newlineTests = []tokenTest{ On 2012/05/30 01:23:50, nigeltao ...
11 years, 11 months ago (2012-05-30 04:09:36 UTC) #6
nigeltao
LGTM. I'll fix the test placement, and submit. http://codereview.appspot.com/6260046/diff/8001/src/pkg/exp/html/token_test.go File src/pkg/exp/html/token_test.go (right): http://codereview.appspot.com/6260046/diff/8001/src/pkg/exp/html/token_test.go#newcode593 src/pkg/exp/html/token_test.go:593: var ...
11 years, 11 months ago (2012-05-30 05:47:00 UTC) #7
nigeltao
*** Submitted as http://code.google.com/p/go/source/detail?r=f5bb195f88cf *** exp/html: Convert \r and \r\n to \n when tokenizing Also ...
11 years, 11 months ago (2012-05-30 05:50:26 UTC) #8
nigeltao
11 years, 11 months ago (2012-05-30 05:53:27 UTC) #9
For the record, the before/after benchmarks:

BenchmarkParser      500       4626146 ns/op      16.90 MB/s
BenchmarkRawLevelTokenizer      2000        894498 ns/op      87.38 MB/s
BenchmarkLowLevelTokenizer      2000       1118470 ns/op      69.88 MB/s
BenchmarkHighLevelTokenizer     1000       2006670 ns/op      38.95 MB/s

BenchmarkParser      500       4839040 ns/op      16.15 MB/s
BenchmarkRawLevelTokenizer      2000        904150 ns/op      86.45 MB/s
BenchmarkLowLevelTokenizer      2000       1260548 ns/op      62.01 MB/s
BenchmarkHighLevelTokenizer     1000       2175799 ns/op      35.92 MB/s

Performance is not the priority at the moment; correctness is. This is
just a data point.
Sign in to reply to this message.

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