1
0
mirror of https://github.com/golang/go synced 2024-09-25 13:30:12 -06:00
go/lib/godoc/package.html
Robert Griesemer 2e394c51d9 godoc: moving to new template package
- first step; rough conversion of all template files
- there is plenty of opportunity for cleanups/simplifications (next CLs)
- html and text output as before

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4852048
2011-08-11 13:24:13 -07:00

123 lines
3.3 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.
-->
{{$FSet := .FSet}}
{{$Info := .}}
{{with .PAst}}
<pre>{{html_esc . $FSet}}</pre>
{{end}}
{{with .PDoc}}
<!-- PackageName is printed as title by the top-level template -->
{{if $Info.IsPkg}}
{{/* ImportPath is a string - no need for FSet */}}
<p><code>import "{{.ImportPath|html_esc}}"</code></p>
{{end}}
{{.Doc|html_comment}}
{{if $Info.IsPkg}}
{{with .Filenames}}
{{/* Filenames are strings - no need for FSet */}}
<p>
<h4>Package files</h4>
<span style="font-size:90%">
{{range .}}
<a href="/{{.|url_src}}">{{.|localname}}</a>
{{end}}
</span>
</p>
{{end}}
{{end}}
{{with .Consts}}
<h2 id="Constants">Constants</h2>
{{range .}}
{{html_comment .Doc}}
<pre>{{html_esc .Decl $FSet}}</pre>
{{end}}
{{end}}
{{with .Vars}}
<h2 id="Variables">Variables</h2>
{{range .}}
{{html_comment .Doc}}
<pre>{{html_esc .Decl $FSet}}</pre>
{{end}}
{{end}}
{{with .Funcs}}
{{range .}}
{{/* Name is a string - no need for FSet */}}
<h2 id="{{.Name|html_esc}}">func <a href="/{{url_pos .Decl $FSet}}">{{.Name|html_esc}}</a></h2>
<p><code>{{html_esc .Decl $FSet}}</code></p>
{{.Doc|html_comment}}
{{end}}
{{end}}
{{with .Types}}
{{range $type := .}}
<h2 id="{{html_esc .Type.Name $FSet}}">type <a href="/{{url_pos .Decl $FSet}}">{{html_esc .Type.Name $FSet}}</a></h2>
{{.Doc|html_comment}}
<p><pre>{{html_esc .Decl $FSet}}</pre></p>
{{range .Consts}}
{{.Doc|html_comment}}
<pre>{{html_esc .Decl $FSet}}</pre>
{{end}}
{{range .Vars}}
{{.Doc|html_comment}}
<pre>{{html_esc .Decl $FSet}}</pre>
{{end}}
{{range .Factories}}
<h3 id="{{html_esc $type.Type.Name $FSet}}.{{.Name|html_esc}}">func <a href="/{{url_pos .Decl $FSet}}">{{.Name|html_esc}}</a></h3>
<p><code>{{html_esc .Decl $FSet}}</code></p>
{{.Doc|html_comment}}
{{end}}
{{range .Methods}}
<h3 id="{{html_esc $type.Type.Name $FSet}}.{{.Name|html_esc}}">func ({{html_esc .Recv $FSet}}) <a href="/{{url_pos .Decl $FSet}}">{{.Name|html_esc}}</a></h3>
<p><code>{{html_esc .Decl $FSet}}</code></p>
{{.Doc|html_comment}}
{{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={{html .}}">{{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="{{.MaxHeight|html_esc}}">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>
{{.Depth|padding}}
<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}}