]> Cypherpunks repositories - gostls13.git/commitdiff
go/doc: add "hdr-" prefix to headers generated from package overviews.
authorDavid Symonds <dsymonds@golang.org>
Tue, 18 Dec 2012 01:19:04 +0000 (12:19 +1100)
committerDavid Symonds <dsymonds@golang.org>
Tue, 18 Dec 2012 01:19:04 +0000 (12:19 +1100)
R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/6935071

src/pkg/go/doc/comment.go

index 51e2bf73243372e62ae75398c0498f4cee23fe79..c4b7e6ae6e17d0f24487aa4e503d0af7b1c925c1 100644 (file)
@@ -229,7 +229,8 @@ type block struct {
 var nonAlphaNumRx = regexp.MustCompile(`[^a-zA-Z0-9]`)
 
 func anchorID(line string) string {
-       return nonAlphaNumRx.ReplaceAllString(line, "_")
+       // Add a "hdr-" prefix to avoid conflicting with IDs used for package symbols.
+       return "hdr-" + nonAlphaNumRx.ReplaceAllString(line, "_")
 }
 
 // ToHTML converts comment text to formatted HTML.