Source File
section.go
Belonging Package
golang.org/x/pkgsite/internal/frontend
package frontend
import (
)
type Section struct {
Prefix string // prefix for this section, or if Subs==nil, a single line
Subs []*Section // subsections
NumLines int // total number of lines in subsections
}
func ( string) *Section {
return &Section{Prefix: , NumLines: 0}
}
func ( *Section) ( *Section) {
.Subs = append(.Subs, )
if .Subs == nil {
.NumLines++
} else {
.NumLines += .NumLines
}
}
type prefixFunc func(s, prefix string) string
func ( []string, prefixFunc) []*Section {
, := section("", , )
return .Subs
}
func ( string, []string, prefixFunc) (*Section, []string) {
:= newSection()
for len() > 0 {
:= [0]
if !strings.HasPrefix(, ) {
break
}
:= (, )
var *Section
if == "" {
= newSection()
= [1:]
} else {
, = (, , )
}
.add()
if == {
return ""
}
:= strings.Split(, "/")
, := accountPrefix()
if == "" {
return
}
return ""
}
switch [0] {
case "github.com", "bitbucket.org", "launchpad.net", "golang.org":
= 1
case "hub.jazz.net":
= 2
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |