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

godoc: move Examples above Index and make them both collapsable

R=golang-dev, dsymonds, bradfitz, r
CC=golang-dev
https://golang.org/cl/6591066
This commit is contained in:
Andrew Gerrand 2012-10-03 15:05:08 +10:00
parent 727e5ce95f
commit 516306f677

View File

@ -37,10 +37,32 @@
</div>
</div>
{{example_html "" $.Examples $.FSet}}
{{if $.Examples}}
<div id="pkg-examples" class="toggleVisible">
<div class="collapsed">
<h2 class="toggleButton" title="Click to show Examples section">Examples ▹</h2>
</div>
<div class="expanded">
<h2 class="toggleButton" title="Click to hide Examples section">Examples ▾</h2>
<dl>
{{range $.Examples}}
<dd><a class="exampleLink" href="#example_{{.Name}}">{{example_name .Name}}</a></dd>
{{end}}
</dl>
</div>
</div>
{{end}}
<h2 id="pkg-index">Index</h2>
<div id="pkg-index" class="toggleVisible">
<div class="collapsed">
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
</div>
<div class="expanded">
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
<div id="manual-nav">
<div id="manual-nav">
<dl>
{{if .Consts}}
<dd><a href="#pkg-constants">Constants</a></dd>
@ -67,16 +89,8 @@
{{if .Bugs}}
<dd><a href="#pkg-bugs">Bugs</a></dd>
{{end}}
</dl>
{{if $.Examples}}
<h4 id="pkg-examples">Examples</h4>
<dl>
{{range $.Examples}}
<dd><a class="exampleLink" href="#example_{{.Name}}">{{example_name .Name}}</a></dd>
{{end}}
</dl>
{{end}}
</div><!-- #manual-nav -->
{{with .Filenames}}
<h4>Package files</h4>
@ -88,6 +102,8 @@
</span>
</p>
{{end}}
</div><!-- .expanded -->
</div><!-- #pkg-index -->
{{with .Consts}}
<h2 id="pkg-constants">Constants</h2>