1
0
mirror of https://github.com/golang/go synced 2024-11-25 01:57:56 -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,
indent: indent,
}
for i, b := range blocks(text) {
for _, b := range blocks(text) {
switch b.op {
case opPara:
if i > 0 {
w.Write(nl)
}
// l.write will add leading newline if required
for _, line := range b.lines {
l.write(line)
}