summaryrefslogtreecommitdiff
path: root/src/cmd/godoc/format.go
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-03-04 21:27:36 +0100
committerMichael Stapelberg <michael@stapelberg.de>2013-03-04 21:27:36 +0100
commit04b08da9af0c450d645ab7389d1467308cfc2db8 (patch)
treedb247935fa4f2f94408edc3acd5d0d4f997aa0d8 /src/cmd/godoc/format.go
parent917c5fb8ec48e22459d77e3849e6d388f93d3260 (diff)
downloadgolang-upstream/1.1_hg20130304.tar.gz
Imported Upstream version 1.1~hg20130304upstream/1.1_hg20130304
Diffstat (limited to 'src/cmd/godoc/format.go')
-rw-r--r--src/cmd/godoc/format.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cmd/godoc/format.go b/src/cmd/godoc/format.go
index 3b1b9a822..122ddc7d6 100644
--- a/src/cmd/godoc/format.go
+++ b/src/cmd/godoc/format.go
@@ -54,6 +54,8 @@ type SegmentWriter func(w io.Writer, text []byte, selections int)
// Selection is ignored.
//
func FormatSelections(w io.Writer, text []byte, lw LinkWriter, links Selection, sw SegmentWriter, selections ...Selection) {
+ // If we have a link writer, make the links
+ // selection the last entry in selections
if lw != nil {
selections = append(selections, links)
}
@@ -108,8 +110,8 @@ func FormatSelections(w io.Writer, text []byte, lw LinkWriter, links Selection,
break
}
// determine the kind of segment change
- if index == len(selections)-1 {
- // we have a link segment change:
+ if lw != nil && index == len(selections)-1 {
+ // we have a link segment change (see start of this function):
// format the previous selection segment, write the
// link tag and start a new selection segment
segment(offs)
@@ -119,7 +121,7 @@ func FormatSelections(w io.Writer, text []byte, lw LinkWriter, links Selection,
} else {
// we have a selection change:
// format the previous selection segment, determine
- // the new selection bitset and start a new segment
+ // the new selection bitset and start a new segment
segment(offs)
lastOffs = offs
mask := 1 << uint(index)