diff -r 7e40432eea6b godoc/server.go
--- a/godoc/server.go Sun Nov 02 12:21:04 2014 -0500
+++ b/godoc/server.go Tue Nov 04 07:23:43 2014 +1100
@@ -542,13 +542,13 @@
fmt.Fprintf(&buf, "[%s]
", htmlpkg.EscapeString(status))
}
- buf.WriteString("
")
+ buf.WriteString("
")
formatGoSource(&buf, src, fi.Links, h, s)
- buf.WriteString("")
+ buf.WriteString("
")
} else {
- buf.WriteString("")
+ buf.WriteString("
")
FormatText(&buf, src, 1, false, h, s)
- buf.WriteString("")
+ buf.WriteString("
")
}
fmt.Fprintf(&buf, `View as plain text
`, htmlpkg.EscapeString(relpath))
@@ -588,17 +588,20 @@
FormatSelections(buf, text, linkWriter, segmentIter, selectionTag, comments, highlights, selection)
- // Now copy buf to saved, adding line anchors.
+ fmt.Fprintln(saved, "")
- // The lineSelection mechanism can't be composed with our
- // linkWriter, so we have to add line spans as another pass.
n := 1
- for _, line := range bytes.Split(buf.Bytes(), []byte("\n")) {
+ for _ = range bytes.Split(buf.Bytes(), []byte("\n")) {
fmt.Fprintf(saved, "%6d\t", n, n)
n++
- saved.Write(line)
saved.WriteByte('\n')
}
+ fmt.Fprintln(saved, " | ")
+
+ // Insert the source code.
+ fmt.Fprintln(saved, "")
+ saved.Write(buf.Bytes())
+ fmt.Fprintln(saved, " | ")
}
func (p *Presentation) serveDirectory(w http.ResponseWriter, r *http.Request, abspath, relpath string) {
diff -r 7e40432eea6b godoc/snippet.go
--- a/godoc/snippet.go Sun Nov 02 12:21:04 2014 -0500
+++ b/godoc/snippet.go Tue Nov 04 07:23:43 2014 +1100
@@ -27,7 +27,7 @@
p.writeNode(&buf1, fset, decl)
// wrap text with tag
var buf2 bytes.Buffer
- buf2.WriteString("")
+ buf2.WriteString("")
FormatText(&buf2, buf1.Bytes(), -1, true, id.Name, nil)
buf2.WriteString("
")
return &Snippet{fset.Position(id.Pos()).Line, buf2.String()}
diff -r 7e40432eea6b godoc/static/example.html
--- a/godoc/static/example.html Sun Nov 02 12:21:04 2014 -0500
+++ b/godoc/static/example.html Tue Nov 04 07:23:43 2014 +1100
@@ -9,7 +9,7 @@
{{with .Play}}
-
+
Run
Format
diff -r 7e40432eea6b godoc/static/package.html
--- a/godoc/static/package.html Sun Nov 02 12:21:04 2014 -0500
+++ b/godoc/static/package.html Tue Nov 04 07:23:43 2014 +1100
@@ -151,14 +151,14 @@
{{with .Consts}}
Constants
{{range .}}
-
{{node_html $ .Decl true}}
+
{{node_html $ .Decl true}}
{{comment_html .Doc}}
{{end}}
{{end}}
{{with .Vars}}
Variables
{{range .}}
-
{{node_html $ .Decl true}}
+
{{node_html $ .Decl true}}
{{comment_html .Doc}}
{{end}}
{{end}}
@@ -166,7 +166,7 @@
{{/* Name is a string - no need for FSet */}}
{{$name_html := html .Name}}
-
{{node_html $ .Decl true}}
+
{{node_html $ .Decl true}}
{{comment_html .Doc}}
{{example_html $ .Name}}
{{callgraph_html $ "" .Name}}
@@ -176,16 +176,16 @@
{{$tname := .Name}}
{{$tname_html := html .Name}}
-
{{node_html $ .Decl true}}
+
{{node_html $ .Decl true}}
{{comment_html .Doc}}
{{range .Consts}}
-
{{node_html $ .Decl true}}
+
{{node_html $ .Decl true}}
{{comment_html .Doc}}
{{end}}
{{range .Vars}}
-
{{node_html $ .Decl true}}
+
{{node_html $ .Decl true}}
{{comment_html .Doc}}
{{end}}
@@ -196,7 +196,7 @@
{{range .Funcs}}
{{$name_html := html .Name}}
-
{{node_html $ .Decl true}}
+
{{node_html $ .Decl true}}
{{comment_html .Doc}}
{{example_html $ .Name}}
{{callgraph_html $ "" .Name}}
@@ -205,7 +205,7 @@
{{range .Methods}}
{{$name_html := html .Name}}
-
{{node_html $ .Decl true}}
+
{{node_html $ .Decl true}}
{{comment_html .Doc}}
{{$name := printf "%s_%s" $tname .Name}}
{{example_html $ $name}}
@@ -228,7 +228,7 @@
{{with .PAst}}
{{range $filename, $ast := .}}
-
{{$filename|filename|html}}:
{{node_html $ $ast false}}
+
{{$filename|filename|html}}:
{{node_html $ $ast false}}
{{end}}
{{end}}
diff -r 7e40432eea6b godoc/static/style.css
--- a/godoc/static/style.css Sun Nov 02 12:21:04 2014 -0500
+++ b/godoc/static/style.css Tue Nov 04 07:23:43 2014 +1100
@@ -3,6 +3,30 @@
font-family: Helvetica, Arial, sans-serif;
font-size: 16px;
}
+.highlighttable {
+ width: 100%;
+ border-collapse: collapse;
+ background: #e9e9e9;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+}
+.highlighttable td.linenos {
+ border-right: 1px solid #ccc;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ text-align: right;
+ width: 25px;
+}
+.highlighttable td {
+ height: 18px;
+ padding: 8px 10px;
+ vertical-align: top;
+}
+.highlighttable pre {
+ margin: 0;
+}
pre,
code {
font-family: Menlo, monospace;
@@ -11,6 +35,13 @@
pre {
line-height: 18px;
}
+.code {
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ background: #e9e9e9;
+ padding: 10px;
+}
pre .comment {
color: #006600;
}
@@ -45,15 +76,6 @@
ol {
margin: 20px;
}
-pre {
- background: #e9e9e9;
- padding: 10px;
-
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
-}
-
h1,
h2,
h3,
diff -r 7e40432eea6b godoc/template.go
--- a/godoc/template.go Sun Nov 02 12:21:04 2014 -0500
+++ b/godoc/template.go Tue Nov 04 07:23:43 2014 +1100
@@ -100,7 +100,7 @@
// HTML-escape text and syntax-color comments like elsewhere.
FormatText(&buf, []byte(text), -1, true, "", nil)
// Include the command as a comment.
- text = fmt.Sprintf("
%s
", command, buf.Bytes())
+ text = fmt.Sprintf("
%s
", command, buf.Bytes())
return text, nil
}