aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2011-09-08 15:35:56 -0700
committerRobert Griesemer <gri@golang.org>2011-09-08 15:35:56 -0700
commit041dc0a1c2ee8e34fb5e34f4b5fd3e2734889bf2 (patch)
treed0ac93856a2407335680967d907694e04285cad2 /lib
parent4670d9e6349119914c9a5a1b40ce32045f3c0061 (diff)
downloadgo-041dc0a1c2ee8e34fb5e34f4b5fd3e2734889bf2.tar.xz
godoc: show packages matching a query at the top
Also: fix layout of textual search results and fix a field reference in the respective template. Fixes #1987. R=rsc, r CC=golang-dev https://golang.org/cl/4962061
Diffstat (limited to 'lib')
-rw-r--r--lib/godoc/search.html11
-rw-r--r--lib/godoc/search.txt28
2 files changed, 28 insertions, 11 deletions
diff --git a/lib/godoc/search.html b/lib/godoc/search.html
index 9fdd6ddc37..db90935d8a 100644
--- a/lib/godoc/search.html
+++ b/lib/godoc/search.html
@@ -17,6 +17,17 @@
{{end}}
</p>
{{end}}
+{{with .Pak}}
+ <h2 id="Packages">Package {{html $.Query}}</h2>
+ <p>
+ <table class="layout">
+ {{range .}}
+ {{$pkg_html := pkgLink .Pak.Path | html}}
+ <tr><td><a href="/{{$pkg_html}}">{{$pkg_html}}</a></td></tr>
+ {{end}}
+ </table>
+ </p>
+{{end}}
{{with .Hit}}
{{with .Decls}}
<h2 id="Global">Package-level declarations</h2>
diff --git a/lib/godoc/search.txt b/lib/godoc/search.txt
index 1dd64afdb5..3e261d0f04 100644
--- a/lib/godoc/search.txt
+++ b/lib/godoc/search.txt
@@ -1,33 +1,39 @@
QUERY
{{.Query}}
-{{with .Alert}}
-{{.}}
+
+{{with .Alert}}{{.}}
{{end}}{{/* .Alert */}}{{/*
---------------------------------------
-*/}}{{with .Alt}}
-DID YOU MEAN
+*/}}{{with .Alt}}DID YOU MEAN
+
{{range .Alts}} {{.}}
-{{end}}{{end}}{{/* .Alts */}}{{/*
+{{end}}{{end}}{{/* .Alt */}}{{/*
+
+---------------------------------------
+
+*/}}{{with .Pak}}PACKAGE {{$.Query}}
+
+{{range .}}{{.Pak.Path}}
+{{end}}
+{{end}}{{/* .Pak */}}{{/*
---------------------------------------
-*/}}{{with .Hit}}{{with .Decls}}
-PACKAGE-LEVEL DECLARATIONS
+*/}}{{with .Hit}}{{with .Decls}}PACKAGE-LEVEL DECLARATIONS
{{range .}}package {{.Pak.Name}}
-{{range $file := .Files}}{{range .Groups}}{{range .Infos}} {{srcLink $file.File.Path}}:{{infoLine .}}{{end}}
+{{range $file := .Files}}{{range .Groups}}{{range .}} {{srcLink $file.File.Path}}:{{infoLine .}}{{end}}
{{end}}{{end}}{{/* .Files */}}
{{end}}{{end}}{{/* .Decls */}}{{/*
---------------------------------------
-*/}}{{with .Others}}
-LOCAL DECLARATIONS AND USES
+*/}}{{with .Others}}LOCAL DECLARATIONS AND USES
{{range .}}package {{.Pak.Name}}
-{{range $file := .Files}}{{range .Groups}}{{range .Infos}} {{srcLink $file.File.Path}}:{{infoLine .}}
+{{range $file := .Files}}{{range .Groups}}{{range .}} {{srcLink $file.File.Path}}:{{infoLine .}}
{{end}}{{end}}{{end}}{{/* .Files */}}
{{end}}{{end}}{{/* .Others */}}{{end}}{{/* .Hit */}}{{/*