1
0
mirror of https://github.com/golang/go synced 2024-10-03 14:11:21 -06:00
Commit Graph

70 Commits

Author SHA1 Message Date
Russ Cox
dffdece819 godoc: move example list into index section
Putting it before the Index (where it is now) is wrong:
we don't even know what's in the package yet.

Fixes #4484.

R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/6868071
2012-12-10 20:20:00 -05:00
Andrew Gerrand
8438641629 godoc: add dropdown playground to nav bar
R=gri, dsymonds, skybrian
CC=golang-dev
https://golang.org/cl/6631057
2012-10-10 11:17:47 +11:00
Andrew Gerrand
3fd5e0be9d godoc: make examples editable and runnable in playground
R=dsymonds
CC=golang-dev
https://golang.org/cl/6523045
2012-10-04 16:53:05 +10:00
Andrew Gerrand
e7f453148c godoc: show contents in correct order, expand sections on click
R=dsymonds
CC=gobot, golang-dev
https://golang.org/cl/6588079
2012-10-04 11:21:37 +10:00
Andrew Gerrand
516306f677 godoc: move Examples above Index and make them both collapsable
R=golang-dev, dsymonds, bradfitz, r
CC=golang-dev
https://golang.org/cl/6591066
2012-10-03 15:05:08 +10:00
Robert Griesemer
f597fa67c1 godoc: report error for directories with multiple packages
Fixes #3922.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/6453094
2012-08-09 16:10:46 -07:00
Robert Griesemer
3601f27708 godoc: make id attributes unique
Some browsers (e.g. IE9) ignore the case of 'id' attributes
which can lead to conflicts. Prefix non-generated 'id's with
"pkg-" to make them different from any generated attribute.

Also: Added missing entry for "Other packages" to top-level
index.

Fixes #3851.

R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/6449105
2012-08-07 17:45:58 -07:00
Dave Cheney
82cbcb0dd5 website: various html fixes
Fixes #3424.

R=fullung, adg
CC=golang-dev
https://golang.org/cl/6343088
2012-07-11 09:41:08 -07:00
Andrew Gerrand
f8dde60e2b doc: don't wrap package names in directory listing
Fixes #3522.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6063054
2012-04-20 10:04:13 -04:00
Andrew Gerrand
16fd9fd640 doc: link to Go Project Dashboard from package list
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5937048
2012-03-28 11:38:34 +11:00
Andrew Gerrand
0b762d9523 godoc: make 'Overview' section collapsable
This makes packages with lengthly package comments easier to browse.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5901055
2012-03-26 14:10:27 +11:00
Andrew Gerrand
f200b72a7c doc: add more gophers
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5753047
2012-03-06 12:50:52 +11:00
Ugorji Nwoke
0eb4df0bc8 cmd/godoc: remove extra / in paths
If I click on links which should send you to source code (e.g. type, function, etc),
the link is to //src/... (instead of /src/...).
This causes a DNS resolution failure on the browser.

Quick fix is to remove the leading / from package.html
(since godoc.go src links automatically add a leading / as necessary).

Fixes #3193.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5730059
2012-03-05 15:36:33 -05:00
Russ Cox
fae0d35043 godoc: support $GOPATH, simplify file system code
The motivation for this CL is to support $GOPATH well.
Since we already have a FileSystem interface, implement a
Plan 9-style name space.  Bind each of the $GOPATH src
directories onto the $GOROOT src/pkg directory: now
everything is laid out exactly like a normal $GOROOT and
needs very little special case code.

The filter files are no longer used (by us), so I think they
can just be deleted.  Similarly, the Mapping code and the
FileSystem interface were two different ways to accomplish
the same end, so delete the Mapping code.

Within the implementation, since FileSystem is defined to be
slash-separated, use package path consistently, leaving
path/filepath only for manipulating operating system paths.

I kept the -path flag, but I think it can be deleted too.

Fixes #2234.
Fixes #3046.

R=gri, r, r, rsc
CC=golang-dev
https://golang.org/cl/5711058
2012-03-05 10:02:46 -05:00
Andrew Gerrand
4314087b62 godoc: hide "Subdirectories" subheading if it is the only section
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5731056
2012-03-04 09:57:09 +11:00
Andrew Gerrand
64bc38eb85 godoc: add Examples link to top-level index
R=golang-dev
CC=golang-dev
https://golang.org/cl/5702043
2012-02-28 16:05:12 +11:00
Robert Griesemer
ab169c6e3f godoc: don't show directories w/o packages in flat dir mode
The main change is simple: Both the Directory and DirEntry
struct have an extra field 'HasPkg' indicating whether the
directory contains any package files. The remaining changes
are more comments and adjustments to the template files.

Fixes #3121.

