aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2011-08-11 13:24:13 -0700
committerRobert Griesemer <gri@golang.org>2011-08-11 13:24:13 -0700
commit2e394c51d9453c2f94c19f444e2f056ba50a22af (patch)
treeabcc161fd32534004e710fbcd4e24eff6bfb9aef /lib
parentbca65e395e1786f321266da81fb3ed46f5d4e854 (diff)
downloadgo-2e394c51d9453c2f94c19f444e2f056ba50a22af.tar.xz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/godoc/codewalk.html24
-rw-r--r--lib/godoc/codewalkdir.html8
-rw-r--r--lib/godoc/dirlist.html11
-rw-r--r--lib/godoc/error.html2
-rw-r--r--lib/godoc/godoc.html48
-rw-r--r--lib/godoc/package.html169
-rw-r--r--lib/godoc/package.txt139
-rw-r--r--lib/godoc/search.html116
-rw-r--r--lib/godoc/search.txt76
9 files changed, 283 insertions, 310 deletions
diff --git a/lib/godoc/codewalk.html b/lib/godoc/codewalk.html
index 47f8a22e2b..64d2d32253 100644
--- a/lib/godoc/codewalk.html
+++ b/lib/godoc/codewalk.html
@@ -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;"/>
</a>
<select id="code-selector">
- {.repeated section File}
- <option value="/doc/codewalk/?fileprint=/{@|html-esc}">{@|html-esc}</option>
- {.end}
+ {{range .File}}
+ <option value="/doc/codewalk/?fileprint=/{{.|urlquery_esc}}">{{.|html_esc}}</option>
+ {{end}}
</select>
</div>
<div id="code">
@@ -35,19 +35,19 @@
</div>
<div class="right" id="comment-column">
<div id="comment-area">
- {.repeated section Step}
+ {{range .Step}}
<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>
- <div class="comment-title">{Title|html-esc}</div>
+ <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-text">
- {.section Err}
- ERROR LOADING FILE: {Err|html-esc}<br/><br/>
- {.end}
- {XML}
+ {{with .Err}}
+ ERROR LOADING FILE: {{.|html_esc}}<br/><br/>
+ {{end}}
+ {{.XML}}
</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>
- {.end}
+ {{end}}
</div>
<div id="comment-options" class="setting">
<a id="prev-comment" href="#"><span class="hotkey">p</span>revious step</a>
diff --git a/lib/godoc/codewalkdir.html b/lib/godoc/codewalkdir.html
index 61a9a8b3b4..ebfc19aa6b 100644
--- a/lib/godoc/codewalkdir.html
+++ b/lib/godoc/codewalkdir.html
@@ -5,11 +5,11 @@
-->
<table class="layout">
-{.repeated section @}
+{{range .}}
<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">&nbsp;</td>
- <td>{Title|html-esc}</td>
+ <td>{{.Title|html_esc}}</td>
</tr>
-{.end}
+{{end}}
</table>
diff --git a/lib/godoc/dirlist.html b/lib/godoc/dirlist.html
index 29b4b24357..7e7d4e7f29 100644
--- a/lib/godoc/dirlist.html
+++ b/lib/godoc/dirlist.html
@@ -16,14 +16,15 @@
<tr>
<td><a href="..">..</a></td>
</tr>
-{.repeated section @}
+{{range .}}
<tr>
- <td align="left"><a href="{@|fileInfoName}">{@|fileInfoName}</a></td>
+ <td align="left"><a href="{{.|fileInfoName}}">{{.|fileInfoName}}</a></td>
<td></td>
- <td align="right">{@|fileInfoSize}</td>
+ <td align="right">{{.|fileInfoSize}}</td>
<td></td>
- <td align="left">{@|fileInfoTime}</td>
+ <td align="left">{{.|fileInfoTime}}</td>
</tr>
-{.end}
+{{end}}
+
</table>
</p>
diff --git a/lib/godoc/error.html b/lib/godoc/error.html
index c14c574057..d349f754fd 100644
--- a/lib/godoc/error.html
+++ b/lib/godoc/error.html
@@ -5,5 +5,5 @@
-->
<p>
-<span class="alert" style="font-size:120%">{@|html-esc}</span>
+<span class="alert" style="font-size:120%">{{.|html_esc}}</span>
</p>
diff --git a/lib/godoc/godoc.html b/lib/godoc/godoc.html
index bd53f2615e..37db860b20 100644
--- a/lib/godoc/godoc.html
+++ b/lib/godoc/godoc.html
@@ -2,11 +2,11 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-{.section Title}
- <title>{@|html-esc} - The Go Programming Language</title>
-{.or}
+{{with .Title}}
+ <title>{{.|html_esc}} - The Go Programming Language</title>
+{{else}}
<title>The Go Programming Language</title>
-{.end}
+{{end}}
<link rel="stylesheet" href="/doc/all.css" type="text/css" media="all" charset="utf-8">
<!--[if lt IE 8]>
<link rel="stylesheet" href="/doc/ie.css" type="text/css">
@@ -23,19 +23,19 @@
</ul>
<div class="quickref">
<form method="GET" action="/search">
- {.section PkgRoots}
- {.repeated section PkgRoots}
- <a href="/pkg/{@|html-esc}">{@|html-esc}</a> <span class="sep">|</span>
- {.end}
- {.or}
+ {{with .PkgRoots}}
+ {{range .PkgRoots}}
+ <a href="/pkg/{{.|html_esc}}">{{.|html_esc}}</a> <span class="sep">|</span>
+ {{end}}
+ {{else}}
References:
- {.end}
+ {{end}}
<a href="/pkg/">Packages</a> <span class="sep">|</span>
<a href="/cmd/">Commands</a> <span class="sep">|</span>
<a href="/doc/go_spec.html">Specification</a>
- {.section 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" />
- {.end}
+ {{if .SearchBox}}
+ <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}}
</form>
</div>
</div>
@@ -43,28 +43,28 @@
</div>
<div id="content">
<!-- Menu is HTML-escaped elsewhere -->
- {.section Menu}
+ {{with .Menu}}
<div id="menu">
- {@}
+ {{printf "%s" .}}
</div>
- {.end}
+ {{end}}
- {.section Title}
- <h1 id="generatedHeader">{@|html-esc}</h1>
- {.end}
- {.section Subtitle}
- <span class="subtitle">{@|html-esc}</span>
- {.end}
+ {{with .Title}}
+ <h1 id="generatedHeader">{{.|html_esc}}</h1>
+ {{end}}
+ {{with .Subtitle}}
+ <span class="subtitle">{{.|html_esc}}</span>
+ {{end}}
<!-- The Table of Contents is automatically inserted in this <div>.
Do not delete this <div>. -->
<div id="nav"></div>
<!-- Content is HTML-escaped elsewhere -->
- {Content}
+ {{printf "%s" .Content}}
</div>
<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>
</body>
diff --git a/lib/godoc/package.html b/lib/godoc/package.html
index cb3ffa2a75..5a7438b017 100644
--- a/lib/godoc/package.html
+++ b/lib/godoc/package.html
@@ -3,119 +3,120 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
-
-{.section PAst}
- <pre>{@ FSet|html-esc}</pre>
-{.end}
-{.section PDoc}
+{{$FSet := .FSet}}
+{{$Info := .}}
+{{with .PAst}}
+ <pre>{{html_esc . $FSet}}</pre>
+{{end}}
+{{with .PDoc}}
<!-- PackageName is printed as title by the top-level template -->
- {.section IsPkg}
- {# ImportPath is a string - no need for FSet}
- <p><code>import "{ImportPath|html-esc}"</code></p>
- {.end}
- {Doc|html-comment}
- {.section IsPkg}
- {.section Filenames}
- {# Filenames are strings - no need for FSet}
+ {{if $Info.IsPkg}}
+ {{/* ImportPath is a string - no need for FSet */}}
+ <p><code>import "{{.ImportPath|html_esc}}"</code></p>
+ {{end}}
+ {{.Doc|html_comment}}
+ {{if $Info.IsPkg}}
+ {{with .Filenames}}
+ {{/* Filenames are strings - no need for FSet */}}
<p>
<h4>Package files</h4>
<span style="font-size:90%">
- {.repeated section @}
- <a href="/{@|url-src}">{@|localname}</a>
- {.end}
+ {{range .}}
+ <a href="/{{.|url_src}}">{{.|localname}}</a>
+ {{end}}
</span>
</p>
- {.end}
- {.end}
- {.section Consts}
+ {{end}}
+ {{end}}
+ {{with .Consts}}
<h2 id="Constants">Constants</h2>
- {.repeated section @}
- {Doc|html-comment}
- <pre>{Decl FSet|html-esc}</pre>
- {.end}
- {.end}
- {.section Vars}
+ {{range .}}
+ {{html_comment .Doc}}
+ <pre>{{html_esc .Decl $FSet}}</pre>
+ {{end}}
+ {{end}}
+ {{with .Vars}}
<h2 id="Variables">Variables</h2>
- {.repeated section @}
- {Doc|html-comment}
- <pre>{Decl FSet|html-esc}</pre>
- {.end}
- {.end}
- {.section Funcs}
- {.repeated section @}
- {# 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>
- <p><code>{Decl FSet|html-esc}</code></p>
- {Doc|html-comment}
- {.end}
- {.end}
- {.section Types}
- {.repeated section @}
- <h2 id="{Type.Name FSet|html-esc}">type <a href="/{Decl FSet|url-pos}">{Type.Name FSet|html-esc}</a></h2>
- {Doc|html-comment}
- <p><pre>{Decl FSet|html-esc}</pre></p>
- {.repeated section Consts}
- {Doc|html-comment}
- <pre>{Decl FSet|html-esc}</pre>
- {.end}
- {.repeated section Vars}
- {Doc|html-comment}
- <pre>{Decl FSet|html-esc}</pre>
- {.end}
- {.repeated section Factories}
- <h3 id="{Type.Name FSet|html-esc}.{Name|html-esc}">func <a href="/{Decl FSet|url-pos}">{Name|html-esc}</a></h3>
- <p><code>{Decl FSet|html-esc}</code></p>
- {Doc|html-comment}
- {.end}
- {.repeated section 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>
- <p><code>{Decl FSet|html-esc}</code></p>
- {Doc|html-comment}
- {.end}
- {.end}
- {.end}
- {.section Bugs}
+ {{range .}}
+ {{html_comment .Doc}}
+ <pre>{{html_esc .Decl $FSet}}</pre>
+ {{end}}
+ {{end}}
+ {{with .Funcs}}
+ {{range .}}
+ {{/* Name is a string - no need for FSet */}}
+ <h2 id="{{.Name|html_esc}}">func <a href="/{{url_pos .Decl $FSet}}">{{.Name|html_esc}}</a></h2>
+ <p><code>{{html_esc .Decl $FSet}}</code></p>
+ {{.Doc|html_comment}}
+ {{end}}
+ {{end}}
+ {{with .Types}}
+ {{range $type := .}}
+ <h2 id="{{html_esc .Type.Name $FSet}}">type <a href="/{{url_pos .Decl $FSet}}">{{html_esc .Type.Name $FSet}}</a></h2>
+ {{.Doc|html_comment}}
+ <p><pre>{{html_esc .Decl $FSet}}</pre></p>
+ {{range .Consts}}
+ {{.Doc|html_comment}}
+ <pre>{{html_esc .Decl $FSet}}</pre>
+ {{end}}
+ {{range .Vars}}
+ {{.Doc|html_comment}}
+ <pre>{{html_esc .Decl $FSet}}</pre>
+ {{end}}
+ {{range .Factories}}
+ <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>{{html_esc .Decl $FSet}}</code></p>
+ {{.Doc|html_comment}}
+ {{end}}
+ {{range .Methods}}
+ <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>{{html_esc .Decl $FSet}}</code></p>
+ {{.Doc|html_comment}}
+ {{end}}
+ {{end}}
+ {{end}}
+ {{with .Bugs}}
<h2 id="Bugs">Bugs</h2>
- {.repeated section @}
- {@|html-comment}
- {.end}
- {.end}
-{.end}
-{.section PList}
+ {{range .}}
+ {{.|html_comment}}
+ {{end}}
+ {{end}}
+{{end}}
+{{with .PList}}
<h2>Other packages</h2>
<p>
- {# PLIst entries are strings - no need for FSet}
- {.repeated section @}
- <a href="?p={@|html-esc}">{@|html-esc}</a><br />
- {.end}
+ {{/* PList entries are strings - no need for FSet */}}
+ {{range .}}
+ <a href="?p={{html .}}">{{html .}}</a><br />
+ {{end}}
</p>
-{.end}
-{.section Dirs}
+{{end}}
+{{with .Dirs}}
<p class="detail">
Need more packages? The
<a href="http://godashboard.appspot.com/package">Package Dashboard</a>
provides a list of <a href="/cmd/goinstall/">goinstallable</a> packages.
</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>
<p>
<table class="layout">
<tr>
- <th align="left" colspan="{MaxHeight|html-esc}">Name</th>
+ <th align="left" colspan="{{.MaxHeight|html_esc}}">Name</th>
<td width="25">&nbsp;</td>
<th align="left">Synopsis</th>
</tr>
<tr>
<th align="left"><a href="..">..</a></th>
</tr>
- {.repeated section List}
+ {{range .List}}
<tr>
- {Depth|padding}
- <td align="left" colspan="{Height|html-esc}"><a href="{Path|html-esc}">{Name|html-esc}</a></td>
+ {{.Depth|padding}}
+ <td align="left" colspan="{{html .Height}}"><a href="{{html .Path}}">{{html .Name}}</a></td>
<td></td>
- <td align="left">{Synopsis|html-esc}</td>
+ <td align="left">{{html .Synopsis}}</td>
</tr>
- {.end}
+ {{end}}
</table>
</p>
-{.end}
+{{end}}
diff --git a/lib/godoc/package.txt b/lib/godoc/package.txt
index 6fe992dbe4..24806661ac 100644
--- a/lib/godoc/package.txt
+++ b/lib/godoc/package.txt
@@ -1,95 +1,90 @@
-{.section PAst}
-{@ FSet}
-{.end}
-{.section PDoc}
-{.section IsPkg}
-PACKAGE
+{{$FSet := .FSet}}{{$Info := .}}{{/*
-package {PackageName}
-import "{ImportPath}"
-{.or}
-COMMAND DOCUMENTATION
-{.end}
-{.section Doc}
+---------------------------------------
-{@ FSet}
-{.end}
-{.section Consts}
+*/}}{{with .PAst}}{{text . $FSet}}{{end}}{{/*
+---------------------------------------
+
+*/}}{{with .PDoc}}{{if $Info.IsPkg}}PACKAGE
+
+package {{.PackageName}}
+import "{{.ImportPath}}"
+
+{{else}}COMMAND DOCUMENTATION
+{{end}}{{/*
+
+---------------------------------------
+
+*/}}{{with .Doc}}{{text . $FSet}}
+{{end}}{{/*
+
+---------------------------------------
+
+*/}}{{with .Consts}}
CONSTANTS
-{.repeated section @}
-{Decl FSet}
-{Doc}
-{.end}
-{.end}
-{.section Vars}
+{{range .}}{{text .Decl $FSet}}
+{{.Doc}}{{end}}
+{{end}}{{/*
+---------------------------------------
+
+*/}}{{with .Vars}}
VARIABLES
-{.repeated section @}
-{Decl FSet}
-{Doc}
-{.end}
-{.end}
-{.section Funcs}
+{{range .}}{{.Decl $FSet}}
+{{.Doc}}{{end}}
+{{end}}{{/*
+
+---------------------------------------
+*/}}{{with .Funcs}}
FUNCTIONS
-{.repeated section @}
-{Decl FSet}
-{Doc}
-{.end}
-{.end}
-{.section Types}
+{{range .}}{{text .Decl $FSet}}
+{{.Doc}}
+{{end}}{{end}}{{/*
+
+---------------------------------------
+*/}}{{with .Types}}
TYPES
-{.repeated section @}
-{Decl FSet}
-{Doc}
-{.repeated section Consts}
-{Decl FSet}
-{Doc}
-{.end}
-{.repeated section Vars}
-{Decl FSet}
-{Doc}
-{.end}
-{.repeated section Factories}
-{Decl FSet}
-{Doc}
-{.end}
-{.repeated section Methods}
-{Decl FSet}
-{Doc}
-{.end}
-{.end}
-{.end}
-{.section Bugs}
+{{range .}}{{text .Decl $FSet}}
+{{.Doc}}
+{{range .Consts}}{{text .Decl $FSet}}
+{{.Doc}}
+{{end}}{{range .Vars}}{{text .Decl $FSet}}
+{{.Doc}}
+{{end}}{{range .Factories}}{{text .Decl $FSet}}
+{{.Doc}}
+{{end}}{{range .Methods}}{{text .Decl $FSet}}
+{{.Doc}}
+{{end}}{{end}}{{end}}{{/*
+---------------------------------------
+
+*/}}{{with .Bugs}}
BUGS
-{.repeated section @}
-{@}
-{.end}
-{.end}
-{.end}
-{.section PList}
+{{range .}}{{.}}
+{{end}}{{end}}{{end}}{{/*
+
+---------------------------------------
+*/}}{{with .PList}}
OTHER PACKAGES
-{.repeated section @}
-{@}
-{.end}
-{.end}
-{.section Dirs}
-{.section Dirs}
+{{range .}}
+{{.}}{{end}}
+{{end}}{{/*
+
+---------------------------------------
+*/}}{{with .Dirs}}
SUBDIRECTORIES
-{.repeated section List}
- {Name}
-{.end}
-{.end}
-{.end}
+{{range .List}}
+ {{.Name}}{{end}}
+{{end}}
diff --git a/lib/godoc/search.html b/lib/godoc/search.html
index 58a933fef0..94acb837b2 100644
--- a/lib/godoc/search.html
+++ b/lib/godoc/search.html
@@ -3,93 +3,91 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
-
-{.section Alert}
+{{$SearchResult := .}}
+{{with .Alert}}
<p>
- <span class="alert" style="font-size:120%">{@}</span>
+ <span class="alert" style="font-size:120%">{{.}}</span>
</p>
-{.end}
-{.section Alt}
+{{end}}
+{{with .Alt}}
<p>
<span class="alert" style="font-size:120%">Did you mean: </span>
- {.repeated section Alts}
- <a href="search?q={@|html-esc}" style="font-size:120%">{@|html-esc}</a>
- {.end}
+ {{range .Alts}}
+ <a href="search?q={{.|urlquery_esc}}" style="font-size:120%">{{.|html_esc}}</a>
+ {{end}}
</p>
-{.end}
-{.section Hit}
- {.section Decls}
+{{end}}
+{{with .Hit}}
+ {{with .Decls}}
<h2 id="Global">Package-level declarations</h2>
- {.repeated section @}
- <h3 id="Global_{Pak.Path|url-pkg}">package <a href="/{Pak.Path|url-pkg}">{Pak.Name|html-esc}</a></h3>
- {.repeated section Files}
- {.repeated section Groups}
- {.repeated section Infos}
- <a href="/{File.Path|url-src}?h={Query|urlquery-esc}#L{@|infoLine}">{File.Path|url-src}:{@|infoLine}</a>
- {@|infoSnippet}
- {.end}
- {.end}
- {.end}
- {.end}
- {.end}
- {.section Others}
+ {{range .}}
+ <h3 id="Global_{{.Pak.Path|url_pkg}}">package <a href="/{{.Pak.Path|url_pkg}}">{{.Pak.Name|html_esc}}</a></h3>
+ {{range $File := .Files}}
+ {{range .Groups}}
+ {{range .Infos}}
+ <a href="/{{$File.File.Path|url_src}}?h={{$SearchResult.Query|urlquery_esc}}#L{{.|infoLine}}">{{$File.File.Path|url_src}}:{{.|infoLine}}</a>
+ {{.|infoSnippet}}
+ {{end}}
+ {{end}}
+ {{end}}
+ {{end}}
+ {{end}}
+ {{with .Others}}
<h2 id="Local">Local declarations and uses</h2>
- {.repeated section @}
- <h3 id="Local_{Pak.Path|url-pkg}">package <a href="/{Pak.Path|url-pkg}">{Pak.Name|html-esc}</a></h3>
- {.repeated section Files}
- <a href="/{File.Path|url-src}?h={Query|urlquery-esc}">{File.Path|url-src}</a>
+ {{range .}}
+ <h3 id="Local_{{.Pak.Path|url_pkg}}">package <a href="/{{.Pak.Path|url_pkg}}">{{.Pak.Name|html_esc}}</a></h3>
+ {{range $File := .Files}}
+ <a href="/{{.File.Path|url_src}}?h={{$SearchResult.Query|urlquery_esc}}">{{.File.Path|url_src}}</a>
<table class="layout">
- {.repeated section Groups}
+ {{range .Groups}}
<tr>
<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>
- {.repeated section Infos}
- <a href="/{File.Path|url-src}?h={Query|urlquery-esc}#L{@|infoLine}">{@|infoLine}</a>
- {.end}
+ {{range .Infos}}
+ <a href="/{{$File.File.Path|url_src}}?h={{$SearchResult.Query|urlquery_esc}}#L{{.|infoLine}}">{{.|infoLine}}</a>
+ {{end}}
</td>
</tr>
- {.end}
+ {{end}}
</table>
- {.end}
- {.end}
- {.end}
-{.end}
-{.section Textual}
- {.section Complete}
- <h2 id="Textual">{Found|html-esc} textual occurrences</h2>
- {.or}
- <h2 id="Textual">More than {Found|html-esc} textual occurrences</h2>
+ {{end}}
+ {{end}}
+ {{end}}
+{{end}}
+{{with .Textual}}
+ {{if $SearchResult.Complete}}
+ <h2 id="Textual">{{$SearchResult.Found|html_esc}} textual occurrences</h2>
+ {{else}}
+ <h2 id="Textual">More than {{$SearchResult.Found|html_esc}} textual occurrences</h2>
<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>
- {.end}
+ {{end}}
<p>
<table class="layout">
- {.repeated section @}
+ {{range $File := .}}
<tr>
<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 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">
- {.repeated section Lines}
- <a href="/{Filename|url-src}?h={Query|urlquery-esc}#L{@|html-esc}">{@|html-esc}</a>
- {.end}
- {.section Complete}
- {.or}
+ {{range .Lines}}
+ <a href="/{{$File.Filename|url_src}}?h={{$SearchResult.Query|urlquery_esc}}#L{{.|html_esc}}">{{.|html_esc}}</a>
+ {{end}}
+ {{if not $SearchResult.Complete}}
...
- {.end}
+ {{end}}
</td>
</tr>
- {.end}
- {.section Complete}
- {.or}
+ {{end}}
+ {{if not $SearchResult.Complete}}
<tr><td align="left">...</td></tr>
- {.end}
+ {{end}}
</table>
</p>
-{.end}
+{{end}}
diff --git a/lib/godoc/search.txt b/lib/godoc/search.txt
index 967c1ac015..81318cb641 100644
--- a/lib/godoc/search.txt
+++ b/lib/godoc/search.txt
@@ -1,61 +1,39 @@
QUERY
- {Query}
+ {{.Query}}
+{{with .Alert}}
+{{.}}
+{{end}}{{/* .Alert */}}{{/*
-{.section Alert}
-{@}
+---------------------------------------
-{.end}
-{.section Alt}
+*/}}{{with .Alt}}
DID YOU MEAN
-{.repeated section Alts}
- {@}
-{.end}
+{{range .Alts}} {{.}}
+{{end}}{{end}}{{/* .Alts */}}{{/*
-{.end}
-{.section Hit}
-{.section Decls}
+---------------------------------------
+
+*/}}{{with .Hit}}{{with .Decls}}
PACKAGE-LEVEL DECLARATIONS
-{.repeated section @}
-package {Pak.Name}
-{.repeated section Files}
-{.repeated section Groups}
-{.repeated section Infos}
- {File.Path|url-src}:{@|infoLine}
-{.end}
-{.end}
-{.end}
+{{range .}}package {{.Pak.Name}}
+{{range $File := .Files}}{{range .Groups}}{{range .Infos}} {{$File.File.Path|url_src}}:{{.|infoLine}}{{end}}
+{{end}}{{end}}{{/* .Files */}}{{end}}{{end}}{{/* .Decls */}}{{/*
+
+---------------------------------------
-{.end}
-{.end}
-{.section Others}
+*/}}{{with .Others}}
LOCAL DECLARATIONS AND USES
-{.repeated section @}
-package {Pak.Name}
-{.repeated section Files}
-{.repeated section Groups}
-{.repeated section Infos}
- {File.Path|url-src}:{@|infoLine}
-{.end}
-{.end}
-{.end}
+{{range .}}package {{.Pak.Name}}
+{{range $File := .Files}}{{range .Groups}}{{range .Infos}} {{$File.File.Path|url_src}}:{{.|infoLine}}
+{{end}}{{end}}{{end}}{{/* .Files */}}
+{{end}}{{end}}{{/* .Others */}}{{end}}{{/* .Hit */}}{{/*
+
+---------------------------------------
-{.end}
-{.end}
-{.end}
-{.section Textual}
-{.section Complete}
-{Found} TEXTUAL OCCURRENCES
-{.or}
-MORE THAN {Found} TEXTUAL OCCURRENCES
-{.end}
+*/}}{{if .Textual}}{{if .Complete}}{{.Found}} TEXTUAL OCCURRENCES{{else}}MORE THAN {{.Found}} TEXTUAL OCCURRENCES{{end}}
-{.repeated section @}
-{Lines|numlines} {Filename|url-src}
-{.end}
-{.section Complete}
-{.or}
-... ...
-{.end}
-{.end}
+{{range .Textual}}{{.Lines|numlines}} {{.Filename|url_src}}
+{{end}}{{if not .Complete}}... ...
+{{end}}{{end}}