From da50e10c2e80e8c4f53a0bb1d20de57995abc7ca Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Mon, 18 Feb 2019 14:43:06 +0530 Subject: [PATCH] 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 --- src/go/doc/comment.go | 1 - src/go/doc/comment_test.go | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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) { -- 2.50.0