1
0
mirror of https://github.com/golang/go synced 2024-11-21 19:24:45 -07:00

godoc: show line numbers for non-go files (bug fix)

Also: Give line numbers a style and make them less intrusive.

R=rsc
CC=golang-dev
https://golang.org/cl/4060043
This commit is contained in:
Robert Griesemer 2011-01-20 10:43:55 -08:00
parent 3c7104479c
commit 955aa159ad
2 changed files with 6 additions and 2 deletions

View File

@ -157,6 +157,10 @@ h1#title {
pre.ebnf, pre.grammar { pre.ebnf, pre.grammar {
background: #FFFFE0; background: #FFFFE0;
} }
span.ln {
font-size: 80%;
color: #777777;
}
span.comment { span.comment {
color: #002090; color: #002090;
} }

View File

@ -360,12 +360,12 @@ func FormatText(text []byte, line int, goSource bool, pattern string, selection
if pattern != "" { if pattern != "" {
highlights = regexpSelection(text, pattern) highlights = regexpSelection(text, pattern)
} }
if comments != nil || highlights != nil || selection != nil { if line >= 0 || comments != nil || highlights != nil || selection != nil {
var lineTag LinkWriter var lineTag LinkWriter
if line >= 0 { if line >= 0 {
lineTag = func(w io.Writer, _ int, start bool) { lineTag = func(w io.Writer, _ int, start bool) {
if start { 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++ line++
} }
} }