From: Agniva De Sarker Date: Mon, 18 Feb 2019 09:13:06 +0000 (+0530) Subject: go/doc: skip escaping comments in pre-formatted blocks X-Git-Tag: go1.13beta1~1393 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=da50e10c2e80e8c4f53a0bb1d20de57995abc7ca;p=gostls13.git go/doc: skip escaping comments in pre-formatted blocks CL 150377 made the change of converting smart quotes to their html escaped entities for ToHTML, and to unicode quotes for ToText. But for ToText, the change converted the quotes in pre-formatted text too. This fixes that behavior to not touch any text in pre-formatted blocks, which also makes the behavior consistent with ToHTML. Fixes #29730 Change-Id: I58e0216cbdbe189d06d82147e5a02b620af14734 Reviewed-on: https://go-review.googlesource.com/c/162922 Run-TryBot: Agniva De Sarker TryBot-Result: Gobot Gobot Reviewed-by: Robert Griesemer --- diff --git a/src/go/doc/comment.go b/src/go/doc/comment.go index 0ec42643fd..73857330fa 100644 --- a/src/go/doc/comment.go +++ b/src/go/doc/comment.go @@ -445,7 +445,6 @@ func ToText(w io.Writer, text string, indent, preIndent string, width int) { w.Write([]byte("\n")) } else { w.Write([]byte(preIndent)) - line = convertQuotes(line) w.Write([]byte(line)) } } diff --git a/src/go/doc/comment_test.go b/src/go/doc/comment_test.go index e0adeb2f5c..0687f3a62b 100644 --- a/src/go/doc/comment_test.go +++ b/src/go/doc/comment_test.go @@ -126,6 +126,14 @@ $ pre $ pre2 `, }, + { + in: "Para.\n\tshould not be ``escaped''", + out: []block{ + {opPara, []string{"Para.\n"}}, + {opPre, []string{"should not be ``escaped''"}}, + }, + text: ". Para.\n\n$ should not be ``escaped''", + }, } func TestBlocks(t *testing.T) {