~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to lib/godoc/package.html

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
        Use of this source code is governed by a BSD-style
4
4
        license that can be found in the LICENSE file.
5
5
-->
 
6
<!--
 
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).
 
11
-->
6
12
{{with .PDoc}}
7
 
        {{if $.IsPkg}}
 
13
        {{if $.IsMain}}
 
14
                {{/* command documentation */}}
 
15
                {{comment_html .Doc}}
 
16
        {{else}}
 
17
                {{/* package documentation */}}
8
18
                <div id="short-nav">
9
19
                        <dl>
10
20
                        <dd><code>import "{{html .ImportPath}}"</code></dd>
11
21
                        </dl>
12
22
                        <dl>
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>
15
25
                        {{if $.Examples}}
16
 
                                <dd><a href="#examples">Examples</a></dd>
 
26
                                <dd><a href="#pkg-examples" class="examplesLink">Examples</a></dd>
17
27
                        {{end}}
18
28
                        {{if $.Dirs}}
19
 
                                <dd><a href="#subdirectories">Subdirectories</a></dd>
 
29
                                <dd><a href="#pkg-subdirectories">Subdirectories</a></dd>
20
30
                        {{end}}
21
31
                        </dl>
22
32
                </div>
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>
27
37
                        </div>
30
40
                                {{comment_html .Doc}}
31
41
                        </div>
32
42
                </div>
33
 
                {{example_html "" $.Examples $.FSet}}
34
 
        
35
 
                <h2 id="index">Index</h2>
 
43
                {{example_html $ ""}}
 
44
 
 
45
                <div id="pkg-index" class="toggleVisible">
 
46
                <div class="collapsed">
 
47
                        <h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
 
48
                </div>
 
49
                <div class="expanded">
 
50
                        <h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
 
51
 
36
52
                <!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
37
 
                <div id="manual-nav">
 
53
                        <div id="manual-nav">
38
54
                        <dl>
39
55
                        {{if .Consts}}
40
 
                                <dd><a href="#constants">Constants</a></dd>
 
56
                                <dd><a href="#pkg-constants">Constants</a></dd>
41
57
                        {{end}}
42
58
                        {{if .Vars}}
43
 
                                <dd><a href="#variables">Variables</a></dd>
 
59
                                <dd><a href="#pkg-variables">Variables</a></dd>
44
60
                        {{end}}
45
61
                        {{range .Funcs}}
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>
48
64
                        {{end}}
49
65
                        {{range .Types}}
50
66
                                {{$tname_html := html .Name}}
51
67
                                <dd><a href="#{{$tname_html}}">type {{$tname_html}}</a></dd>
52
68
                                {{range .Funcs}}
53
69
                                        {{$name_html := html .Name}}
54
 
                                        <dd>&nbsp; &nbsp; <a href="#{{$name_html}}">{{node_html .Decl $.FSet}}</a></dd>
 
70
                                        <dd>&nbsp; &nbsp; <a href="#{{$name_html}}">{{node_html $ .Decl false}}</a></dd>
55
71
                                {{end}}
56
72
                                {{range .Methods}}
57
73
                                        {{$name_html := html .Name}}
58
 
                                        <dd>&nbsp; &nbsp; <a href="#{{$tname_html}}.{{$name_html}}">{{node_html .Decl $.FSet}}</a></dd>
59
 
                                {{end}}
60
 
                        {{end}}
61
 
                        {{if .Bugs}}
62
 
                                <dd><a href="#bugs">Bugs</a></dd>
63
 
                        {{end}}
64
 
                </dl>
 
74
                                        <dd>&nbsp; &nbsp; <a href="#{{$tname_html}}.{{$name_html}}">{{node_html $ .Decl false}}</a></dd>
 
75
                                {{end}}
 
76
                        {{end}}
 
77
                        {{if $.Notes}}
 
78
                                {{range $marker, $item := $.Notes}}
 
79
                                <dd><a href="#pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</a></dd>
 
80
                                {{end}}
 
81
                        {{end}}
 
82
                        </dl>
 
83
                        </div><!-- #manual-nav -->
65
84
 
66
85
                {{if $.Examples}}
67
 
                        <h4 id="examples">Examples</h4>
 
86
                <div id="pkg-examples">
 
87
                        <h4>Examples</h4>
68
88
                        <dl>
69
89
                        {{range $.Examples}}
70
90
                        <dd><a class="exampleLink" href="#example_{{.Name}}">{{example_name .Name}}</a></dd>
71
91
                        {{end}}
72
92
                        </dl>
 
93
                </div>
73
94
                {{end}}
74
95
 
75
96
                {{with .Filenames}}
82
103
                        </span>
83
104
                        </p>
84
105
                {{end}}
85
 
        
 
106
                </div><!-- .expanded -->
 
107
                </div><!-- #pkg-index -->
 
108
 
86
109
                {{with .Consts}}
87
 
                        <h2 id="constants">Constants</h2>
 
110
                        <h2 id="pkg-constants">Constants</h2>
88
111
                        {{range .}}
89
 
                                <pre>{{node_html .Decl $.FSet}}</pre>
 
112
                                <pre>{{node_html $ .Decl true}}</pre>
90
113
                                {{comment_html .Doc}}
91
114
                        {{end}}
92
115
                {{end}}
93
116
                {{with .Vars}}
94
 
                        <h2 id="variables">Variables</h2>
 
117
                        <h2 id="pkg-variables">Variables</h2>
95
118
                        {{range .}}
96
 
                                <pre>{{node_html .Decl $.FSet}}</pre>
 
119
                                <pre>{{node_html $ .Decl true}}</pre>
97
120
                                {{comment_html .Doc}}
98
121
                        {{end}}
99
122
                {{end}}
100
123
                {{range .Funcs}}
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}}
107
130
                {{end}}
108
131
                {{range .Types}}
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}}
114
137
 
115
138
                        {{range .Consts}}
116
 
                                <pre>{{node_html .Decl $.FSet}}</pre>
 
139
                                <pre>{{node_html $ .Decl true}}</pre>
117
140
                                {{comment_html .Doc}}
118
141
                        {{end}}
119
142
 
120
143
                        {{range .Vars}}
121
 
                                <pre>{{node_html .Decl $.FSet}}</pre>
 
144
                                <pre>{{node_html $ .Decl true}}</pre>
122
145
                                {{comment_html .Doc}}
123
146
                        {{end}}
124
147
 
125
 
                        {{example_html $tname $.Examples $.FSet}}
 
148
                        {{example_html $ $tname}}
126
149
 
127
150
                        {{range .Funcs}}
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}}
133
156
                        {{end}}
134
157
 
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}}
142
165
                        {{end}}
143
166
                {{end}}
144
 
                </div>
145
 
        {{else}}  {{/* not a package; is a command */}}
146
 
                {{comment_html .Doc}}
147
167
        {{end}}
148
168
 
149
 
        {{with .Bugs}}
150
 
                <h2 id="bugs">Bugs</h2>
151
 
                {{range .}}
152
 
                {{comment_html .}}
 
169
        {{with $.Notes}}
 
170
                {{range $marker, $content := .}}
 
171
                        <h2 id="pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</h2>
 
172
                        <ul style="list-style: none; padding: 0;">
 
173
                        {{range .}}
 
174
                        <li><a href="{{posLink_url $ .}}">&#x261e;</a> {{html .Body}}</li>
 
175
                        {{end}}
 
176
                        </ul>
153
177
                {{end}}
154
178
        {{end}}
155
179
{{end}}
156
180
 
157
181
{{with .PAst}}
158
 
        <pre>{{node_html . $.FSet}}</pre>
159
 
{{end}}
160
 
 
161
 
{{with .PList}}
162
 
        <h2>Other packages</h2>
163
 
        <p>
164
 
        {{/* PList entries are strings - no need for FSet */}}
165
 
        {{range .}}
166
 
        <a href="?p={{urlquery .}}">{{html .}}</a><br />
167
 
        {{end}}
168
 
        </p>
 
182
        <pre>{{node_html $ . false}}</pre>
169
183
{{end}}
170
184
 
171
185
{{with .Dirs}}
172
186
        {{/* DirList entries are numbers and strings - no need for FSet */}}
173
187
        {{if $.PDoc}}
174
 
                <h2 id="subdirectories">Subdirectories</h2>
 
188
                <h2 id="pkg-subdirectories">Subdirectories</h2>
175
189
        {{else}}
176
190
                <div class="pkgGopher">
177
191
                        <img class="gopher" src="/doc/gopher/pkg.png"/>
192
206
                {{if $.DirFlat}}
193
207
                        {{if .HasPkg}}
194
208
                                <tr>
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>&nbsp;&nbsp;&nbsp;&nbsp;</td>
197
211
                                <td style="width: auto">{{html .Synopsis}}</td>
198
212
                                </tr>
199
213
                        {{end}}
200
214
                {{else}}
201
215
                        <tr>
202
 
                        <td class="name">{{repeat `&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;` .Depth}}<a href="{{html .Path}}">{{html .Name}}</a></td>
 
216
                        <td class="name">{{repeat `&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;` .Depth}}<a href="{{html .Path}}/">{{html .Name}}</a></td>
203
217
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
204
218
                        <td style="width: auto">{{html .Synopsis}}</td>
205
219
                        </tr>
207
221
        {{end}}
208
222
        </table>
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>
211
225
        {{end}}
212
226
{{end}}
 
227
 
 
228
{{if $.Examples}}
 
229
<script>
 
230
$(document).ready(function() {
 
231
        'use strict';
 
232
        // Set up playground when each element is toggled.
 
233
        $('div.play').each(function (i, el) {
 
234
                var built = false;
 
235
                $(el).closest('.toggle').click(function() {
 
236
                        // Only set up playground once.
 
237
                        if (built) {
 
238
                                return;
 
239
                        }
 
240
                        built = true;
 
241
 
 
242
                        // Set up playground.
 
243
                        var code = $('.code', el);
 
244
                        playground({
 
245
                                'codeEl':   code,
 
246
                                'outputEl': $('.output', el),
 
247
                                'runEl':    $('.run', el),
 
248
                                'fmtEl':    $('.fmt', el),
 
249
                                'shareEl':  $('.share', el),
 
250
                                'shareRedirect': 'http://play.golang.org/p/'
 
251
                        });
 
252
 
 
253
                        // Make the code textarea resize to fit content.
 
254
                        var resize = function() {
 
255
                                code.height(0);
 
256
                                var h = code[0].scrollHeight;
 
257
                                code.height(h+20); // minimize bouncing.
 
258
                                code.closest('.input').height(h);
 
259
                        };
 
260
                        code.on('keydown', resize);
 
261
                        code.on('keyup', resize);
 
262
                        code.keyup(); // resize now.
 
263
                });
 
264
        });
 
265
});
 
266
</script>
 
267
{{end}}