1
1
package main
2
2
3
- var pkgTemplate = `{{with .PDoc}}{{if $.IsMain}}
4
- # {{ base .ImportPath }}
5
-
3
+ var pkgTemplate = `{{with .PDoc}}
4
+ {{if $.IsMain }}
5
+ > {{ base .ImportPath }}
6
6
{{comment_md .Doc}}
7
7
{{else}}
8
8
# {{ .Name }}
9
- import "{{.ImportPath}}"
9
+ ` + "`" + `import "{{.ImportPath}}"` + "`" + `
10
+
11
+ * [Overview](#pkg-overview)
12
+ * [Index](#pkg-index){{if $.Examples}}
13
+ * [Examples](#pkg-examples){{- end}}{{if $.Dirs}}
14
+ * [Subdirectories](#pkg-subdirectories){{- end}}
10
15
16
+ ## <a name="pkg-overview">Overview</a>
11
17
{{comment_md .Doc}}
12
18
{{example_html $ ""}}
13
19
14
- {{with .Consts}}## Constants
15
- {{range .}}{{node $ .Decl | pre}}
20
+ ## <a name="pkg-index">Index</a>
21
+ {{- if .Consts}}* [Constants](#pkg-constants){{end}}
22
+ {{- if .Vars}}* [Variables](#pkg-variables){{end}}{{- range .Funcs -}}{{$name_html := html .Name}}
23
+ * [{{node_html $ .Decl false | sanitize}}](#{{$name_html}}){{- end}}{{- range .Types}}{{$tname_html := html .Name}}
24
+ * [type {{$tname_html}}](#{{$tname_html}}){{- range .Funcs}}{{$name_html := html .Name}}
25
+ * [{{node_html $ .Decl false | sanitize}}](#{{$name_html}}){{- end}}{{- range .Methods}}{{$name_html := html .Name}}
26
+ * [{{node_html $ .Decl false | sanitize}}](#{{$tname_html}}.{{$name_html}}){{- end}}{{- end}}{{- if $.Notes}}{{- range $marker, $item := $.Notes}}
27
+ * [{{noteTitle $marker | html}}s](#pkg-note-{{$marker}}){{end}}{{end}}
28
+ {{if $.Examples}}
29
+ #### <a name="pkg-examples">Examples</a>{{- range $.Examples}}
30
+ * [{{example_name .Name}}](#example_{{.Name}}){{- end}}{{- end}}
31
+ {{with .Filenames}}
32
+ #### <a name="pkg-files">Package files</a>
33
+ {{range .}}[{{.|filename|html}}]({{.|srcLink|html}}) {{end}}
34
+ {{end}}
35
+
36
+ {{with .Consts}}## <a name="pkg-constants">Constants</a>
37
+ {{range .}}{{node $ .Decl true | pre}}
16
38
{{comment_md .Doc}}{{end}}{{end}}
17
- {{with .Vars}}## Variables
39
+ {{with .Vars}}## <a name="pkg-variables"> Variables</a>
18
40
{{range .}}{{node $ .Decl | pre}}
19
41
{{comment_md .Doc}}{{end}}{{end}}
20
- {{range .Funcs}}{{$name_html := html .Name}}## func {{$name_html}}
42
+
43
+ {{range .Funcs}}{{$name_html := html .Name}}## <a name="{{$name_html}}">func</a> [{{$name_html}}]({{posLink_url $ .Decl}})
21
44
{{node $ .Decl | pre}}
22
45
{{comment_md .Doc}}
23
- {{example_html $ .Name}}{{end}}
24
- {{range .Types}}{{$tname := .Name}}{{$tname_html := html .Name}}## type {{$tname_html}}
46
+ {{example_html $ .Name}}
47
+ {{callgraph_html $ "" .Name}}{{end}}
48
+ {{range .Types}}{{$tname := .Name}}{{$tname_html := html .Name}}## <a name="{{$tname_html}}">type</a> [{{$tname_html}}]({{posLink_url $ .Decl}})
25
49
{{node $ .Decl | pre}}
26
- {{comment_md .Doc}}
27
-
28
- {{range .Consts}}{{node $ .Decl | pre }}
29
- {{comment_md .Doc}}{{end}}
30
-
31
- {{range .Vars}}{{node $ .Decl | pre }}
50
+ {{comment_md .Doc}}{{range .Consts}}
51
+ {{node $ .Decl | pre }}
52
+ {{comment_md .Doc}}{{end}}{{range .Vars}}
53
+ {{node $ .Decl | pre }}
32
54
{{comment_md .Doc}}{{end}}
33
55
34
56
{{example_html $ $tname}}
57
+ {{implements_html $ $tname}}
58
+ {{methodset_html $ $tname}}
35
59
36
- {{range .Funcs}}{{$name_html := html .Name}}### func {{$name_html}}
60
+ {{range .Funcs}}{{$name_html := html .Name}}### <a name="{{$name_html}}"> func</a> [ {{$name_html}}]({{posLink_url $ .Decl}})
37
61
{{node $ .Decl | pre}}
38
62
{{comment_md .Doc}}
39
63
{{example_html $ .Name}}{{end}}
64
+ {{callgraph_html $ "" .Name}}
40
65
41
- {{range .Methods}}{{$name_html := html .Name}}### func ({{md .Recv}}) {{$name_html}}
66
+ {{range .Methods}}{{$name_html := html .Name}}### <a name="{{$tname_html}}.{{$name_html}}"> func</a> ({{md .Recv}}) [ {{$name_html}}]({{posLink_url $ .Decl}})
42
67
{{node $ .Decl | pre}}
43
68
{{comment_md .Doc}}
44
69
{{$name := printf "%s_%s" $tname .Name}}{{example_html $ $name}}
70
+ {{callgraph_html $ .Recv .Name}}
45
71
{{end}}{{end}}{{end}}
46
72
47
73
{{with $.Notes}}
48
74
{{range $marker, $content := .}}
49
- ## {{noteTitle $marker | html}}s
75
+ ## <a name="pkg-note-{{$marker}}"> {{noteTitle $marker | html}}s
50
76
<ul style="list-style: none; padding: 0;">
51
77
{{range .}}
52
78
<li><a href="{{posLink_url $ .}}">☞</a> {{html .Body}}</li>
@@ -55,7 +81,5 @@ var pkgTemplate = `{{with .PDoc}}{{if $.IsMain}}
55
81
{{end}}
56
82
{{end}}
57
83
{{end}}
58
-
59
- {{with .PAst}}{{node_html $ . false}}{{end}}
60
84
- - -
61
85
Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md)`
0 commit comments