Commit graph

9 commits

Author SHA1 Message Date
Russ Cox cb2f6cb05d godoc: generate package toc in template, not in JavaScript
1. Generate TOC for package pages using template,
instead of using JavaScript magic.  This makes the
pages generated by godoc -html easier to export
to other systems.

2. Make TOC one column.  It's hard to do two columns
portably without invoking JavaScript.

3. Since the TOC is only one column, show full type
signatures for functions and methods.  Many times
that's all you need to see anyway.

4. Name the section after the TOC "Overview".
Naming it something is important, to set it off
from the TOC and so that there's a quick link to
it in the TOC.

For now, some illustrative examples:

http://swtch.com:6060/pkg/io/
http://swtch.com:6060/pkg/strings/
http://swtch.com:6060/pkg/tabwriter/
http://swtch.com:6060/pkg/unicode/

Fixes #1982.

R=gri, bradfitz, r
CC=golang-dev
https://golang.org/cl/5303044
2011-10-18 16:23:35 -04:00
Andrew Gerrand edacc863d0 doc: remove errant console.log from godocs.js
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5211045
2011-10-06 13:12:11 -07:00
Andrew Gerrand af1ae438b9 go/doc, godoc, gotest: support for reading example documentation
This CL introduces the go.Example type and go.Examples functions that
are used to represent and extract code samples from Go source.

They should be of the form:

// Output of this function.
func ExampleFoo() {
        fmt.Println("Output of this function.")
}

It also modifies godoc to read example code from _test.go files,
and include them in the HTML output with JavaScript-driven toggles.

It also implements testing of example functions with gotest.
The stdout/stderr is compared against the output comment on the
function.

This CL includes examples for the sort.Ints function and the
sort.SortInts type. After patching this CL in and re-building go/doc
and godoc, try
        godoc -http=localhost:6060
and visit http://localhost:6060/pkg/sort/

R=gri, r, rsc
CC=golang-dev
https://golang.org/cl/5137041
2011-10-06 11:56:17 -07:00
Andrew Gerrand b9f9087605 godoc: don't display navigation list with only 1 element
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4547056
2011-05-20 14:26:00 +10:00
Robert Griesemer 8e340695c1 godoc: if there is no search box, don't run the respective JS code
Fixes a JS crash which prevented the automatically generated
table of contents to not appear.

R=adg, bradfitz
CC=golang-dev
https://golang.org/cl/4460041
2011-05-02 18:07:11 -07:00
Dmitry Chestnykh 84c7e83b4c godoc: use "search" input type for search box.
Uses placeholder attribute instead of changing the value of search
field on browsers that support it.  On other browsers, the fake
placeholder text is restored when the empty box loses focus.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4441041
2011-04-15 10:48:45 -07:00
Andrew Gerrand 6ab8d24d72 golang.org redesign
R=r, rsc, gri
CC=golang-dev, iant, ken2, lvd, nigeltao_golang, stephenm
https://golang.org/cl/2182042
2010-09-16 14:01:02 +10:00
Russ Cox dee5ad5c24 godocs.js: fix bad variable name
Thanks to anno.langen.
Fixes #103.

R=r
https://golang.org/cl/155050
2009-11-15 12:57:33 -08:00
Larry Hosken 698c6c00a0 A step towards "externalizing" some Go docs.
+ style sheet: like code.google.com but less feature-ful
+ JS with table-of-contents generation
+ tweaked go_spec.html and go_mem.html to use new style+JS
+ static-HTML-ified a few other Go docs:
  + static HTML versions of some wiki pages (which I'll turn
    into links to these pages).

A notable thing that is _not_ in this changelist: any change
to the godoc tool or whatever thing generates http://go/godoc

R=r
APPROVED=r
DELTA=2472  (2307 added, 113 deleted, 52 changed)
OCL=34644
CL=34728
2009-09-17 08:05:12 -07:00