]> Cypherpunks repositories - gostls13.git/commitdiff
use default styler when there is no other given
authorRobert Griesemer <gri@golang.org>
Tue, 3 Nov 2009 18:00:57 +0000 (10:00 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 3 Nov 2009 18:00:57 +0000 (10:00 -0800)
(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

index 2996866962806cb7aee68531f7ac7da764a04550..85e3adcd185ae11ec7c44d6c84ea937ae0460024 100644 (file)
@@ -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(`<a id="L%d">`, line), "</a>"};
        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;