R=golang-dev, bradfitz, sameer
CC=golang-dev
https://golang.org/cl/5699072
2012-02-27 11:18:00 -08:00
Robert Griesemer
c1139549bc godoc: consistent placement of documentation sections
Fixes #1226.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5694052
2012-02-23 12:44:11 -08:00
Andrew Gerrand
89fd4dd766 godoc: support flat directory view again
R=bradfitz
CC=golang-dev
https://golang.org/cl/5690058
2012-02-22 09:25:56 +11:00
Scott Lawrence
05e80cffc3 godoc: fix tag mismatch validation errors
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5676099
2012-02-20 12:32:43 +11:00
Andrew Gerrand
f3c3130685 godoc: support for package examples, display example suffixes
Fixes #2896.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5677047
2012-02-16 09:44:01 +11:00
Brad Fitzpatrick
988968262d doc: fix links
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5671051
2012-02-15 00:59:01 -08:00
Gustavo Niemeyer
b4d32d832f lib/godoc: fix subdirectories html reference
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5677043
2012-02-14 22:18:29 -02:00
Andrew Gerrand
5ab935f68a godoc: list examples in index
Fixes #2897.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5658047
2012-02-14 14:52:00 +11:00
Andrew Gerrand
d84de09e1d godoc: new design
This is not the finished product,
but a good checkpoint from which to
proceed with further development.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5571061
2012-02-13 21:22:36 +11:00
Rob Pike
80e2472f87 godoc: static ids should be #lowercase
so they don't collide with names like #Index.
Fixes #2970.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5655066
2012-02-13 14:34:30 +11:00
Robert Griesemer
d5c89972d8 godoc: provide link to subdirectories, if any
R=rsc
CC=golang-dev
https://golang.org/cl/5626043
2012-02-03 10:17:37 -08:00
Russ Cox
71b1c6d3c9 godoc: move overview before API TOC
Compare:
http://swtch.com/junk/regexp0.html [old]
http://swtch.com/junk/regexp.html [new]

Especially for packages with large APIs, this makes the
overview more promiment, so that it can give the appropriate
context for reading the API list.  This should help significantly
in packages with large APIs, like net, so that the first thing users
see is not a jumble of functions but an introduction to the package.

R=adg, gri, r, kevlar, dsymonds, rogpeppe
CC=golang-dev
https://golang.org/cl/5573068
2012-01-26 13:02:03 -05:00
Robert Griesemer
d571c5ca78 go/doc: revert API change (per former discussion) and cleanup
Separating Method from Func made the code only more complicated
without adding much to the useability/readability of the API.
Reverted to where it was, but leaving the new method-specific
fields Orig and Level.

Former clients (godoc) of doc.Method only used the Func fields;
and because Func was embedded, no changes are needed with respect
to the removal of Method.

Changed type of Func.Recv from ast.Expr to string. This was a
long-standing TODO. Also implemented Func.Orig field (another TODO).

No further go/doc API changes are expected for Go 1.

R=rsc, r, r
CC=golang-dev
https://golang.org/cl/5577043
2012-01-25 16:48:06 -08:00
Robert Griesemer
d191ad11ae lib/godoc: use Type.Name directly
Also: remove an unused template variable declaration.

R=adg
CC=golang-dev
https://golang.org/cl/5572043
2012-01-23 16:08:05 -08:00
Andrew Gerrand
3358a5068a godoc: add anchors to cmd documentation headings
Also, disable server-side generation of TOC for commands as they would
only ever show Overview. The JS does a better job (for now).

Fixes #2732.

R=gri, dsymonds
CC=golang-dev
https://golang.org/cl/5558046
2012-01-19 18:59:06 +11:00
Andrew Gerrand
e547393fcc godoc: remove "need more packages?" link
Its need will be addressed in another way by the redesign.

Fixes #2719.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5536062
2012-01-19 15:00:27 +11:00
Robert Griesemer
45ca908f89 godoc: fix missing name change
Fixes godoc text mode (i.e., URL?m=text).

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5545043
2012-01-12 17:54:17 -08:00
Robert Griesemer
eac31c67a8 go/doc: streamlined go/doc API
- the main changes are removing the Doc suffix
  from the exported types, so instead of
  doc.TypeDoc one will have doc.Type, etc.

- All exported types now have a Name (or Names) field.
  For Values, the Names field lists all declared variables
  or constants.

- Methods have additional information about where they are
  coming from.

- There's a mode field instead of a bool to
  control the package's operation, which makes
  it easier to extend w/o API changes.

Except for the partially implemented new Method type,
this is based on existing code. A clean rewrite is in
progress based on this new API.

R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/5528060
2012-01-12 17:36:57 -08:00
Olivier Duperray
e97a55810f godoc: <pre> must not occur inside <p>
Fixes #2532

