]> Cypherpunks repositories - gostls13.git/commitdiff
godoc: show line numbers for non-go files (bug fix)
authorRobert Griesemer <gri@golang.org>
Thu, 20 Jan 2011 18:43:55 +0000 (10:43 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 20 Jan 2011 18:43:55 +0000 (10:43 -0800)
Also: Give line numbers a style and make them less intrusive.

R=rsc
CC=golang-dev
https://golang.org/cl/4060043

doc/all.css
src/cmd/godoc/format.go

index f70ef159974e5f2bb1a923ae533924f0e260eb97..b1d55cf25adb4febf4dfabe060e5ebb19d5b9b5e 100644 (file)
@@ -157,6 +157,10 @@ h1#title {
 pre.ebnf, pre.grammar {
   background: #FFFFE0;
 }
+span.ln {
+  font-size: 80%;
+  color: #777777;
+}
 span.comment {
   color: #002090;
 }
index d789ed55bfef6a2fdc2234f8c094c1cf0daf8c10..66b01aa646193b6c377ee5d81b140aa9f427d4e8 100644 (file)
@@ -360,12 +360,12 @@ func FormatText(text []byte, line int, goSource bool, pattern string, selection
        if pattern != "" {
                highlights = regexpSelection(text, pattern)
        }
-       if comments != nil || highlights != nil || selection != nil {
+       if line >= 0 || comments != nil || highlights != nil || selection != nil {
                var lineTag LinkWriter
                if line >= 0 {
                        lineTag = func(w io.Writer, _ int, start bool) {
                                if start {
-                                       fmt.Fprintf(w, "<a id=\"L%d\"></a>%5d\t", line, line)
+                                       fmt.Fprintf(w, "<a id=\"L%d\"></a><span class=\"ln\">%6d</span>\t", line, line)
                                        line++
                                }
                        }