3
3
Use of this source code is governed by a BSD-style
4
4
license that can be found in the LICENSE file.
7
Note: Static (i.e., not template-generated) href and id
8
attributes start with "pkg-" to make it impossible for
9
them to conflict with generated attributes (some of which
10
correspond to Go identifiers).
14
{{/* command documentation */}}
17
{{/* package documentation */}}
8
18
<div id="short-nav">
10
20
<dd><code>import "{{html .ImportPath}}"</code></dd>
13
<dd><a href="#overview" class="overviewLink">Overview</a></dd>
14
<dd><a href="#index">Index</a></dd>
23
<dd><a href="#pkg-overview" class="overviewLink">Overview</a></dd>
24
<dd><a href="#pkg-index" class="indexLink">Index</a></dd>
16
<dd><a href="#examples">Examples</a></dd>
26
<dd><a href="#pkg-examples" class="examplesLink">Examples</a></dd>
19
<dd><a href="#subdirectories">Subdirectories</a></dd>
29
<dd><a href="#pkg-subdirectories">Subdirectories</a></dd>
23
33
<!-- The package's Name is printed as title by the top-level template -->
24
<div id="overview" class="toggleVisible">
34
<div id="pkg-overview" class="toggleVisible">
25
35
<div class="collapsed">
26
36
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
30
40
{{comment_html .Doc}}
33
{{example_html "" $.Examples $.FSet}}
35
<h2 id="index">Index</h2>
45
<div id="pkg-index" class="toggleVisible">
46
<div class="collapsed">
47
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
49
<div class="expanded">
50
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
36
52
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
40
<dd><a href="#constants">Constants</a></dd>
56
<dd><a href="#pkg-constants">Constants</a></dd>
43
<dd><a href="#variables">Variables</a></dd>
59
<dd><a href="#pkg-variables">Variables</a></dd>
46
62
{{$name_html := html .Name}}
47
<dd><a href="#{{$name_html}}">{{node_html .Decl $.FSet}}</a></dd>
63
<dd><a href="#{{$name_html}}">{{node_html $ .Decl false}}</a></dd>
50
66
{{$tname_html := html .Name}}
51
67
<dd><a href="#{{$tname_html}}">type {{$tname_html}}</a></dd>
53
69
{{$name_html := html .Name}}
54
<dd> <a href="#{{$name_html}}">{{node_html .Decl $.FSet}}</a></dd>
70
<dd> <a href="#{{$name_html}}">{{node_html $ .Decl false}}</a></dd>
57
73
{{$name_html := html .Name}}
58
<dd> <a href="#{{$tname_html}}.{{$name_html}}">{{node_html .Decl $.FSet}}</a></dd>
62
<dd><a href="#bugs">Bugs</a></dd>
74
<dd> <a href="#{{$tname_html}}.{{$name_html}}">{{node_html $ .Decl false}}</a></dd>
78
{{range $marker, $item := $.Notes}}
79
<dd><a href="#pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</a></dd>
83
</div><!-- #manual-nav -->
67
<h4 id="examples">Examples</h4>
86
<div id="pkg-examples">
69
89
{{range $.Examples}}
70
90
<dd><a class="exampleLink" href="#example_{{.Name}}">{{example_name .Name}}</a></dd>
75
96
{{with .Filenames}}
106
</div><!-- .expanded -->
107
</div><!-- #pkg-index -->
87
<h2 id="constants">Constants</h2>
110
<h2 id="pkg-constants">Constants</h2>
89
<pre>{{node_html .Decl $.FSet}}</pre>
112
<pre>{{node_html $ .Decl true}}</pre>
90
113
{{comment_html .Doc}}
94
<h2 id="variables">Variables</h2>
117
<h2 id="pkg-variables">Variables</h2>
96
<pre>{{node_html .Decl $.FSet}}</pre>
119
<pre>{{node_html $ .Decl true}}</pre>
97
120
{{comment_html .Doc}}
101
124
{{/* Name is a string - no need for FSet */}}
102
125
{{$name_html := html .Name}}
103
<h2 id="{{$name_html}}">func <a href="{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h2>
104
<pre>{{node_html .Decl $.FSet}}</pre>
126
<h2 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h2>
127
<pre>{{node_html $ .Decl true}}</pre>
105
128
{{comment_html .Doc}}
106
{{example_html .Name $.Examples $.FSet}}
129
{{example_html $ .Name}}
109
132
{{$tname := .Name}}
110
133
{{$tname_html := html .Name}}
111
<h2 id="{{$tname_html}}">type <a href="{{posLink_url .Decl $.FSet}}">{{$tname_html}}</a></h2>
112
<pre>{{node_html .Decl $.FSet}}</pre>
134
<h2 id="{{$tname_html}}">type <a href="{{posLink_url $ .Decl}}">{{$tname_html}}</a></h2>
135
<pre>{{node_html $ .Decl true}}</pre>
113
136
{{comment_html .Doc}}
115
138
{{range .Consts}}
116
<pre>{{node_html .Decl $.FSet}}</pre>
139
<pre>{{node_html $ .Decl true}}</pre>
117
140
{{comment_html .Doc}}
121
<pre>{{node_html .Decl $.FSet}}</pre>
144
<pre>{{node_html $ .Decl true}}</pre>
122
145
{{comment_html .Doc}}
125
{{example_html $tname $.Examples $.FSet}}
148
{{example_html $ $tname}}
128
151
{{$name_html := html .Name}}
129
<h3 id="{{$name_html}}">func <a href="{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h3>
130
<pre>{{node_html .Decl $.FSet}}</pre>
152
<h3 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h3>
153
<pre>{{node_html $ .Decl true}}</pre>
131
154
{{comment_html .Doc}}
132
{{example_html .Name $.Examples $.FSet}}
155
{{example_html $ .Name}}
135
158
{{range .Methods}}
136
159
{{$name_html := html .Name}}
137
<h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h3>
138
<pre>{{node_html .Decl $.FSet}}</pre>
160
<h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h3>
161
<pre>{{node_html $ .Decl true}}</pre>
139
162
{{comment_html .Doc}}
140
163
{{$name := printf "%s_%s" $tname .Name}}
141
{{example_html $name $.Examples $.FSet}}
164
{{example_html $ $name}}
145
{{else}} {{/* not a package; is a command */}}
146
{{comment_html .Doc}}
150
<h2 id="bugs">Bugs</h2>
170
{{range $marker, $content := .}}
171
<h2 id="pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</h2>
172
<ul style="list-style: none; padding: 0;">
174
<li><a href="{{posLink_url $ .}}">☞</a> {{html .Body}}</li>
158
<pre>{{node_html . $.FSet}}</pre>
162
<h2>Other packages</h2>
164
{{/* PList entries are strings - no need for FSet */}}
166
<a href="?p={{urlquery .}}">{{html .}}</a><br />
182
<pre>{{node_html $ . false}}</pre>
172
186
{{/* DirList entries are numbers and strings - no need for FSet */}}
174
<h2 id="subdirectories">Subdirectories</h2>
188
<h2 id="pkg-subdirectories">Subdirectories</h2>
176
190
<div class="pkgGopher">
177
191
<img class="gopher" src="/doc/gopher/pkg.png"/>
195
<td class="name"><a href="{{html .Path}}">{{html .Path}}</a></td>
209
<td class="name"><a href="{{html .Path}}/">{{html .Path}}</a></td>
196
210
<td> </td>
197
211
<td style="width: auto">{{html .Synopsis}}</td>
202
<td class="name">{{repeat ` ` .Depth}}<a href="{{html .Path}}">{{html .Name}}</a></td>
216
<td class="name">{{repeat ` ` .Depth}}<a href="{{html .Path}}/">{{html .Name}}</a></td>
203
217
<td> </td>
204
218
<td style="width: auto">{{html .Synopsis}}</td>
209
223
{{if $.PDoc}}{{else}}
210
<p>Need more packages? Take a look at the <a href="http://godashboard.appspot.com/">Go Project Dashboard</a>.</p>
224
<p>Need more packages? Take a look at the <a href="http://code.google.com/p/go-wiki/wiki/Projects">Go Projects wiki page</a>.</p>
230
$(document).ready(function() {
232
// Set up playground when each element is toggled.
233
$('div.play').each(function (i, el) {
235
$(el).closest('.toggle').click(function() {
236
// Only set up playground once.
242
// Set up playground.
243
var code = $('.code', el);
246
'outputEl': $('.output', el),
247
'runEl': $('.run', el),
248
'fmtEl': $('.fmt', el),
249
'shareEl': $('.share', el),
250
'shareRedirect': 'http://play.golang.org/p/'
253
// Make the code textarea resize to fit content.
254
var resize = function() {
256
var h = code[0].scrollHeight;
257
code.height(h+20); // minimize bouncing.
258
code.closest('.input').height(h);
260
code.on('keydown', resize);
261
code.on('keyup', resize);
262
code.keyup(); // resize now.