1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:14:40 -07:00

go/doc: print only one newline between paragraphs

Fixes #2595.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5544068
This commit is contained in:
Rob Pike 2012-01-14 11:57:32 -08:00
parent 4cfa9e3c61
commit 2374edc640

View File

@ -353,12 +353,10 @@ func ToText(w io.Writer, text string, indent, preIndent string, width int) {
width: width, width: width,
indent: indent, indent: indent,
} }
for i, b := range blocks(text) { for _, b := range blocks(text) {
switch b.op { switch b.op {
case opPara: case opPara:
if i > 0 { // l.write will add leading newline if required
w.Write(nl)
}
for _, line := range b.lines { for _, line := range b.lines {
l.write(line) l.write(line)
} }