]> Cypherpunks.ru repositories - gostls13.git/commitdiff
godoc: move Examples above Index and make them both collapsable
authorAndrew Gerrand <adg@golang.org>
Wed, 3 Oct 2012 05:05:08 +0000 (15:05 +1000)
committerAndrew Gerrand <adg@golang.org>
Wed, 3 Oct 2012 05:05:08 +0000 (15:05 +1000)
R=golang-dev, dsymonds, bradfitz, r
CC=golang-dev
https://golang.org/cl/6591066

lib/godoc/package.html

index 158be24804aa3b456074e66921c36a5f0b8e2815..ae574827d67032eb746c4446a2125551efc24ce1 100644 (file)
                        </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>
                        {{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>
                        </span>
                        </p>
                {{end}}
+               </div><!-- .expanded -->
+               </div><!-- #pkg-index -->
        
                {{with .Consts}}
                        <h2 id="pkg-constants">Constants</h2>