github.com/olivere/camlistore@v0.0.0-20140121221811-1b7ac2da0199/website/tmpl/package.html (about)

     1  <!--
     2  	Copyright 2009 The Go Authors. All rights reserved.
     3  	Use of this source code is governed by a BSD-style
     4  	license that can be found in the LICENSE file.
     5  -->
     6  <!--
     7  	Note: Static (i.e., not template-generated) href and id
     8  	attributes start with "pkg-" to make it impossible for
     9  	them to conflict with generated attributes (some of which
    10  	correspond to Go identifiers).
    11  -->
    12  {{with .PDoc}}
    13  	{{if $.IsPkg}}
    14  		<div id="short-nav">
    15  			<dl>
    16  			<dd><code>import "{{html .ImportPath}}"</code></dd>
    17  			</dl>
    18  			<dl>
    19  			<dd><a href="#pkg-overview" class="overviewLink">Overview</a></dd>
    20  			<dd><a href="#pkg-index">Index</a></dd>
    21  			{{if $.Examples}}
    22  				<dd><a href="#pkg-examples">Examples</a></dd>
    23  			{{end}}
    24  			{{if $.PList}}
    25  				<dd><a href="#pkg-other-packages">Other packages</a></dd>
    26  			{{end}}
    27  			{{if $.Dirs}}
    28  				<dd><a href="#pkg-subdirectories">Subdirectories</a></dd>
    29  			{{end}}
    30  			</dl>
    31  		</div>
    32  		<!-- The package's Name is printed as title by the top-level template -->
    33  		<div id="pkg-overview" class="toggleVisible">
    34  			<div class="collapsed">
    35  				<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
    36  			</div>
    37  			<div class="expanded">
    38  				<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
    39  				{{comment_html .Doc}}
    40  			</div>
    41  		</div>
    42  		{{example_html "" $.Examples $.FSet}}
    43  	
    44  		<h2 id="pkg-index">Index</h2>
    45  		<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
    46  		<div id="manual-nav">
    47  			<dl>
    48  			{{if .Consts}}
    49  				<dd><a href="#pkg-constants">Constants</a></dd>
    50  			{{end}}
    51  			{{if .Vars}}
    52  				<dd><a href="#pkg-variables">Variables</a></dd>
    53  			{{end}}
    54  			{{range .Funcs}}
    55  				{{$name_html := html .Name}}
    56  				<dd><a href="#{{$name_html}}">{{node_html .Decl $.FSet}}</a></dd>
    57  			{{end}}
    58  			{{range .Types}}
    59  				{{$tname_html := html .Name}}
    60  				<dd><a href="#{{$tname_html}}">type {{$tname_html}}</a></dd>
    61  				{{range .Funcs}}
    62  					{{$name_html := html .Name}}
    63  					<dd>&nbsp; &nbsp; <a href="#{{$name_html}}">{{node_html .Decl $.FSet}}</a></dd>
    64  				{{end}}
    65  				{{range .Methods}}
    66  					{{$name_html := html .Name}}
    67  					<dd>&nbsp; &nbsp; <a href="#{{$tname_html}}.{{$name_html}}">{{node_html .Decl $.FSet}}</a></dd>
    68  				{{end}}
    69  			{{end}}
    70  			{{if .Bugs}}
    71  				<dd><a href="#pkg-bugs">Bugs</a></dd>
    72  			{{end}}
    73  		</dl>
    74  
    75  		{{if $.Examples}}
    76  			<h4 id="pkg-examples">Examples</h4>
    77  			<dl>
    78  			{{range $.Examples}}
    79  			<dd><a class="exampleLink" href="#example_{{.Name}}">{{example_name .Name}}</a></dd>
    80  			{{end}}
    81  			</dl>
    82  		{{end}}
    83  
    84  		{{with .Filenames}}
    85  			<h4>Package files</h4>
    86  			<p>
    87  			<span style="font-size:90%">
    88  			{{range .}}
    89  				<a href="{{.|srcLink|html}}">{{.|filename|html}}</a>
    90  			{{end}}
    91  			</span>
    92  			</p>
    93  		{{end}}
    94  	
    95  		{{with .Consts}}
    96  			<h2 id="pkg-constants">Constants</h2>
    97  			{{range .}}
    98  				<pre>{{node_html .Decl $.FSet}}</pre>
    99  				{{comment_html .Doc}}
   100  			{{end}}
   101  		{{end}}
   102  		{{with .Vars}}
   103  			<h2 id="pkg-variables">Variables</h2>
   104  			{{range .}}
   105  				<pre>{{node_html .Decl $.FSet}}</pre>
   106  				{{comment_html .Doc}}
   107  			{{end}}
   108  		{{end}}
   109  		{{range .Funcs}}
   110  			{{/* Name is a string - no need for FSet */}}
   111  			{{$name_html := html .Name}}
   112  			<h2 id="{{$name_html}}">func <a href="{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h2>
   113  			<pre>{{node_html .Decl $.FSet}}</pre>
   114  			{{comment_html .Doc}}
   115  			{{example_html .Name $.Examples $.FSet}}
   116  		{{end}}
   117  		{{range .Types}}
   118  			{{$tname := .Name}}
   119  			{{$tname_html := html .Name}}
   120  			<h2 id="{{$tname_html}}">type <a href="{{posLink_url .Decl $.FSet}}">{{$tname_html}}</a></h2>
   121  			<pre>{{node_html .Decl $.FSet}}</pre>
   122  			{{comment_html .Doc}}
   123  
   124  			{{range .Consts}}
   125  				<pre>{{node_html .Decl $.FSet}}</pre>
   126  				{{comment_html .Doc}}
   127  			{{end}}
   128  
   129  			{{range .Vars}}
   130  				<pre>{{node_html .Decl $.FSet}}</pre>
   131  				{{comment_html .Doc}}
   132  			{{end}}
   133  
   134  			{{example_html $tname $.Examples $.FSet}}
   135  
   136  			{{range .Funcs}}
   137  				{{$name_html := html .Name}}
   138  				<h3 id="{{$name_html}}">func <a href="{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h3>
   139  				<pre>{{node_html .Decl $.FSet}}</pre>
   140  				{{comment_html .Doc}}
   141  				{{example_html .Name $.Examples $.FSet}}
   142  			{{end}}
   143  
   144  			{{range .Methods}}
   145  				{{$name_html := html .Name}}
   146  				<h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h3>
   147  				<pre>{{node_html .Decl $.FSet}}</pre>
   148  				{{comment_html .Doc}}
   149  				{{$name := printf "%s_%s" $tname .Name}}
   150  				{{example_html $name $.Examples $.FSet}}
   151  			{{end}}
   152  		{{end}}
   153  		</div>
   154  	{{else}}  {{/* not a package; is a command */}}
   155  		{{comment_html .Doc}}
   156  	{{end}}
   157  
   158  	{{with .Bugs}}
   159  		<h2 id="pkg-bugs">Bugs</h2>
   160  		{{range .}}
   161  		{{comment_html .}}
   162  		{{end}}
   163  	{{end}}
   164  {{end}}
   165  
   166  {{with .PAst}}
   167  	<pre>{{node_html . $.FSet}}</pre>
   168  {{end}}
   169  
   170  {{with .PList}}
   171  	<h2 id="pkg-other-packages">Other packages</h2>
   172  	<p>
   173  	{{/* PList entries are strings - no need for FSet */}}
   174  	{{range .}}
   175  	<a href="?p={{urlquery .}}">{{html .}}</a><br />
   176  	{{end}}
   177  	</p>
   178  {{end}}
   179  
   180  {{with .Dirs}}
   181  	{{/* DirList entries are numbers and strings - no need for FSet */}}
   182  	<h2 id="pkg-subdirectories">Subdirectories</h2>
   183  	<table class="dir">
   184  	<tr>
   185  	<th>Name</th>
   186  	<th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
   187  	<th style="text-align: left; width: auto">Synopsis</th>
   188  	</tr>
   189  	{{if not $.DirFlat}}
   190  		<tr>
   191  		<td><a href="..">..</a></td>
   192  		</tr>
   193  	{{end}}
   194  	{{range .List}}
   195  		{{if $.DirFlat}}
   196  			{{if .HasPkg}}
   197  				<tr>
   198  				<td class="name"><a href="{{html .Path}}/">{{html .Path}}</a></td>
   199  				<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   200  				<td style="width: auto">{{html .Synopsis}}</td>
   201  				</tr>
   202  			{{end}}
   203  		{{else}}
   204  			<tr>
   205  			<td class="name">{{repeat `&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;` .Depth}}<a href="{{html .Path}}/">{{html .Name}}</a></td>
   206  			<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
   207  			<td style="width: auto">{{html .Synopsis}}</td>
   208  			</tr>
   209  		{{end}}
   210  	{{end}}
   211  	</table>
   212  {{end}}