summaryrefslogtreecommitdiff
path: root/src/cmd/godoc/spec.go
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
commit09440a8f82a273253956168bd017db01160a4f1e (patch)
tree6b657b20e8236068ef37bc55450a97dccfcec153 /src/cmd/godoc/spec.go
parent94ad282e94e38e9394b031edbc30605f9331d033 (diff)
downloadgolang-09440a8f82a273253956168bd017db01160a4f1e.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 'src/cmd/godoc/spec.go')
-rw-r--r--src/cmd/godoc/spec.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/cmd/godoc/spec.go b/src/cmd/godoc/spec.go
index e94219517..ee9ff4e04 100644
--- a/src/cmd/godoc/spec.go
+++ b/src/cmd/godoc/spec.go
@@ -49,7 +49,7 @@ func (p *ebnfParser) next() {
func (p *ebnfParser) Error(pos token.Position, msg string) {
- fmt.Fprintf(p.out, "<font color=red>error: %s</font>", msg);
+ fmt.Fprintf(p.out, `<span class="alert">error: %s</span>`, msg);
}
@@ -83,7 +83,7 @@ func (p *ebnfParser) parseIdentifier(def bool) {
if def {
fmt.Fprintf(p.out, `<a id="%s">%s</a>`, name, name);
} else {
- fmt.Fprintf(p.out, `<a href="#%s" style="text-decoration: none;">%s</a>`, name, name);
+ fmt.Fprintf(p.out, `<a href="#%s" class="noline">%s</a>`, name, name);
}
p.prev += len(name); // skip identifier when calling flush
}
@@ -165,8 +165,8 @@ func (p *ebnfParser) parse(out io.Writer, src []byte) {
// Markers around EBNF sections
var (
- open = strings.Bytes(`<pre class="ebnf">`);
- close = strings.Bytes(`</pre>`);
+ openTag = strings.Bytes(`<pre class="ebnf">`);
+ closeTag = strings.Bytes(`</pre>`);
)
@@ -175,14 +175,14 @@ func linkify(out io.Writer, src []byte) {
n := len(src);
// i: beginning of EBNF text (or end of source)
- i := bytes.Index(src, open);
+ i := bytes.Index(src, openTag);
if i < 0 {
- i = n-len(open);
+ i = n-len(openTag);
}
- i += len(open);
+ i += len(openTag);
// j: end of EBNF text (or end of source)
- j := bytes.Index(src[i:n], close); // close marker
+ j := bytes.Index(src[i:n], closeTag); // close marker
if j < 0 {
j = n-i;
}