Commit da50e10c authored by Agniva De Sarker's avatar Agniva De Sarker Committed by Daniel Martí

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 <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
parent 39fa3f17
......@@ -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))
}
}
......
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment