1
0
mirror of https://github.com/golang/go synced 2024-10-03 16:41:28 -06:00
go/lib/godoc/package.html
Robert Griesemer 5233c50321 godoc: first round of template cleanups
- simplified pipelines
- simplified templates by using template variables
- converted most old-style formatters into new-style funcs
- fixed some escaping bugs (use of url escaping where it was missing)

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4868044
2011-08-12 10:06:32 -07:00

123 lines
3.2 KiB
HTML

<!--
Copyright 2009 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
{{with .PAst}}
<pre>{{html_node . $.FSet}}</pre>
{{end}}
{{with .PDoc}}
<!-- PackageName is printed as title by the top-level template -->
{{if $.IsPkg}}
<p><code>import "{{html .ImportPath}}"</code></p>
{{end}}
{{html_comment .Doc}}
{{if $.IsPkg}}
{{with .Filenames}}
<p>
<h4>Package files</h4>
<span style="font-size:90%">
{{range .}}
<a href="/{{url_src .}}">{{.|localname|html}}</a>
{{end}}
</span>
</p>
{{end}}
{{end}}
{{with .Consts}}
<h2 id="Constants">Constants</h2>
{{range .}}
{{html_comment .Doc}}
<pre>{{html_node .Decl $.FSet}}</pre>
{{end}}
{{end}}
{{with .Vars}}
<h2 id="Variables">Variables</h2>
{{range .}}
{{html_comment .Doc}}
<pre>{{html_node .Decl $.FSet}}</pre>
{{end}}
{{end}}
{{with .Funcs}}
{{range .}}
{{/* Name is a string - no need for FSet */}}
{{$name := html .Name}}
<h2 id="{{$name}}">func <a href="/{{url_pos .Decl $.FSet}}">{{$name}}</a></h2>
<p><code>{{html_node .Decl $.FSet}}</code></p>
{{html_comment .Doc}}
{{end}}
{{end}}
{{with .Types}}
{{range .}}
{{$tname := html_node .Type.Name $.FSet}}
<h2 id="{{$tname}}">type <a href="/{{url_pos .Decl $.FSet}}">{{$tname}}</a></h2>
{{html_comment .Doc}}
<p><pre>{{html_node .Decl $.FSet}}</pre></p>
{{range .Consts}}
{{html_comment .Doc}}
<pre>{{html_node .Decl $.FSet}}</pre>
{{end}}
{{range .Vars}}
{{html_comment .Doc}}
<pre>{{html_node .Decl $.FSet}}</pre>
{{end}}
{{range .Factories}}
{{$name := html .Name}}
<h3 id="{{$tname}}.{{$name}}">func <a href="/{{url_pos .Decl $.FSet}}">{{$name}}</a></h3>
<p><code>{{html_node .Decl $.FSet}}</code></p>
{{html_comment .Doc}}
{{end}}
{{range .Methods}}
{{$name := html .Name}}
<h3 id="{{$tname}}.{{$name}}">func ({{html_node .Recv $.FSet}}) <a href="/{{url_pos .Decl $.FSet}}">{{$name}}</a></h3>
<p><code>{{html_node .Decl $.FSet}}</code></p>
{{html_comment .Doc}}
{{end}}
{{end}}
{{end}}
{{with .Bugs}}
<h2 id="Bugs">Bugs</h2>
{{range .}}
{{html_comment .}}
{{end}}
{{end}}
{{end}}
{{with .PList}}
<h2>Other packages</h2>
<p>
{{/* PList entries are strings - no need for FSet */}}
{{range .}}
<a href="?p={{url .}}">{{html .}}</a><br />
{{end}}
</p>
{{end}}
{{with .Dirs}}
<p class="detail">
Need more packages? The
<a href="http://godashboard.appspot.com/package">Package Dashboard</a>
provides a list of <a href="/cmd/goinstall/">goinstallable</a> packages.
</p>
{{/* DirList entries are numbers and strings - no need for FSet */}}
<h2 id="Subdirectories">Subdirectories</h2>
<p>
<table class="layout">
<tr>
<th align="left" colspan="{{html .MaxHeight}}">Name</th>
<td width="25">&nbsp;</td>
<th align="left">Synopsis</th>
</tr>
<tr>
<th align="left"><a href="..">..</a></th>
</tr>
{{range .List}}
<tr>
{{repeat `<td width="25"></td>` .Depth}}
<td align="left" colspan="{{html .Height}}"><a href="{{html .Path}}">{{html .Name}}</a></td>
<td></td>
<td align="left">{{html .Synopsis}}</td>
</tr>
{{end}}
</table>
</p>
{{end}}