From: Robert Griesemer Date: Tue, 3 Nov 2009 18:00:57 +0000 (-0800) Subject: use default styler when there is no other given X-Git-Tag: weekly.2009-11-06~117 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=12f8660d4c396da8f6e69f0c6a661a53086f4bd9;p=gostls13.git use default styler when there is no other given (No visual change yet since the comments for exported code snippets - as shown on the pkg page - are not yet formatted using the standard comment intersperse mechanism in the printer. This is a TODO in the printer.) R=rsc http://go/go-review/1016031 --- diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go index 2996866962..85e3adcd18 100644 --- a/src/cmd/godoc/godoc.go +++ b/src/cmd/godoc/godoc.go @@ -300,6 +300,10 @@ type Styler struct { } +// Use the defaultStyler when there is no specific styler. +var defaultStyler Styler + + func (s *Styler) LineTag(line int) (text []byte, tag printer.HtmlTag) { tag = printer.HtmlTag{fmt.Sprintf(``, line), ""}; return; @@ -367,9 +371,9 @@ func writeAny(w io.Writer, x interface{}, html bool) { case string: writeText(w, strings.Bytes(v), html); case ast.Decl: - writeNode(w, v, html, nil); + writeNode(w, v, html, &defaultStyler); case ast.Expr: - writeNode(w, v, html, nil); + writeNode(w, v, html, &defaultStyler); default: if html { var buf bytes.Buffer;