mirror of
https://github.com/golang/go
synced 2024-11-06 11:36:16 -07:00
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: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
39fa3f171c
commit
da50e10c2e
@ -445,7 +445,6 @@ func ToText(w io.Writer, text string, indent, preIndent string, width int) {
|
|||||||
w.Write([]byte("\n"))
|
w.Write([]byte("\n"))
|
||||||
} else {
|
} else {
|
||||||
w.Write([]byte(preIndent))
|
w.Write([]byte(preIndent))
|
||||||
line = convertQuotes(line)
|
|
||||||
w.Write([]byte(line))
|
w.Write([]byte(line))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,14 @@ $ pre
|
|||||||
$ pre2
|
$ 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) {
|
func TestBlocks(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user