R=golang-dev, dr.volker.dobler, rsc
CC=golang-dev
https://golang.org/cl/5450115
2011-12-07 15:00:38 -05:00
Volker Dobler
af84892643 godoc: Show type examples between variables and methods.
Fixes #2466.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5451094
2011-12-06 10:52:43 +11:00
Robert Griesemer
9859af879b godoc: provide mode for flat (non-indented) directory listings
This feature should make it easier to look at very large
directory trees.

- a new mode (URL: /pkg/?m=flat) shows directory listings w/o
  indentation and entries with full path (html and text mode)
- in text mode, hierarchical (non-flat) directory listings are
  now presented with indentation (/pkg/?m=text)
- in html mode, hierarchical (non-flat) directory listings are
  presented with slightly less indentation
- there is an internal hook for programmatic control of the
  display mode (for specialized versions of godoc).

R=bradfitz
CC=golang-dev, rsc
https://golang.org/cl/5410043
2011-11-17 14:47:49 -08:00
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
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
Robert Griesemer
72dcab1c40 godoc: fix local link for factory functions
- fix suggested by rodrigo.moraes

Fixes #1755.

R=rsc
CC=golang-dev
https://golang.org/cl/4977057
2011-09-08 10:37:26 -07:00
Robert Griesemer
0f801ff81e godoc: template cleanup
Use naming convention for template variables
to indicate "escaped-ness" for easier reviewing.
(per suggestion from bradfitz)

R=bradfitz
CC=golang-dev
https://golang.org/cl/4914041
2011-08-17 16:38:58 -07:00
David Symonds
5e48e648f1 exp/template: rename filter: url -> urlquery.
R=r, rsc
CC=golang-dev
https://golang.org/cl/4873046
2011-08-13 14:00:16 +10:00
Robert Griesemer
c71b676724 godoc: position URLs (containing file names) must be quoted and URL escaped
Since the posLink_url also adds a non-URL attribute, the quoting and  URL-escaping
must happen inside posLink_url (otherwise the non-URL attribute becomes part or the
URL portion of the tag.

R=r
CC=golang-dev
https://golang.org/cl/4888041
2011-08-12 16:28:55 -07:00
Robert Griesemer
5c45e56898 godoc: remove last vestiges of old template system
- rename template funcs for better consistency and
  sort them into groups of related functionality
- try to be more consistent with html vs url escaping

R=r
CC=golang-dev
https://golang.org/cl/4887041
2011-08-12 15:43:10 -07:00
Robert Griesemer
5233c50321 godoc: first round of template cleanups
- simplified pipelines
- simplified templates by using template variables
- converted most old-style formatters into new-style funcs
- fixed some escaping bugs (use of url escaping where it was missing)

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4868044
2011-08-12 10:06:32 -07:00
Robert Griesemer
2e394c51d9 godoc: moving to new template package
- first step; rough conversion of all template files
- there is plenty of opportunity for cleanups/simplifications (next CLs)
- html and text output as before

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4852048
2011-08-11 13:24:13 -07:00
Andrew Gerrand
e015f6c4a5 godoc: display advert for the package dashboard on package list page
R=golang-dev, bradfitz, ality
CC=golang-dev
https://golang.org/cl/4526070
2011-05-24 15:45:08 +10:00
Robert Griesemer
d916cca327 go/printer: remove notion of "Styler", remove HTML mode
Neither gofmt nor godoc are making use of a Styler (for
token-specific formatting) anymore. Stylers interacted in complicated
ways with HTML-escaping which was why the printer needed an HTML mode
in the first place.

godoc now uses a more powerful and general text formatting
function that does HTML escaping, text selection, and can
handle token-specific formatting if so desired (currently
used only for comments).

As a consequence, cleaned up uses of go/printer in godoc;
simplified the various write utility functions, and also
removed the need for the "html" template format (in favor of
html-esc which now does the same and is used more pervasively).

Applied gofmt -w src misc to verify no changes occured,
and tested godoc manually.

There should be no visible changes except that (type) code
snippets presented for godoc package documentation now
uses the same formatting as for general source code and
thus comments get the comment-specific color here as well
(not the case at the moment).

(TODO: godoc needs a good automatic test suite).

R=rsc
CC=golang-dev
https://golang.org/cl/4152042
2011-02-09 09:52:32 -08:00
Robert Griesemer
d9ffbc4b3d godoc: remove tab before <pre>-formatted section
Fixes #1321.

R=r, r2
CC=golang-dev
https://golang.org/cl/4003042
2011-01-13 18:34:22 -08:00
Gustavo Niemeyer
1f6b6ca9ba A selection of trivials.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/3606043
2010-12-12 14:16:37 -08:00