From 955aa159adc41ee2ee60563fab6dad676f332526 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 20 Jan 2011 10:43:55 -0800 Subject: [PATCH] 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 --- doc/all.css | 4 ++++ src/cmd/godoc/format.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/all.css b/doc/all.css index f70ef159974..b1d55cf25ad 100644 --- a/doc/all.css +++ b/doc/all.css @@ -157,6 +157,10 @@ h1#title { pre.ebnf, pre.grammar { background: #FFFFE0; } +span.ln { + font-size: 80%; + color: #777777; +} span.comment { color: #002090; } diff --git a/src/cmd/godoc/format.go b/src/cmd/godoc/format.go index d789ed55bfe..66b01aa6461 100644 --- a/src/cmd/godoc/format.go +++ b/src/cmd/godoc/format.go @@ -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, "%5d\t", line, line) + fmt.Fprintf(w, "%6d\t", line, line) line++ } }