Commit 955aa159 authored by Robert Griesemer's avatar Robert Griesemer

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
parent 3c710447
...@@ -157,6 +157,10 @@ h1#title { ...@@ -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;
} }
......
...@@ -360,12 +360,12 @@ func FormatText(text []byte, line int, goSource bool, pattern string, selection ...@@ -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++
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment