godoc: cleanup package templates
Separate the templates of package root directory and other directories. This removes several if-else conditions and makes the template code much cleaner. To be merged after CL 95835. For golang/go#3305 Change-Id: I435441dbe214e4c89271483173df7c30a42ee28f Reviewed-on: https://go-review.googlesource.com/101295 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
This commit is contained in:
parent
16d1af8d88
commit
faed997d2c
|
@ -120,6 +120,7 @@ func readTemplates(p *godoc.Presentation, html bool) {
|
||||||
p.ImplementsHTML = readTemplate("implements.html")
|
p.ImplementsHTML = readTemplate("implements.html")
|
||||||
p.MethodSetHTML = readTemplate("methodset.html")
|
p.MethodSetHTML = readTemplate("methodset.html")
|
||||||
p.PackageHTML = readTemplate("package.html")
|
p.PackageHTML = readTemplate("package.html")
|
||||||
|
p.PackageRootHTML = readTemplate("packageroot.html")
|
||||||
p.SearchHTML = readTemplate("search.html")
|
p.SearchHTML = readTemplate("search.html")
|
||||||
p.SearchDocHTML = readTemplate("searchdoc.html")
|
p.SearchDocHTML = readTemplate("searchdoc.html")
|
||||||
p.SearchCodeHTML = readTemplate("searchcode.html")
|
p.SearchCodeHTML = readTemplate("searchcode.html")
|
||||||
|
|
|
@ -33,6 +33,7 @@ type Presentation struct {
|
||||||
ImplementsHTML,
|
ImplementsHTML,
|
||||||
MethodSetHTML,
|
MethodSetHTML,
|
||||||
PackageHTML,
|
PackageHTML,
|
||||||
|
PackageRootHTML,
|
||||||
PackageText,
|
PackageText,
|
||||||
SearchHTML,
|
SearchHTML,
|
||||||
SearchDocHTML,
|
SearchDocHTML,
|
||||||
|
|
|
@ -321,11 +321,17 @@ func (h *handlerServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
info.GoogleCN = googleCN(r)
|
info.GoogleCN = googleCN(r)
|
||||||
|
var body []byte
|
||||||
|
if info.Dirname == "/src" {
|
||||||
|
body = applyTemplate(h.p.PackageRootHTML, "packageRootHTML", info)
|
||||||
|
} else {
|
||||||
|
body = applyTemplate(h.p.PackageHTML, "packageHTML", info)
|
||||||
|
}
|
||||||
h.p.ServePage(w, Page{
|
h.p.ServePage(w, Page{
|
||||||
Title: title,
|
Title: title,
|
||||||
Tabtitle: tabtitle,
|
Tabtitle: tabtitle,
|
||||||
Subtitle: subtitle,
|
Subtitle: subtitle,
|
||||||
Body: applyTemplate(h.p.PackageHTML, "packageHTML", info),
|
Body: body,
|
||||||
GoogleCN: info.GoogleCN,
|
GoogleCN: info.GoogleCN,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ var files = []string{
|
||||||
"methodset.html",
|
"methodset.html",
|
||||||
"opensearch.xml",
|
"opensearch.xml",
|
||||||
"package.html",
|
"package.html",
|
||||||
|
"packageroot.html",
|
||||||
"package.txt",
|
"package.txt",
|
||||||
"play.js",
|
"play.js",
|
||||||
"playground.js",
|
"playground.js",
|
||||||
|
|
|
@ -245,162 +245,37 @@
|
||||||
{{if $.PDoc}}
|
{{if $.PDoc}}
|
||||||
<h2 id="pkg-subdirectories">Subdirectories</h2>
|
<h2 id="pkg-subdirectories">Subdirectories</h2>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if eq $.Dirname "/src"}}
|
<div class="pkg-dir">
|
||||||
<div id="manual-nav">
|
<table>
|
||||||
<dl>
|
<tr>
|
||||||
<dt><a href="#stdlib">Standard library</a></dt>
|
<th class="pkg-name">Name</th>
|
||||||
{{if hasThirdParty .List }}
|
<th class="pkg-synopsis">Synopsis</th>
|
||||||
<dt><a href="#thirdparty">Third party</a></dt>
|
</tr>
|
||||||
{{end}}
|
|
||||||
<dt><a href="#other">Other packages</a></dt>
|
|
||||||
<dd><a href="#subrepo">Sub-repositories</a></dd>
|
|
||||||
<dd><a href="#community">Community</a></dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="stdlib" class="toggleVisible">
|
{{if not ((eq $.Dirname "/src/cmd") $.DirFlat)}}
|
||||||
<div class="collapsed">
|
<tr>
|
||||||
<h2 class="toggleButton" title="Click to show Standard library section">Standard library ▹</h2>
|
<td colspan="2"><a href="..">..</a></td>
|
||||||
</div>
|
</tr>
|
||||||
<div class="expanded">
|
{{end}}
|
||||||
<h2 class="toggleButton" title="Click to hide Standard library section">Standard library ▾</h2>
|
|
||||||
<img alt="" class="gopher" src="/doc/gopher/pkg.png"/>
|
{{range .List}}
|
||||||
{{end}}
|
|
||||||
<div class="pkg-dir">
|
|
||||||
<table>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th class="pkg-name">Name</th>
|
{{if $.DirFlat}}
|
||||||
<th class="pkg-synopsis">Synopsis</th>
|
{{if .HasPkg}}
|
||||||
</tr>
|
<td class="pkg-name">
|
||||||
|
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
|
||||||
{{if not (or (eq $.Dirname "/src") (eq $.Dirname "/src/cmd") $.DirFlat)}}
|
</td>
|
||||||
<tr>
|
|
||||||
<td colspan="2"><a href="..">..</a></td>
|
|
||||||
</tr>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{if eq $.Dirname "/src"}}
|
|
||||||
{{range .List}}
|
|
||||||
<tr>
|
|
||||||
{{if eq .FsRootType "GOROOT"}}
|
|
||||||
{{if $.DirFlat}}
|
|
||||||
{{if .HasPkg}}
|
|
||||||
<td class="pkg-name">
|
|
||||||
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
{{else}}
|
|
||||||
<td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
|
|
||||||
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
<td class="pkg-synopsis">
|
|
||||||
{{html .Synopsis}}
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
</tr>
|
|
||||||
{{end}}
|
{{end}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{range .List}}
|
<td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
|
||||||
<tr>
|
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
|
||||||
{{if $.DirFlat}}
|
</td>
|
||||||
{{if .HasPkg}}
|
|
||||||
<td class="pkg-name">
|
|
||||||
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
{{else}}
|
|
||||||
<td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
|
|
||||||
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
<td class="pkg-synopsis">
|
|
||||||
{{html .Synopsis}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
{{end}}
|
||||||
</table>
|
<td class="pkg-synopsis">
|
||||||
</div>
|
{{html .Synopsis}}
|
||||||
{{if eq $.Dirname "/src"}}
|
</td>
|
||||||
</div>
|
</tr>
|
||||||
|
{{end}}
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if hasThirdParty .List }}
|
|
||||||
<div id="thirdparty" class="toggleVisible">
|
|
||||||
<div class="collapsed">
|
|
||||||
<h2 class="toggleButton" title="Click to show Third party section">Third party ▹</h2>
|
|
||||||
</div>
|
|
||||||
<div class="expanded">
|
|
||||||
<h2 class="toggleButton" title="Click to hide Third party section">Third party ▾</h2>
|
|
||||||
<div class="pkg-dir">
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th class="pkg-name">Name</th>
|
|
||||||
<th class="pkg-synopsis">Synopsis</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{{range .List}}
|
|
||||||
<tr>
|
|
||||||
{{if eq .FsRootType "GOPATH"}}
|
|
||||||
{{if $.DirFlat}}
|
|
||||||
{{if .HasPkg}}
|
|
||||||
<td class="pkg-name">
|
|
||||||
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
{{else}}
|
|
||||||
<td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
|
|
||||||
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
<td class="pkg-synopsis">
|
|
||||||
{{html .Synopsis}}
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
</tr>
|
|
||||||
{{end}}
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
<h2 id="other">Other packages</h2>
|
|
||||||
<h3 id="subrepo">Sub-repositories</h3>
|
|
||||||
<p>
|
|
||||||
These packages are part of the Go Project but outside the main Go tree.
|
|
||||||
They are developed under looser <a href="/doc/go1compat">compatibility requirements</a> than the Go core.
|
|
||||||
Install them with "<a href="/cmd/go/#hdr-Download_and_install_packages_and_dependencies">go get</a>".
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/benchmarks">benchmarks</a> — benchmarks to measure Go as it is developed.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/blog">blog</a> — <a href="//blog.golang.org">blog.golang.org</a>'s implementation.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/build">build</a> — <a href="//build.golang.org">build.golang.org</a>'s implementation.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/crypto">crypto</a> — additional cryptography packages.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/debug">debug</a> — an experimental debugger for Go.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/image">image</a> — additional imaging packages.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/mobile">mobile</a> — experimental support for Go on mobile platforms.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/net">net</a> — additional networking packages.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/perf">perf</a> — packages and tools for performance measurement, storage, and analysis.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/review">review</a> — a tool for working with Gerrit code reviews.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/sync">sync</a> — additional concurrency primitives.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/sys">sys</a> — packages for making system calls.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/text">text</a> — packages for working with text.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/time">time</a> — additional time packages.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/tools">tools</a> — godoc, goimports, gorename, and other tools.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/tour">tour</a> — <a href="//tour.golang.org">tour.golang.org</a>'s implementation.</li>
|
|
||||||
<li><a href="//godoc.org/golang.org/x/exp">exp</a> — experimental and deprecated packages (handle with care; may change without warning).</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h3 id="community">Community</h3>
|
|
||||||
<p>
|
|
||||||
These services can help you find Open Source packages provided by the community.
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
<li><a href="//godoc.org">GoDoc</a> - a package index and search engine.</li>
|
|
||||||
<li><a href="http://go-search.org">Go Search</a> - a code search engine.</li>
|
|
||||||
<li><a href="/wiki/Projects">Projects at the Go Wiki</a> - a curated list of Go projects.</li>
|
|
||||||
</ul>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
<!--
|
||||||
|
Copyright 2018 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.
|
||||||
|
-->
|
||||||
|
<!--
|
||||||
|
Note: Static (i.e., not template-generated) href and id
|
||||||
|
attributes start with "pkg-" to make it impossible for
|
||||||
|
them to conflict with generated attributes (some of which
|
||||||
|
correspond to Go identifiers).
|
||||||
|
-->
|
||||||
|
{{with .PAst}}
|
||||||
|
{{range $filename, $ast := .}}
|
||||||
|
<a href="{{$filename|srcLink|html}}">{{$filename|filename|html}}</a>:<pre>{{node_html $ $ast false}}</pre>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{with .Dirs}}
|
||||||
|
{{/* DirList entries are numbers and strings - no need for FSet */}}
|
||||||
|
{{if $.PDoc}}
|
||||||
|
<h2 id="pkg-subdirectories">Subdirectories</h2>
|
||||||
|
{{end}}
|
||||||
|
<div id="manual-nav">
|
||||||
|
<dl>
|
||||||
|
<dt><a href="#stdlib">Standard library</a></dt>
|
||||||
|
{{if hasThirdParty .List }}
|
||||||
|
<dt><a href="#thirdparty">Third party</a></dt>
|
||||||
|
{{end}}
|
||||||
|
<dt><a href="#other">Other packages</a></dt>
|
||||||
|
<dd><a href="#subrepo">Sub-repositories</a></dd>
|
||||||
|
<dd><a href="#community">Community</a></dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="stdlib" class="toggleVisible">
|
||||||
|
<div class="collapsed">
|
||||||
|
<h2 class="toggleButton" title="Click to show Standard library section">Standard library ▹</h2>
|
||||||
|
</div>
|
||||||
|
<div class="expanded">
|
||||||
|
<h2 class="toggleButton" title="Click to hide Standard library section">Standard library ▾</h2>
|
||||||
|
<img alt="" class="gopher" src="/doc/gopher/pkg.png"/>
|
||||||
|
<div class="pkg-dir">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="pkg-name">Name</th>
|
||||||
|
<th class="pkg-synopsis">Synopsis</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{{range .List}}
|
||||||
|
<tr>
|
||||||
|
{{if eq .FsRootType "GOROOT"}}
|
||||||
|
{{if $.DirFlat}}
|
||||||
|
{{if .HasPkg}}
|
||||||
|
<td class="pkg-name">
|
||||||
|
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
|
||||||
|
</td>
|
||||||
|
{{end}}
|
||||||
|
{{else}}
|
||||||
|
<td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
|
||||||
|
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
|
||||||
|
</td>
|
||||||
|
{{end}}
|
||||||
|
<td class="pkg-synopsis">
|
||||||
|
{{html .Synopsis}}
|
||||||
|
</td>
|
||||||
|
{{end}}
|
||||||
|
</tr>
|
||||||
|
{{end}}
|
||||||
|
</table>
|
||||||
|
</div> <!-- .pkg-dir -->
|
||||||
|
</div> <!-- .expanded -->
|
||||||
|
</div> <!-- #stdlib .toggleVisible -->
|
||||||
|
|
||||||
|
{{if hasThirdParty .List }}
|
||||||
|
<div id="thirdparty" class="toggleVisible">
|
||||||
|
<div class="collapsed">
|
||||||
|
<h2 class="toggleButton" title="Click to show Third party section">Third party ▹</h2>
|
||||||
|
</div>
|
||||||
|
<div class="expanded">
|
||||||
|
<h2 class="toggleButton" title="Click to hide Third party section">Third party ▾</h2>
|
||||||
|
<div class="pkg-dir">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="pkg-name">Name</th>
|
||||||
|
<th class="pkg-synopsis">Synopsis</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{{range .List}}
|
||||||
|
<tr>
|
||||||
|
{{if eq .FsRootType "GOPATH"}}
|
||||||
|
{{if $.DirFlat}}
|
||||||
|
{{if .HasPkg}}
|
||||||
|
<td class="pkg-name">
|
||||||
|
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
|
||||||
|
</td>
|
||||||
|
{{end}}
|
||||||
|
{{else}}
|
||||||
|
<td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
|
||||||
|
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
|
||||||
|
</td>
|
||||||
|
{{end}}
|
||||||
|
<td class="pkg-synopsis">
|
||||||
|
{{html .Synopsis}}
|
||||||
|
</td>
|
||||||
|
{{end}}
|
||||||
|
</tr>
|
||||||
|
{{end}}
|
||||||
|
</table>
|
||||||
|
</div> <!-- .pkg-dir -->
|
||||||
|
</div> <!-- .expanded -->
|
||||||
|
</div> <!-- #stdlib .toggleVisible -->
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
<h2 id="other">Other packages</h2>
|
||||||
|
<h3 id="subrepo">Sub-repositories</h3>
|
||||||
|
<p>
|
||||||
|
These packages are part of the Go Project but outside the main Go tree.
|
||||||
|
They are developed under looser <a href="/doc/go1compat">compatibility requirements</a> than the Go core.
|
||||||
|
Install them with "<a href="/cmd/go/#hdr-Download_and_install_packages_and_dependencies">go get</a>".
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/benchmarks">benchmarks</a> — benchmarks to measure Go as it is developed.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/blog">blog</a> — <a href="//blog.golang.org">blog.golang.org</a>'s implementation.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/build">build</a> — <a href="//build.golang.org">build.golang.org</a>'s implementation.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/crypto">crypto</a> — additional cryptography packages.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/debug">debug</a> — an experimental debugger for Go.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/image">image</a> — additional imaging packages.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/mobile">mobile</a> — experimental support for Go on mobile platforms.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/net">net</a> — additional networking packages.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/perf">perf</a> — packages and tools for performance measurement, storage, and analysis.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/review">review</a> — a tool for working with Gerrit code reviews.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/sync">sync</a> — additional concurrency primitives.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/sys">sys</a> — packages for making system calls.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/text">text</a> — packages for working with text.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/time">time</a> — additional time packages.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/tools">tools</a> — godoc, goimports, gorename, and other tools.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/tour">tour</a> — <a href="//tour.golang.org">tour.golang.org</a>'s implementation.</li>
|
||||||
|
<li><a href="//godoc.org/golang.org/x/exp">exp</a> — experimental and deprecated packages (handle with care; may change without warning).</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3 id="community">Community</h3>
|
||||||
|
<p>
|
||||||
|
These services can help you find Open Source packages provided by the community.
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="//godoc.org">GoDoc</a> - a package index and search engine.</li>
|
||||||
|
<li><a href="http://go-search.org">Go Search</a> - a code search engine.</li>
|
||||||
|
<li><a href="/wiki/Projects">Projects at the Go Wiki</a> - a curated list of Go projects.</li>
|
||||||
|
</ul>
|
||||||
|
{{end}}
|
|
@ -1865,12 +1865,69 @@ function cgAddChild(tree, ul, cgn) {
|
||||||
{{if $.PDoc}}
|
{{if $.PDoc}}
|
||||||
<h2 id="pkg-subdirectories">Subdirectories</h2>
|
<h2 id="pkg-subdirectories">Subdirectories</h2>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if eq $.Dirname "/src"}}
|
<div class="pkg-dir">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="pkg-name">Name</th>
|
||||||
|
<th class="pkg-synopsis">Synopsis</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{{if not ((eq $.Dirname "/src/cmd") $.DirFlat)}}
|
||||||
|
<tr>
|
||||||
|
<td colspan="2"><a href="..">..</a></td>
|
||||||
|
</tr>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{range .List}}
|
||||||
|
<tr>
|
||||||
|
{{if $.DirFlat}}
|
||||||
|
{{if .HasPkg}}
|
||||||
|
<td class="pkg-name">
|
||||||
|
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
|
||||||
|
</td>
|
||||||
|
{{end}}
|
||||||
|
{{else}}
|
||||||
|
<td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
|
||||||
|
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
|
||||||
|
</td>
|
||||||
|
{{end}}
|
||||||
|
<td class="pkg-synopsis">
|
||||||
|
{{html .Synopsis}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{end}}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
`,
|
||||||
|
|
||||||
|
"packageroot.html": `<!--
|
||||||
|
Copyright 2018 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.
|
||||||
|
-->
|
||||||
|
<!--
|
||||||
|
Note: Static (i.e., not template-generated) href and id
|
||||||
|
attributes start with "pkg-" to make it impossible for
|
||||||
|
them to conflict with generated attributes (some of which
|
||||||
|
correspond to Go identifiers).
|
||||||
|
-->
|
||||||
|
{{with .PAst}}
|
||||||
|
{{range $filename, $ast := .}}
|
||||||
|
<a href="{{$filename|srcLink|html}}">{{$filename|filename|html}}</a>:<pre>{{node_html $ $ast false}}</pre>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{with .Dirs}}
|
||||||
|
{{/* DirList entries are numbers and strings - no need for FSet */}}
|
||||||
|
{{if $.PDoc}}
|
||||||
|
<h2 id="pkg-subdirectories">Subdirectories</h2>
|
||||||
|
{{end}}
|
||||||
<div id="manual-nav">
|
<div id="manual-nav">
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="#stdlib">Standard library</a></dt>
|
<dt><a href="#stdlib">Standard library</a></dt>
|
||||||
{{if hasThirdParty .List }}
|
{{if hasThirdParty .List }}
|
||||||
<dt><a href="#thirdparty">Third party</a></dt>
|
<dt><a href="#thirdparty">Third party</a></dt>
|
||||||
{{end}}
|
{{end}}
|
||||||
<dt><a href="#other">Other packages</a></dt>
|
<dt><a href="#other">Other packages</a></dt>
|
||||||
<dd><a href="#subrepo">Sub-repositories</a></dd>
|
<dd><a href="#subrepo">Sub-repositories</a></dd>
|
||||||
|
@ -1879,90 +1936,22 @@ function cgAddChild(tree, ul, cgn) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="stdlib" class="toggleVisible">
|
<div id="stdlib" class="toggleVisible">
|
||||||
<div class="collapsed">
|
<div class="collapsed">
|
||||||
<h2 class="toggleButton" title="Click to show Standard library section">Standard library ▹</h2>
|
<h2 class="toggleButton" title="Click to show Standard library section">Standard library ▹</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="expanded">
|
<div class="expanded">
|
||||||
<h2 class="toggleButton" title="Click to hide Standard library section">Standard library ▾</h2>
|
<h2 class="toggleButton" title="Click to hide Standard library section">Standard library ▾</h2>
|
||||||
<img alt="" class="gopher" src="/doc/gopher/pkg.png"/>
|
<img alt="" class="gopher" src="/doc/gopher/pkg.png"/>
|
||||||
{{end}}
|
<div class="pkg-dir">
|
||||||
<div class="pkg-dir">
|
<table>
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th class="pkg-name">Name</th>
|
|
||||||
<th class="pkg-synopsis">Synopsis</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{{if not (or (eq $.Dirname "/src") (eq $.Dirname "/src/cmd") $.DirFlat)}}
|
|
||||||
<tr>
|
|
||||||
<td colspan="2"><a href="..">..</a></td>
|
|
||||||
</tr>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{if eq $.Dirname "/src"}}
|
|
||||||
{{range .List}}
|
|
||||||
<tr>
|
<tr>
|
||||||
{{if eq .FsRootType "GOROOT"}}
|
<th class="pkg-name">Name</th>
|
||||||
{{if $.DirFlat}}
|
<th class="pkg-synopsis">Synopsis</th>
|
||||||
{{if .HasPkg}}
|
|
||||||
<td class="pkg-name">
|
|
||||||
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
{{else}}
|
|
||||||
<td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
|
|
||||||
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
<td class="pkg-synopsis">
|
|
||||||
{{html .Synopsis}}
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
|
||||||
{{else}}
|
|
||||||
{{range .List}}
|
|
||||||
<tr>
|
|
||||||
{{if $.DirFlat}}
|
|
||||||
{{if .HasPkg}}
|
|
||||||
<td class="pkg-name">
|
|
||||||
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
{{else}}
|
|
||||||
<td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
|
|
||||||
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
|
|
||||||
</td>
|
|
||||||
{{end}}
|
|
||||||
<td class="pkg-synopsis">
|
|
||||||
{{html .Synopsis}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{end}}
|
|
||||||
{{end}}
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
{{if eq $.Dirname "/src"}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{if hasThirdParty .List }}
|
{{range .List}}
|
||||||
<div id="thirdparty" class="toggleVisible">
|
<tr>
|
||||||
<div class="collapsed">
|
{{if eq .FsRootType "GOROOT"}}
|
||||||
<h2 class="toggleButton" title="Click to show Third party section">Third party ▹</h2>
|
|
||||||
</div>
|
|
||||||
<div class="expanded">
|
|
||||||
<h2 class="toggleButton" title="Click to hide Third party section">Third party ▾</h2>
|
|
||||||
<div class="pkg-dir">
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th class="pkg-name">Name</th>
|
|
||||||
<th class="pkg-synopsis">Synopsis</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{{range .List}}
|
|
||||||
<tr>
|
|
||||||
{{if eq .FsRootType "GOPATH"}}
|
|
||||||
{{if $.DirFlat}}
|
{{if $.DirFlat}}
|
||||||
{{if .HasPkg}}
|
{{if .HasPkg}}
|
||||||
<td class="pkg-name">
|
<td class="pkg-name">
|
||||||
|
@ -1978,12 +1967,51 @@ function cgAddChild(tree, ul, cgn) {
|
||||||
{{html .Synopsis}}
|
{{html .Synopsis}}
|
||||||
</td>
|
</td>
|
||||||
{{end}}
|
{{end}}
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
|
</div> <!-- .pkg-dir -->
|
||||||
|
</div> <!-- .expanded -->
|
||||||
|
</div> <!-- #stdlib .toggleVisible -->
|
||||||
|
|
||||||
|
{{if hasThirdParty .List }}
|
||||||
|
<div id="thirdparty" class="toggleVisible">
|
||||||
|
<div class="collapsed">
|
||||||
|
<h2 class="toggleButton" title="Click to show Third party section">Third party ▹</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="expanded">
|
||||||
</div>
|
<h2 class="toggleButton" title="Click to hide Third party section">Third party ▾</h2>
|
||||||
|
<div class="pkg-dir">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th class="pkg-name">Name</th>
|
||||||
|
<th class="pkg-synopsis">Synopsis</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{{range .List}}
|
||||||
|
<tr>
|
||||||
|
{{if eq .FsRootType "GOPATH"}}
|
||||||
|
{{if $.DirFlat}}
|
||||||
|
{{if .HasPkg}}
|
||||||
|
<td class="pkg-name">
|
||||||
|
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
|
||||||
|
</td>
|
||||||
|
{{end}}
|
||||||
|
{{else}}
|
||||||
|
<td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
|
||||||
|
<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
|
||||||
|
</td>
|
||||||
|
{{end}}
|
||||||
|
<td class="pkg-synopsis">
|
||||||
|
{{html .Synopsis}}
|
||||||
|
</td>
|
||||||
|
{{end}}
|
||||||
|
</tr>
|
||||||
|
{{end}}
|
||||||
|
</table>
|
||||||
|
</div> <!-- .pkg-dir -->
|
||||||
|
</div> <!-- .expanded -->
|
||||||
|
</div> <!-- #stdlib .toggleVisible -->
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<h2 id="other">Other packages</h2>
|
<h2 id="other">Other packages</h2>
|
||||||
|
@ -2022,7 +2050,6 @@ function cgAddChild(tree, ul, cgn) {
|
||||||
<li><a href="http://go-search.org">Go Search</a> - a code search engine.</li>
|
<li><a href="http://go-search.org">Go Search</a> - a code search engine.</li>
|
||||||
<li><a href="/wiki/Projects">Projects at the Go Wiki</a> - a curated list of Go projects.</li>
|
<li><a href="/wiki/Projects">Projects at the Go Wiki</a> - a curated list of Go projects.</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{end}}
|
|
||||||
{{end}}
|
{{end}}
|
||||||
`,
|
`,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue