From 09440a8f82a273253956168bd017db01160a4f1e Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 27 Oct 2009 10:34:31 -0700 Subject: 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 --- src/cmd/godoc/spec.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/cmd/godoc/spec.go') 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, "error: %s", msg); + fmt.Fprintf(p.out, `error: %s`, msg); } @@ -83,7 +83,7 @@ func (p *ebnfParser) parseIdentifier(def bool) { if def { fmt.Fprintf(p.out, `%s`, name, name); } else { - fmt.Fprintf(p.out, `%s`, name, name); + fmt.Fprintf(p.out, `%s`, 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(`
`);
-	close	= strings.Bytes(`
`); + openTag = strings.Bytes(`
`);
+	closeTag	= strings.Bytes(`
`); ) @@ -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; } -- cgit v1.2.3