summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-10-27 10:34:31 -0700
committerRobert Griesemer <gri@golang.org>2009-10-27 10:34:31 -0700
commit96351687abcd03009af207a95dbd79e12e75d366 (patch)
tree6b657b20e8236068ef37bc55450a97dccfcec153 /lib
parenta08415db64e4936e4bc2d23c21cdee63650a7100 (diff)
downloadgo-96351687abcd03009af207a95dbd79e12e75d366.tar.gz
code search for godoc:
- added goroutine to automatically index in the background - added handler for search requests - added search box to top-level godoc template - added search.html template for the display of search results - changes to spec.go because of name conflicts - added extra styles to style.css (for shorter .html files) R=rsc http://go/go-review/1014011
Diffstat (limited to 'lib')
-rw-r--r--lib/godoc/godoc.html20
-rw-r--r--lib/godoc/search.html65
2 files changed, 78 insertions, 7 deletions
diff --git a/lib/godoc/godoc.html b/lib/godoc/godoc.html
index ddde999a1..b77a1301b 100644
--- a/lib/godoc/godoc.html
+++ b/lib/godoc/godoc.html
@@ -4,7 +4,7 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
- <title>{title}</title>
+ <title>{Title}</title>
<link rel="stylesheet" type="text/css" href="/doc/style.css">
<script type="text/javascript" src="/doc/godocs.js"></script>
@@ -38,28 +38,34 @@
<li><a href="/doc/go_for_cpp_programmers.html">Go for C++ Programmers</a></li>
<li class="blank">&nbsp;</li>
+ <li class="navhead">How To</li>
+ <li><a href="/doc/install.html">Install Go</a></li>
+ <li><a href="/doc/contribute.html">Contribute code</a></li>
+
+ <li class="blank">&nbsp;</li>
<li class="navhead">Programming</li>
<li><a href="/pkg">Package documentation</a></li>
<li class="blank">&nbsp;</li>
- <li class="navhead">How To</li>
- <li><a href="/doc/install.html">Install Go</a></li>
- <li><a href="/doc/contribute.html">Contribute code</a></li>
+ <li class="navhead">Go code search</li>
+ <form method="GET" action="/search" class="search">
+ <input name="q" value="{Query}" size="25" />
+ <input type="submit" value="Go" />
<li class="blank">&nbsp;</li>
<li class="navhead">Last update</li>
- <li>{timestamp}</li>
+ <li>{Timestamp}</li>
</ul>
</div>
<div id="content">
- <h1>{title}</h1>
+ <h1>{Title}</h1>
<!-- The Table of Contents is automatically inserted in this <div>.
Do not delete this <div>. -->
<div id="nav"></div>
- {content}
+ {Content}
</div>
<div id="footer">
diff --git a/lib/godoc/search.html b/lib/godoc/search.html
new file mode 100644
index 000000000..419a9f8d0
--- /dev/null
+++ b/lib/godoc/search.html
@@ -0,0 +1,65 @@
+<!--
+ 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.
+-->
+
+{.section Accurate}
+{.or}
+ <p>
+ <span class="alert" style="font-size:120%">Indexing in progress - result may be inaccurate</span>
+ </p>
+{.end}
+{.section Alt}
+ <p>
+ <span class="alert" style="font-size:120%">Did you mean: </span>
+ {.repeated section Alts}
+ <a href="search?q={@|html}" style="font-size:120%">{@|html}</a>
+ {.end}
+ </p>
+{.end}
+{.section Hit}
+ {.section Decls}
+ <h2>Package-level declarations</h2>
+ {.repeated section @}
+ <h3>package {Pak.Name|html}</h3>
+ {.repeated section Files}
+ {.repeated section Infos}
+ <a href="{File.Path|html}?h={Query|html}#L{@|infoLine}">{File.Path|html}:{@|infoLine}</a>
+ <pre>{@|infoSnippet}</pre>
+ {.end}
+ {.end}
+ {.end}
+ {.end}
+ {.section Others}
+ <h2>Local declarations and uses</h2>
+ <p>
+ Legend:
+ {.repeated section Legend}
+ <a class="{@}">{@}</a>
+ {.end}
+ </p>
+ {.repeated section @}
+ <h3>package {Pak.Name|html}</h3>
+ <table border="0" cellspacing="2">
+ {.repeated section Files}
+ <tr>
+ <td valign="top">
+ <a href="{File.Path|html}?h={Query|html}" class="noline">{File.Path|html}:</a>
+ </td>
+ <td>
+ {.repeated section Infos}
+ <a href="{File.Path|html}?h={Query|html}#L{@|infoLine}" class="{@|infoClass}">{@|infoLine}</a>
+ {.end}
+ </td>
+ </tr>
+ {.end}
+ </table>
+ {.end}
+ {.end}
+{.or}
+ <p>
+ A legal query is a single identifier (such as <a href="search?q=ToLower">ToLower</a>)
+ or a qualified identifier (such as <a href="search?q=math.Sin">math.Sin</a>).
+ </p>
+{.end}