From 12f8660d4c396da8f6e69f0c6a661a53086f4bd9 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 3 Nov 2009 10:00:57 -0800 Subject: [PATCH] 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 --- src/cmd/godoc/godoc.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; -- 2.50.0