1
0
mirror of https://github.com/golang/go synced 2024-11-21 21:14:47 -07:00

godoc: move overview before API TOC

Compare:
http://swtch.com/junk/regexp0.html [old]
http://swtch.com/junk/regexp.html [new]

Especially for packages with large APIs, this makes the
overview more promiment, so that it can give the appropriate
context for reading the API list.  This should help significantly
in packages with large APIs, like net, so that the first thing users
see is not a jumble of functions but an introduction to the package.

R=adg, gri, r, kevlar, dsymonds, rogpeppe
CC=golang-dev
https://golang.org/cl/5573068
This commit is contained in:
Russ Cox 2012-01-26 13:02:03 -05:00
parent 32d7a7364f
commit 71b1c6d3c9

View File

@ -3,12 +3,25 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
{{if .IsPkg}}
<!-- Table of contents; must be named manual-nav to turn off auto nav. -->
<div id="manual-nav">
{{with .PDoc}}
{{if $.IsPkg}}
<div id="short-nav">
<dl>
<dd><code>import "{{html .ImportPath}}"</code></dd>
</dl>
<dl>
<dd><a href="#Overview">Overview</a></dd>
<dd><a href="#Index">Index</a></dd>
</dl>
</div>
<h2 id="Overview">Overview</h2>
<!-- The package's Name is printed as title by the top-level template -->
{{comment_html .Doc}}
<h2 id="Index">Index</h2>
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
<div id="manual-nav">
<dl>
{{if .Consts}}
<dd><a href="#Constants">Constants</a></dd>
{{end}}
@ -34,23 +47,7 @@
{{if .Bugs}}
<dd><a href="#Bugs">Bugs</a></dd>
{{end}}
</dl>
{{end}}
</div>
{{end}}
<!-- Main page -->
{{with .PAst}}
<pre>{{node_html . $.FSet}}</pre>
{{end}}
{{with .PDoc}}
<h2 id="Overview">Overview</h2>
<!-- The package's Name is printed as title by the top-level template -->
{{if $.IsPkg}}
<p><code>import "{{html .ImportPath}}"</code></p>
{{end}}
{{comment_html .Doc}}
{{if $.IsPkg}}
<dd>
{{with .Filenames}}
<h4>Package files</h4>
<p>
@ -61,7 +58,9 @@
</span>
</p>
{{end}}
{{end}}
</dd>
</dl>
{{with .Consts}}
<h2 id="Constants">Constants</h2>
{{range .}}
@ -115,6 +114,10 @@
{{example_html $name $.Examples $.FSet}}
{{end}}
{{end}}
{{else}} {{/* not a package; is a command */}}
{{comment_html .Doc}}
{{end}}
{{with .Bugs}}
<h2 id="Bugs">Bugs</h2>
{{range .}}
@ -122,6 +125,11 @@
{{end}}
{{end}}
{{end}}
{{with .PAst}}
<pre>{{node_html . $.FSet}}</pre>
{{end}}
{{with .PList}}
<h2>Other packages</h2>
<p>
@ -131,6 +139,7 @@
{{end}}
</p>
{{end}}
{{with .Dirs}}
{{/* DirList entries are numbers and strings - no need for FSet */}}
<h2 id="Subdirectories">Subdirectories</h2>