1
0
mirror of https://github.com/golang/go synced 2024-11-22 09:44:40 -07:00
go/lib/godoc/search.html
Robert Griesemer 2e394c51d9 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
2011-08-11 13:24:13 -07:00

94 lines
2.7 KiB
HTML

<!--
Copyright 2009 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.
-->
{{$SearchResult := .}}
{{with .Alert}}
<p>
<span class="alert" style="font-size:120%">{{.}}</span>
</p>
{{end}}
{{with .Alt}}
<p>
<span class="alert" style="font-size:120%">Did you mean: </span>
{{range .Alts}}
<a href="search?q={{.|urlquery_esc}}" style="font-size:120%">{{.|html_esc}}</a>
{{end}}
</p>
{{end}}
{{with .Hit}}
{{with .Decls}}
<h2 id="Global">Package-level declarations</h2>
{{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>
{{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">
{{range .Groups}}
<tr>
<td width="25"></td>
<th align="left" valign="top">{{.Kind|infoKind}}</th>
<td align="left" width="4"></td>
<td>
{{range .Infos}}
<a href="/{{$File.File.Path|url_src}}?h={{$SearchResult.Query|urlquery_esc}}#L{{.|infoLine}}">{{.|infoLine}}</a>
{{end}}
</td>
</tr>
{{end}}
</table>
{{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 "{{$SearchResult.Query|html_esc}}" are shown.</span>
</p>
{{end}}
<p>
<table class="layout">
{{range $File := .}}
<tr>
<td align="left" valign="top">
<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>
<td align="left" width="4"></td>
<td align="left">
{{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}}
</td>
</tr>
{{end}}
{{if not $SearchResult.Complete}}
<tr><td align="left">...</td></tr>
{{end}}
</table>
</p>
{{end}}