mirror of
https://github.com/golang/go
synced 2024-11-22 04:14:42 -07:00
godoc: moving to new template package
- first step; rough conversion of all template files - there is plenty of opportunity for cleanups/simplifications (next CLs) - html and text output as before R=r, dsymonds CC=golang-dev https://golang.org/cl/4852048
This commit is contained in:
parent
bca65e395e
commit
2e394c51d9
@ -18,9 +18,9 @@
|
|||||||
<img title="View code in new window" alt="Pop Out Code" src="/doc/codewalk/popout.png" style="display: block; float: right;"/>
|
<img title="View code in new window" alt="Pop Out Code" src="/doc/codewalk/popout.png" style="display: block; float: right;"/>
|
||||||
</a>
|
</a>
|
||||||
<select id="code-selector">
|
<select id="code-selector">
|
||||||
{.repeated section File}
|
{{range .File}}
|
||||||
<option value="/doc/codewalk/?fileprint=/{@|html-esc}">{@|html-esc}</option>
|
<option value="/doc/codewalk/?fileprint=/{{.|urlquery_esc}}">{{.|html_esc}}</option>
|
||||||
{.end}
|
{{end}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div id="code">
|
<div id="code">
|
||||||
@ -35,19 +35,19 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="right" id="comment-column">
|
<div class="right" id="comment-column">
|
||||||
<div id="comment-area">
|
<div id="comment-area">
|
||||||
{.repeated section Step}
|
{{range .Step}}
|
||||||
<div class="comment first last">
|
<div class="comment first last">
|
||||||
<a class="comment-link" href="/doc/codewalk/?fileprint=/{File|html-esc}&lo={Lo|html-esc}&hi={Hi|html-esc}#mark" target="code-display"></a>
|
<a class="comment-link" href="/doc/codewalk/?fileprint=/{{.File|urlquery_esc}}&lo={{.Lo|html_esc}}&hi={{.Hi|html_esc}}#mark" target="code-display"></a>
|
||||||
<div class="comment-title">{Title|html-esc}</div>
|
<div class="comment-title">{{.Title|html_esc}}</div>
|
||||||
<div class="comment-text">
|
<div class="comment-text">
|
||||||
{.section Err}
|
{{with .Err}}
|
||||||
ERROR LOADING FILE: {Err|html-esc}<br/><br/>
|
ERROR LOADING FILE: {{.|html_esc}}<br/><br/>
|
||||||
{.end}
|
{{end}}
|
||||||
{XML}
|
{{.XML}}
|
||||||
</div>
|
</div>
|
||||||
<div class="comment-text file-name"><span class="path-file">{@|html-esc}</span></div>
|
<div class="comment-text file-name"><span class="path-file">{{.|html_esc}}</span></div>
|
||||||
</div>
|
</div>
|
||||||
{.end}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<div id="comment-options" class="setting">
|
<div id="comment-options" class="setting">
|
||||||
<a id="prev-comment" href="#"><span class="hotkey">p</span>revious step</a>
|
<a id="prev-comment" href="#"><span class="hotkey">p</span>revious step</a>
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<table class="layout">
|
<table class="layout">
|
||||||
{.repeated section @}
|
{{range .}}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{Name|html-esc}">{Name|html-esc}</a></td>
|
<td><a href="{{.Name|html_esc}}">{{.Name|html_esc}}</a></td>
|
||||||
<td width="25"> </td>
|
<td width="25"> </td>
|
||||||
<td>{Title|html-esc}</td>
|
<td>{{.Title|html_esc}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{.end}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
|
@ -16,14 +16,15 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="..">..</a></td>
|
<td><a href="..">..</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{.repeated section @}
|
{{range .}}
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left"><a href="{@|fileInfoName}">{@|fileInfoName}</a></td>
|
<td align="left"><a href="{{.|fileInfoName}}">{{.|fileInfoName}}</a></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td align="right">{@|fileInfoSize}</td>
|
<td align="right">{{.|fileInfoSize}}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td align="left">{@|fileInfoTime}</td>
|
<td align="left">{{.|fileInfoTime}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{.end}
|
{{end}}
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</p>
|
</p>
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span class="alert" style="font-size:120%">{@|html-esc}</span>
|
<span class="alert" style="font-size:120%">{{.|html_esc}}</span>
|
||||||
</p>
|
</p>
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
{.section Title}
|
{{with .Title}}
|
||||||
<title>{@|html-esc} - The Go Programming Language</title>
|
<title>{{.|html_esc}} - The Go Programming Language</title>
|
||||||
{.or}
|
{{else}}
|
||||||
<title>The Go Programming Language</title>
|
<title>The Go Programming Language</title>
|
||||||
{.end}
|
{{end}}
|
||||||
<link rel="stylesheet" href="/doc/all.css" type="text/css" media="all" charset="utf-8">
|
<link rel="stylesheet" href="/doc/all.css" type="text/css" media="all" charset="utf-8">
|
||||||
<!--[if lt IE 8]>
|
<!--[if lt IE 8]>
|
||||||
<link rel="stylesheet" href="/doc/ie.css" type="text/css">
|
<link rel="stylesheet" href="/doc/ie.css" type="text/css">
|
||||||
@ -23,19 +23,19 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<div class="quickref">
|
<div class="quickref">
|
||||||
<form method="GET" action="/search">
|
<form method="GET" action="/search">
|
||||||
{.section PkgRoots}
|
{{with .PkgRoots}}
|
||||||
{.repeated section PkgRoots}
|
{{range .PkgRoots}}
|
||||||
<a href="/pkg/{@|html-esc}">{@|html-esc}</a> <span class="sep">|</span>
|
<a href="/pkg/{{.|html_esc}}">{{.|html_esc}}</a> <span class="sep">|</span>
|
||||||
{.end}
|
{{end}}
|
||||||
{.or}
|
{{else}}
|
||||||
References:
|
References:
|
||||||
{.end}
|
{{end}}
|
||||||
<a href="/pkg/">Packages</a> <span class="sep">|</span>
|
<a href="/pkg/">Packages</a> <span class="sep">|</span>
|
||||||
<a href="/cmd/">Commands</a> <span class="sep">|</span>
|
<a href="/cmd/">Commands</a> <span class="sep">|</span>
|
||||||
<a href="/doc/go_spec.html">Specification</a>
|
<a href="/doc/go_spec.html">Specification</a>
|
||||||
{.section SearchBox}
|
{{if .SearchBox}}
|
||||||
<input id="search" type="search" name="q" value="{.section Query}{Query|html-esc}{.end}" class="{.section Query}{.or}inactive{.end}" placeholder="code search" results="0" />
|
<input id="search" type="search" name="q" value="{{if .Query}}{{.Query|html_esc}}{{end}}" class="{{if .Query}}{{else}}inactive{{end}}" placeholder="code search" results="0" />
|
||||||
{.end}
|
{{end}}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -43,28 +43,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<!-- Menu is HTML-escaped elsewhere -->
|
<!-- Menu is HTML-escaped elsewhere -->
|
||||||
{.section Menu}
|
{{with .Menu}}
|
||||||
<div id="menu">
|
<div id="menu">
|
||||||
{@}
|
{{printf "%s" .}}
|
||||||
</div>
|
</div>
|
||||||
{.end}
|
{{end}}
|
||||||
|
|
||||||
{.section Title}
|
{{with .Title}}
|
||||||
<h1 id="generatedHeader">{@|html-esc}</h1>
|
<h1 id="generatedHeader">{{.|html_esc}}</h1>
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Subtitle}
|
{{with .Subtitle}}
|
||||||
<span class="subtitle">{@|html-esc}</span>
|
<span class="subtitle">{{.|html_esc}}</span>
|
||||||
{.end}
|
{{end}}
|
||||||
|
|
||||||
<!-- The Table of Contents is automatically inserted in this <div>.
|
<!-- The Table of Contents is automatically inserted in this <div>.
|
||||||
Do not delete this <div>. -->
|
Do not delete this <div>. -->
|
||||||
<div id="nav"></div>
|
<div id="nav"></div>
|
||||||
|
|
||||||
<!-- Content is HTML-escaped elsewhere -->
|
<!-- Content is HTML-escaped elsewhere -->
|
||||||
{Content}
|
{{printf "%s" .Content}}
|
||||||
</div>
|
</div>
|
||||||
<div id="site-info">
|
<div id="site-info">
|
||||||
<p>Build version {Version|html-esc}. Except as noted, this content is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 License</a>.</p>
|
<p>Build version {{.Version|html_esc}}. Except as noted, this content is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 License</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -3,119 +3,120 @@
|
|||||||
Use of this source code is governed by a BSD-style
|
Use of this source code is governed by a BSD-style
|
||||||
license that can be found in the LICENSE file.
|
license that can be found in the LICENSE file.
|
||||||
-->
|
-->
|
||||||
|
{{$FSet := .FSet}}
|
||||||
{.section PAst}
|
{{$Info := .}}
|
||||||
<pre>{@ FSet|html-esc}</pre>
|
{{with .PAst}}
|
||||||
{.end}
|
<pre>{{html_esc . $FSet}}</pre>
|
||||||
{.section PDoc}
|
{{end}}
|
||||||
|
{{with .PDoc}}
|
||||||
<!-- PackageName is printed as title by the top-level template -->
|
<!-- PackageName is printed as title by the top-level template -->
|
||||||
{.section IsPkg}
|
{{if $Info.IsPkg}}
|
||||||
{# ImportPath is a string - no need for FSet}
|
{{/* ImportPath is a string - no need for FSet */}}
|
||||||
<p><code>import "{ImportPath|html-esc}"</code></p>
|
<p><code>import "{{.ImportPath|html_esc}}"</code></p>
|
||||||
{.end}
|
{{end}}
|
||||||
{Doc|html-comment}
|
{{.Doc|html_comment}}
|
||||||
{.section IsPkg}
|
{{if $Info.IsPkg}}
|
||||||
{.section Filenames}
|
{{with .Filenames}}
|
||||||
{# Filenames are strings - no need for FSet}
|
{{/* Filenames are strings - no need for FSet */}}
|
||||||
<p>
|
<p>
|
||||||
<h4>Package files</h4>
|
<h4>Package files</h4>
|
||||||
<span style="font-size:90%">
|
<span style="font-size:90%">
|
||||||
{.repeated section @}
|
{{range .}}
|
||||||
<a href="/{@|url-src}">{@|localname}</a>
|
<a href="/{{.|url_src}}">{{.|localname}}</a>
|
||||||
{.end}
|
{{end}}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Consts}
|
{{with .Consts}}
|
||||||
<h2 id="Constants">Constants</h2>
|
<h2 id="Constants">Constants</h2>
|
||||||
{.repeated section @}
|
{{range .}}
|
||||||
{Doc|html-comment}
|
{{html_comment .Doc}}
|
||||||
<pre>{Decl FSet|html-esc}</pre>
|
<pre>{{html_esc .Decl $FSet}}</pre>
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Vars}
|
{{with .Vars}}
|
||||||
<h2 id="Variables">Variables</h2>
|
<h2 id="Variables">Variables</h2>
|
||||||
{.repeated section @}
|
{{range .}}
|
||||||
{Doc|html-comment}
|
{{html_comment .Doc}}
|
||||||
<pre>{Decl FSet|html-esc}</pre>
|
<pre>{{html_esc .Decl $FSet}}</pre>
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Funcs}
|
{{with .Funcs}}
|
||||||
{.repeated section @}
|
{{range .}}
|
||||||
{# Name is a string - no need for FSet}
|
{{/* Name is a string - no need for FSet */}}
|
||||||
<h2 id="{Name|html-esc}">func <a href="/{Decl FSet|url-pos}">{Name|html-esc}</a></h2>
|
<h2 id="{{.Name|html_esc}}">func <a href="/{{url_pos .Decl $FSet}}">{{.Name|html_esc}}</a></h2>
|
||||||
<p><code>{Decl FSet|html-esc}</code></p>
|
<p><code>{{html_esc .Decl $FSet}}</code></p>
|
||||||
{Doc|html-comment}
|
{{.Doc|html_comment}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Types}
|
{{with .Types}}
|
||||||
{.repeated section @}
|
{{range $type := .}}
|
||||||
<h2 id="{Type.Name FSet|html-esc}">type <a href="/{Decl FSet|url-pos}">{Type.Name FSet|html-esc}</a></h2>
|
<h2 id="{{html_esc .Type.Name $FSet}}">type <a href="/{{url_pos .Decl $FSet}}">{{html_esc .Type.Name $FSet}}</a></h2>
|
||||||
{Doc|html-comment}
|
{{.Doc|html_comment}}
|
||||||
<p><pre>{Decl FSet|html-esc}</pre></p>
|
<p><pre>{{html_esc .Decl $FSet}}</pre></p>
|
||||||
{.repeated section Consts}
|
{{range .Consts}}
|
||||||
{Doc|html-comment}
|
{{.Doc|html_comment}}
|
||||||
<pre>{Decl FSet|html-esc}</pre>
|
<pre>{{html_esc .Decl $FSet}}</pre>
|
||||||
{.end}
|
{{end}}
|
||||||
{.repeated section Vars}
|
{{range .Vars}}
|
||||||
{Doc|html-comment}
|
{{.Doc|html_comment}}
|
||||||
<pre>{Decl FSet|html-esc}</pre>
|
<pre>{{html_esc .Decl $FSet}}</pre>
|
||||||
{.end}
|
{{end}}
|
||||||
{.repeated section Factories}
|
{{range .Factories}}
|
||||||
<h3 id="{Type.Name FSet|html-esc}.{Name|html-esc}">func <a href="/{Decl FSet|url-pos}">{Name|html-esc}</a></h3>
|
<h3 id="{{html_esc $type.Type.Name $FSet}}.{{.Name|html_esc}}">func <a href="/{{url_pos .Decl $FSet}}">{{.Name|html_esc}}</a></h3>
|
||||||
<p><code>{Decl FSet|html-esc}</code></p>
|
<p><code>{{html_esc .Decl $FSet}}</code></p>
|
||||||
{Doc|html-comment}
|
{{.Doc|html_comment}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.repeated section Methods}
|
{{range .Methods}}
|
||||||
<h3 id="{Type.Name FSet|html-esc}.{Name|html-esc}">func ({Recv FSet|html-esc}) <a href="/{Decl FSet|url-pos}">{Name|html-esc}</a></h3>
|
<h3 id="{{html_esc $type.Type.Name $FSet}}.{{.Name|html_esc}}">func ({{html_esc .Recv $FSet}}) <a href="/{{url_pos .Decl $FSet}}">{{.Name|html_esc}}</a></h3>
|
||||||
<p><code>{Decl FSet|html-esc}</code></p>
|
<p><code>{{html_esc .Decl $FSet}}</code></p>
|
||||||
{Doc|html-comment}
|
{{.Doc|html_comment}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Bugs}
|
{{with .Bugs}}
|
||||||
<h2 id="Bugs">Bugs</h2>
|
<h2 id="Bugs">Bugs</h2>
|
||||||
{.repeated section @}
|
{{range .}}
|
||||||
{@|html-comment}
|
{{.|html_comment}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.section PList}
|
{{with .PList}}
|
||||||
<h2>Other packages</h2>
|
<h2>Other packages</h2>
|
||||||
<p>
|
<p>
|
||||||
{# PLIst entries are strings - no need for FSet}
|
{{/* PList entries are strings - no need for FSet */}}
|
||||||
{.repeated section @}
|
{{range .}}
|
||||||
<a href="?p={@|html-esc}">{@|html-esc}</a><br />
|
<a href="?p={{html .}}">{{html .}}</a><br />
|
||||||
{.end}
|
{{end}}
|
||||||
</p>
|
</p>
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Dirs}
|
{{with .Dirs}}
|
||||||
<p class="detail">
|
<p class="detail">
|
||||||
Need more packages? The
|
Need more packages? The
|
||||||
<a href="http://godashboard.appspot.com/package">Package Dashboard</a>
|
<a href="http://godashboard.appspot.com/package">Package Dashboard</a>
|
||||||
provides a list of <a href="/cmd/goinstall/">goinstallable</a> packages.
|
provides a list of <a href="/cmd/goinstall/">goinstallable</a> packages.
|
||||||
</p>
|
</p>
|
||||||
{# DirList entries are numbers and strings - no need for FSet}
|
{{/* DirList entries are numbers and strings - no need for FSet */}}
|
||||||
<h2 id="Subdirectories">Subdirectories</h2>
|
<h2 id="Subdirectories">Subdirectories</h2>
|
||||||
<p>
|
<p>
|
||||||
<table class="layout">
|
<table class="layout">
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left" colspan="{MaxHeight|html-esc}">Name</th>
|
<th align="left" colspan="{{.MaxHeight|html_esc}}">Name</th>
|
||||||
<td width="25"> </td>
|
<td width="25"> </td>
|
||||||
<th align="left">Synopsis</th>
|
<th align="left">Synopsis</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left"><a href="..">..</a></th>
|
<th align="left"><a href="..">..</a></th>
|
||||||
</tr>
|
</tr>
|
||||||
{.repeated section List}
|
{{range .List}}
|
||||||
<tr>
|
<tr>
|
||||||
{Depth|padding}
|
{{.Depth|padding}}
|
||||||
<td align="left" colspan="{Height|html-esc}"><a href="{Path|html-esc}">{Name|html-esc}</a></td>
|
<td align="left" colspan="{{html .Height}}"><a href="{{html .Path}}">{{html .Name}}</a></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td align="left">{Synopsis|html-esc}</td>
|
<td align="left">{{html .Synopsis}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{.end}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
</p>
|
</p>
|
||||||
{.end}
|
{{end}}
|
||||||
|
@ -1,95 +1,90 @@
|
|||||||
{.section PAst}
|
{{$FSet := .FSet}}{{$Info := .}}{{/*
|
||||||
{@ FSet}
|
|
||||||
{.end}
|
|
||||||
{.section PDoc}
|
|
||||||
{.section IsPkg}
|
|
||||||
PACKAGE
|
|
||||||
|
|
||||||
package {PackageName}
|
---------------------------------------
|
||||||
import "{ImportPath}"
|
|
||||||
{.or}
|
|
||||||
COMMAND DOCUMENTATION
|
|
||||||
{.end}
|
|
||||||
{.section Doc}
|
|
||||||
|
|
||||||
{@ FSet}
|
*/}}{{with .PAst}}{{text . $FSet}}{{end}}{{/*
|
||||||
{.end}
|
|
||||||
{.section Consts}
|
|
||||||
|
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
*/}}{{with .PDoc}}{{if $Info.IsPkg}}PACKAGE
|
||||||
|
|
||||||
|
package {{.PackageName}}
|
||||||
|
import "{{.ImportPath}}"
|
||||||
|
|
||||||
|
{{else}}COMMAND DOCUMENTATION
|
||||||
|
{{end}}{{/*
|
||||||
|
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
*/}}{{with .Doc}}{{text . $FSet}}
|
||||||
|
{{end}}{{/*
|
||||||
|
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
*/}}{{with .Consts}}
|
||||||
CONSTANTS
|
CONSTANTS
|
||||||
|
|
||||||
{.repeated section @}
|
{{range .}}{{text .Decl $FSet}}
|
||||||
{Decl FSet}
|
{{.Doc}}{{end}}
|
||||||
{Doc}
|
{{end}}{{/*
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
{.section Vars}
|
|
||||||
|
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
*/}}{{with .Vars}}
|
||||||
VARIABLES
|
VARIABLES
|
||||||
|
|
||||||
{.repeated section @}
|
{{range .}}{{.Decl $FSet}}
|
||||||
{Decl FSet}
|
{{.Doc}}{{end}}
|
||||||
{Doc}
|
{{end}}{{/*
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
{.section Funcs}
|
|
||||||
|
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
*/}}{{with .Funcs}}
|
||||||
FUNCTIONS
|
FUNCTIONS
|
||||||
|
|
||||||
{.repeated section @}
|
{{range .}}{{text .Decl $FSet}}
|
||||||
{Decl FSet}
|
{{.Doc}}
|
||||||
{Doc}
|
{{end}}{{end}}{{/*
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
{.section Types}
|
|
||||||
|
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
*/}}{{with .Types}}
|
||||||
TYPES
|
TYPES
|
||||||
|
|
||||||
{.repeated section @}
|
{{range .}}{{text .Decl $FSet}}
|
||||||
{Decl FSet}
|
{{.Doc}}
|
||||||
{Doc}
|
{{range .Consts}}{{text .Decl $FSet}}
|
||||||
{.repeated section Consts}
|
{{.Doc}}
|
||||||
{Decl FSet}
|
{{end}}{{range .Vars}}{{text .Decl $FSet}}
|
||||||
{Doc}
|
{{.Doc}}
|
||||||
{.end}
|
{{end}}{{range .Factories}}{{text .Decl $FSet}}
|
||||||
{.repeated section Vars}
|
{{.Doc}}
|
||||||
{Decl FSet}
|
{{end}}{{range .Methods}}{{text .Decl $FSet}}
|
||||||
{Doc}
|
{{.Doc}}
|
||||||
{.end}
|
{{end}}{{end}}{{end}}{{/*
|
||||||
{.repeated section Factories}
|
|
||||||
{Decl FSet}
|
|
||||||
{Doc}
|
|
||||||
{.end}
|
|
||||||
{.repeated section Methods}
|
|
||||||
{Decl FSet}
|
|
||||||
{Doc}
|
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
{.section Bugs}
|
|
||||||
|
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
*/}}{{with .Bugs}}
|
||||||
BUGS
|
BUGS
|
||||||
|
|
||||||
{.repeated section @}
|
{{range .}}{{.}}
|
||||||
{@}
|
{{end}}{{end}}{{end}}{{/*
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
{.section PList}
|
|
||||||
|
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
*/}}{{with .PList}}
|
||||||
OTHER PACKAGES
|
OTHER PACKAGES
|
||||||
|
|
||||||
{.repeated section @}
|
{{range .}}
|
||||||
{@}
|
{{.}}{{end}}
|
||||||
{.end}
|
{{end}}{{/*
|
||||||
{.end}
|
|
||||||
{.section Dirs}
|
|
||||||
{.section Dirs}
|
|
||||||
|
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
*/}}{{with .Dirs}}
|
||||||
SUBDIRECTORIES
|
SUBDIRECTORIES
|
||||||
|
|
||||||
{.repeated section List}
|
{{range .List}}
|
||||||
{Name}
|
{{.Name}}{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
|
@ -3,93 +3,91 @@
|
|||||||
Use of this source code is governed by a BSD-style
|
Use of this source code is governed by a BSD-style
|
||||||
license that can be found in the LICENSE file.
|
license that can be found in the LICENSE file.
|
||||||
-->
|
-->
|
||||||
|
{{$SearchResult := .}}
|
||||||
{.section Alert}
|
{{with .Alert}}
|
||||||
<p>
|
<p>
|
||||||
<span class="alert" style="font-size:120%">{@}</span>
|
<span class="alert" style="font-size:120%">{{.}}</span>
|
||||||
</p>
|
</p>
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Alt}
|
{{with .Alt}}
|
||||||
<p>
|
<p>
|
||||||
<span class="alert" style="font-size:120%">Did you mean: </span>
|
<span class="alert" style="font-size:120%">Did you mean: </span>
|
||||||
{.repeated section Alts}
|
{{range .Alts}}
|
||||||
<a href="search?q={@|html-esc}" style="font-size:120%">{@|html-esc}</a>
|
<a href="search?q={{.|urlquery_esc}}" style="font-size:120%">{{.|html_esc}}</a>
|
||||||
{.end}
|
{{end}}
|
||||||
</p>
|
</p>
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Hit}
|
{{with .Hit}}
|
||||||
{.section Decls}
|
{{with .Decls}}
|
||||||
<h2 id="Global">Package-level declarations</h2>
|
<h2 id="Global">Package-level declarations</h2>
|
||||||
{.repeated section @}
|
{{range .}}
|
||||||
<h3 id="Global_{Pak.Path|url-pkg}">package <a href="/{Pak.Path|url-pkg}">{Pak.Name|html-esc}</a></h3>
|
<h3 id="Global_{{.Pak.Path|url_pkg}}">package <a href="/{{.Pak.Path|url_pkg}}">{{.Pak.Name|html_esc}}</a></h3>
|
||||||
{.repeated section Files}
|
{{range $File := .Files}}
|
||||||
{.repeated section Groups}
|
{{range .Groups}}
|
||||||
{.repeated section Infos}
|
{{range .Infos}}
|
||||||
<a href="/{File.Path|url-src}?h={Query|urlquery-esc}#L{@|infoLine}">{File.Path|url-src}:{@|infoLine}</a>
|
<a href="/{{$File.File.Path|url_src}}?h={{$SearchResult.Query|urlquery_esc}}#L{{.|infoLine}}">{{$File.File.Path|url_src}}:{{.|infoLine}}</a>
|
||||||
{@|infoSnippet}
|
{{.|infoSnippet}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Others}
|
{{with .Others}}
|
||||||
<h2 id="Local">Local declarations and uses</h2>
|
<h2 id="Local">Local declarations and uses</h2>
|
||||||
{.repeated section @}
|
{{range .}}
|
||||||
<h3 id="Local_{Pak.Path|url-pkg}">package <a href="/{Pak.Path|url-pkg}">{Pak.Name|html-esc}</a></h3>
|
<h3 id="Local_{{.Pak.Path|url_pkg}}">package <a href="/{{.Pak.Path|url_pkg}}">{{.Pak.Name|html_esc}}</a></h3>
|
||||||
{.repeated section Files}
|
{{range $File := .Files}}
|
||||||
<a href="/{File.Path|url-src}?h={Query|urlquery-esc}">{File.Path|url-src}</a>
|
<a href="/{{.File.Path|url_src}}?h={{$SearchResult.Query|urlquery_esc}}">{{.File.Path|url_src}}</a>
|
||||||
<table class="layout">
|
<table class="layout">
|
||||||
{.repeated section Groups}
|
{{range .Groups}}
|
||||||
<tr>
|
<tr>
|
||||||
<td width="25"></td>
|
<td width="25"></td>
|
||||||
<th align="left" valign="top">{Kind|infoKind}</th>
|
<th align="left" valign="top">{{.Kind|infoKind}}</th>
|
||||||
<td align="left" width="4"></td>
|
<td align="left" width="4"></td>
|
||||||
<td>
|
<td>
|
||||||
{.repeated section Infos}
|
{{range .Infos}}
|
||||||
<a href="/{File.Path|url-src}?h={Query|urlquery-esc}#L{@|infoLine}">{@|infoLine}</a>
|
<a href="/{{$File.File.Path|url_src}}?h={{$SearchResult.Query|urlquery_esc}}#L{{.|infoLine}}">{{.|infoLine}}</a>
|
||||||
{.end}
|
{{end}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{.end}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Textual}
|
{{with .Textual}}
|
||||||
{.section Complete}
|
{{if $SearchResult.Complete}}
|
||||||
<h2 id="Textual">{Found|html-esc} textual occurrences</h2>
|
<h2 id="Textual">{{$SearchResult.Found|html_esc}} textual occurrences</h2>
|
||||||
{.or}
|
{{else}}
|
||||||
<h2 id="Textual">More than {Found|html-esc} textual occurrences</h2>
|
<h2 id="Textual">More than {{$SearchResult.Found|html_esc}} textual occurrences</h2>
|
||||||
<p>
|
<p>
|
||||||
<span class="alert" style="font-size:120%">Not all files or lines containing "{Query|html-esc}" are shown.</span>
|
<span class="alert" style="font-size:120%">Not all files or lines containing "{{$SearchResult.Query|html_esc}}" are shown.</span>
|
||||||
</p>
|
</p>
|
||||||
{.end}
|
{{end}}
|
||||||
<p>
|
<p>
|
||||||
<table class="layout">
|
<table class="layout">
|
||||||
{.repeated section @}
|
{{range $File := .}}
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left" valign="top">
|
<td align="left" valign="top">
|
||||||
<a href="/{Filename|url-src}?h={Query|urlquery-esc}">{Filename|url-src}</a>:
|
<a href="/{{.Filename|url_src}}?h={{$SearchResult.Query|urlquery_esc}}">{{.Filename|url_src}}</a>:
|
||||||
</td>
|
</td>
|
||||||
<td align="left" width="4"></td>
|
<td align="left" width="4"></td>
|
||||||
<th align="left" valign="top">{Lines|numlines}</th>
|
<th align="left" valign="top">{{.Lines|numlines}}</th>
|
||||||
<td align="left" width="4"></td>
|
<td align="left" width="4"></td>
|
||||||
<td align="left">
|
<td align="left">
|
||||||
{.repeated section Lines}
|
{{range .Lines}}
|
||||||
<a href="/{Filename|url-src}?h={Query|urlquery-esc}#L{@|html-esc}">{@|html-esc}</a>
|
<a href="/{{$File.Filename|url_src}}?h={{$SearchResult.Query|urlquery_esc}}#L{{.|html_esc}}">{{.|html_esc}}</a>
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Complete}
|
{{if not $SearchResult.Complete}}
|
||||||
{.or}
|
|
||||||
...
|
...
|
||||||
{.end}
|
{{end}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{.end}
|
{{end}}
|
||||||
{.section Complete}
|
{{if not $SearchResult.Complete}}
|
||||||
{.or}
|
|
||||||
<tr><td align="left">...</td></tr>
|
<tr><td align="left">...</td></tr>
|
||||||
{.end}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
</p>
|
</p>
|
||||||
{.end}
|
{{end}}
|
||||||
|
@ -1,61 +1,39 @@
|
|||||||
QUERY
|
QUERY
|
||||||
{Query}
|
{{.Query}}
|
||||||
|
{{with .Alert}}
|
||||||
|
{{.}}
|
||||||
|
{{end}}{{/* .Alert */}}{{/*
|
||||||
|
|
||||||
{.section Alert}
|
---------------------------------------
|
||||||
{@}
|
|
||||||
|
|
||||||
{.end}
|
*/}}{{with .Alt}}
|
||||||
{.section Alt}
|
|
||||||
DID YOU MEAN
|
DID YOU MEAN
|
||||||
{.repeated section Alts}
|
{{range .Alts}} {{.}}
|
||||||
{@}
|
{{end}}{{end}}{{/* .Alts */}}{{/*
|
||||||
{.end}
|
|
||||||
|
|
||||||
{.end}
|
---------------------------------------
|
||||||
{.section Hit}
|
|
||||||
{.section Decls}
|
*/}}{{with .Hit}}{{with .Decls}}
|
||||||
PACKAGE-LEVEL DECLARATIONS
|
PACKAGE-LEVEL DECLARATIONS
|
||||||
|
|
||||||
{.repeated section @}
|
{{range .}}package {{.Pak.Name}}
|
||||||
package {Pak.Name}
|
{{range $File := .Files}}{{range .Groups}}{{range .Infos}} {{$File.File.Path|url_src}}:{{.|infoLine}}{{end}}
|
||||||
{.repeated section Files}
|
{{end}}{{end}}{{/* .Files */}}{{end}}{{end}}{{/* .Decls */}}{{/*
|
||||||
{.repeated section Groups}
|
|
||||||
{.repeated section Infos}
|
|
||||||
{File.Path|url-src}:{@|infoLine}
|
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
|
|
||||||
{.end}
|
---------------------------------------
|
||||||
{.end}
|
|
||||||
{.section Others}
|
*/}}{{with .Others}}
|
||||||
LOCAL DECLARATIONS AND USES
|
LOCAL DECLARATIONS AND USES
|
||||||
|
|
||||||
{.repeated section @}
|
{{range .}}package {{.Pak.Name}}
|
||||||
package {Pak.Name}
|
{{range $File := .Files}}{{range .Groups}}{{range .Infos}} {{$File.File.Path|url_src}}:{{.|infoLine}}
|
||||||
{.repeated section Files}
|
{{end}}{{end}}{{end}}{{/* .Files */}}
|
||||||
{.repeated section Groups}
|
{{end}}{{end}}{{/* .Others */}}{{end}}{{/* .Hit */}}{{/*
|
||||||
{.repeated section Infos}
|
|
||||||
{File.Path|url-src}:{@|infoLine}
|
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
|
|
||||||
{.end}
|
---------------------------------------
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
{.section Textual}
|
|
||||||
{.section Complete}
|
|
||||||
{Found} TEXTUAL OCCURRENCES
|
|
||||||
{.or}
|
|
||||||
MORE THAN {Found} TEXTUAL OCCURRENCES
|
|
||||||
{.end}
|
|
||||||
|
|
||||||
{.repeated section @}
|
*/}}{{if .Textual}}{{if .Complete}}{{.Found}} TEXTUAL OCCURRENCES{{else}}MORE THAN {{.Found}} TEXTUAL OCCURRENCES{{end}}
|
||||||
{Lines|numlines} {Filename|url-src}
|
|
||||||
{.end}
|
{{range .Textual}}{{.Lines|numlines}} {{.Filename|url_src}}
|
||||||
{.section Complete}
|
{{end}}{{if not .Complete}}... ...
|
||||||
{.or}
|
{{end}}{{end}}
|
||||||
... ...
|
|
||||||
{.end}
|
|
||||||
{.end}
|
|
||||||
|
@ -14,6 +14,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"container/vector"
|
"container/vector"
|
||||||
|
"exp/template"
|
||||||
"fmt"
|
"fmt"
|
||||||
"http"
|
"http"
|
||||||
"io"
|
"io"
|
||||||
@ -23,7 +24,6 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"template"
|
|
||||||
"utf8"
|
"utf8"
|
||||||
"xml"
|
"xml"
|
||||||
)
|
)
|
||||||
|
@ -11,13 +11,13 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"exp/template"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go/scanner"
|
"go/scanner"
|
||||||
"go/token"
|
"go/token"
|
||||||
"io"
|
"io"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"template"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -6,6 +6,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"exp/template"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go/ast"
|
"go/ast"
|
||||||
@ -23,7 +24,6 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"template"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -481,16 +481,16 @@ func urlFmt(w io.Writer, format string, x ...interface{}) {
|
|||||||
// and assume the url-pkg format instead
|
// and assume the url-pkg format instead
|
||||||
log.Printf("INTERNAL ERROR: urlFmt(%s)", format)
|
log.Printf("INTERNAL ERROR: urlFmt(%s)", format)
|
||||||
fallthrough
|
fallthrough
|
||||||
case "url-pkg":
|
case "url_pkg":
|
||||||
// because of the irregular mapping under goroot
|
// because of the irregular mapping under goroot
|
||||||
// we need to correct certain relative paths
|
// we need to correct certain relative paths
|
||||||
if strings.HasPrefix(relpath, "src/pkg/") {
|
if strings.HasPrefix(relpath, "src/pkg/") {
|
||||||
relpath = relpath[len("src/pkg/"):]
|
relpath = relpath[len("src/pkg/"):]
|
||||||
}
|
}
|
||||||
template.HTMLEscape(w, []byte(pkgHandler.pattern[1:]+relpath)) // remove trailing '/' for relative URL
|
template.HTMLEscape(w, []byte(pkgHandler.pattern[1:]+relpath)) // remove trailing '/' for relative URL
|
||||||
case "url-src":
|
case "url_src":
|
||||||
template.HTMLEscape(w, []byte(relpath))
|
template.HTMLEscape(w, []byte(relpath))
|
||||||
case "url-pos":
|
case "url_pos":
|
||||||
template.HTMLEscape(w, []byte(relpath))
|
template.HTMLEscape(w, []byte(relpath))
|
||||||
// selection ranges are of form "s=low:high"
|
// selection ranges are of form "s=low:high"
|
||||||
if low < high {
|
if low < high {
|
||||||
@ -600,14 +600,32 @@ func numlinesFmt(w io.Writer, format string, x ...interface{}) {
|
|||||||
fmt.Fprintf(w, "%d", len(list))
|
fmt.Fprintf(w, "%d", len(list))
|
||||||
}
|
}
|
||||||
|
|
||||||
var fmap = template.FormatterMap{
|
// TODO(gri): Remove this type once fmtMap2funcMap is gone.
|
||||||
"": textFmt,
|
type FormatterMap map[string]func(io.Writer, string, ...interface{})
|
||||||
"html-esc": htmlEscFmt,
|
|
||||||
"html-comment": htmlCommentFmt,
|
// TODO(gri): Remove the need for this conversion function by rewriting
|
||||||
"urlquery-esc": urlQueryEscFmt,
|
// the old template formatters into new template functions.
|
||||||
"url-pkg": urlFmt,
|
func fmtMap2funcMap(fmtMap FormatterMap) template.FuncMap {
|
||||||
"url-src": urlFmt,
|
funcMap := make(template.FuncMap)
|
||||||
"url-pos": urlFmt,
|
for n, f := range fmtMap {
|
||||||
|
name, fmt := n, f // separate instance of name, fmt for each closure!
|
||||||
|
funcMap[name] = func(args ...interface{}) string {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
fmt(&buf, name, args...)
|
||||||
|
return buf.String()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return funcMap
|
||||||
|
}
|
||||||
|
|
||||||
|
var fmap = fmtMap2funcMap(FormatterMap{
|
||||||
|
"text": textFmt,
|
||||||
|
"html_esc": htmlEscFmt,
|
||||||
|
"html_comment": htmlCommentFmt,
|
||||||
|
"urlquery_esc": urlQueryEscFmt,
|
||||||
|
"url_pkg": urlFmt,
|
||||||
|
"url_src": urlFmt,
|
||||||
|
"url_pos": urlFmt,
|
||||||
"infoKind": infoKindFmt,
|
"infoKind": infoKindFmt,
|
||||||
"infoLine": infoLineFmt,
|
"infoLine": infoLineFmt,
|
||||||
"infoSnippet": infoSnippetFmt,
|
"infoSnippet": infoSnippetFmt,
|
||||||
@ -617,7 +635,7 @@ var fmap = template.FormatterMap{
|
|||||||
"fileInfoTime": fileInfoTimeFmt,
|
"fileInfoTime": fileInfoTimeFmt,
|
||||||
"localname": localnameFmt,
|
"localname": localnameFmt,
|
||||||
"numlines": numlinesFmt,
|
"numlines": numlinesFmt,
|
||||||
}
|
})
|
||||||
|
|
||||||
func readTemplate(name string) *template.Template {
|
func readTemplate(name string) *template.Template {
|
||||||
path := filepath.Join(*goroot, "lib", "godoc", name)
|
path := filepath.Join(*goroot, "lib", "godoc", name)
|
||||||
@ -629,15 +647,7 @@ func readTemplate(name string) *template.Template {
|
|||||||
path = defaultpath
|
path = defaultpath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data, err := fs.ReadFile(path)
|
return template.Must(template.New(name).Funcs(fmap).ParseFile(path))
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("ReadFile %s: %v", path, err)
|
|
||||||
}
|
|
||||||
t, err := template.Parse(string(data), fmap)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("%s: %v", name, err)
|
|
||||||
}
|
|
||||||
return t
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Loading…
Reference in New Issue
Block a user