1
0
mirror of https://github.com/golang/go synced 2024-10-01 01:38:33 -06:00
Commit Graph

13 Commits

Author SHA1 Message Date
Masahiro Furudate
ce1291533b godoc: remove the function declaration link
The link of the function declaration part is unnecessary because it points to the same place.
Removed the link of the function declaration part.

"IdentMode" has been removed since it is no longer used.

Fixes golang/go#20269

Change-Id: I6399899947e46dc84c5432c1d645f6d96b7db4f6
Reviewed-on: https://go-review.googlesource.com/42892
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-05-13 14:14:02 +00:00
Jay Conrod
3bcb6efb39 godoc: Restore anchors for variables and constants
godoc once again adds anchors for variable and constant
declarations. Individual declarations and lists of declarations are
both covered.

Fixes golang/go#19894

Change-Id: If5f8f0c3429774f33535e2e654685ba5d71937f1
Reviewed-on: https://go-review.googlesource.com/40300
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-14 23:26:29 +00:00
Jay Conrod
e1bdc76d04 x/tools/cmd/godoc: fix broken links in composite literals
Previously, field names in composite literals were treated as normal
identifiers. For example, in Foo{X: 42}, X was treated link a normal
variable and was linked to "#X".

With this change, field links now include a prefix for their type
definition, for example, "#Foo.X".

Fixes golang/go#16031

Change-Id: I9cb501704f284fbbc05424555312307c61843e47
Reviewed-on: https://go-review.googlesource.com/36830
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-02-17 22:21:49 +00:00
Jay Conrod
00f7cd5589 x/tools/cmd/godoc: Fix incorrectly indented literals in examples
godoc formats function examples for text or HTML output by
stripping the surrounding braces and un-indenting by replacing
"\n    " with "\n". This modifies the content of string literals,
resulting in misleading examples.

This change introduces a function, replaceLeadingIndentation, which
unindents more carefully. It removes the first level of indentation
only outside of string literals. For plain text output, it adds custom
indentation at the beginning of every line including string literals.

Fixes golang/go#18446

Change-Id: I52a7f5756bdb69c8a66f031452dd35eab947ec1f
Reviewed-on: https://go-review.googlesource.com/36544
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-02-17 21:58:39 +00:00
Robert Griesemer
7e08f6711b godoc: run TestStructField for Go 1.7 and up only (fix build)
There's no testing.T.Run method in Go 1.6.

Change-Id: I0ed7bdbe91d4cc4406ad5626dbae9acc42b4853a
Reviewed-on: https://go-review.googlesource.com/36119
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-01 22:56:31 +00:00
Brad Fitzpatrick
61efd71121 godoc: fix quadratic and ASCII-only struct field linkification
Fixes two problems with adding the #StructType.FieldName anchors for
linkified struct fields:

* the old code was quadratic

* the old code only dealt with ASCII only

Change-Id: If03a367a94d05d3d470e1326dfb573037088ff78
Reviewed-on: https://go-review.googlesource.com/35486
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-01-25 17:13:35 +00:00
Brad Fitzpatrick
e5f9a3deee godoc: update struct field anchor code
Now without regexps and allocations.

And also match comments like:

    // Foo, if non-nil, ...

The comma confused the old pattern.

Updates golang/go#16753

Change-Id: I9016ee7b5933ea343950a39989952804c74a598b
Reviewed-on: https://go-review.googlesource.com/33755
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-12-01 02:33:17 +00:00
Brad Fitzpatrick
0f65b31aee godoc: make struct fields linkable in HTML mode
This adds <span id="StructName.FieldName"> elements around
field names, starting at the comment if present, so people
can link to /pkg/somepkg/#SomeStruct.SomeField.

Fixes golang/go#16753

Change-Id: I4a8b30605d18e9e33e3d42f273a95067ac491438
Reviewed-on: https://go-review.googlesource.com/33690
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-30 23:29:37 +00:00
Alan Donovan
6c93dbff3e go.tools/godoc: deal with fallout from $GOROOT/src/pkg -> $GOROOT/src renaming.
To avoid breaking URLs, we redirect /src/pkg/* to /src/*.

The URL /pkg is now the "directory" /src, which triggers the
"Packages" index.

All other references to "src/pkg" are now gone,
except a number in the namespace documentation which are
probably still illustrative.

Tested: go test cmd/godoc godoc
        Manual inspection of src and src/pkg pages.
        with GOROOT and GOPATH packages
        -analysis
        /AUTHORS file URL still works

LGTM=bradfitz, adg
R=bradfitz, adg
CC=golang-codereviews
https://golang.org/cl/141770044
2014-09-10 09:02:54 -04:00
Brad Garcia
936715c71c godoc: Strip "/src/pkg/" prefix from identifier keys, so that it's keyed identically to import count.
Intern the documentation strings.

LGTM=sameer
R=sameer, bradfitz
CC=golang-codereviews
https://golang.org/cl/107250043
2014-06-27 10:25:57 -04:00
Robert Griesemer
42a4cd3392 go.tools/godoc: sanitize function signatures for object index
Fixes golang/go#7703.

LGTM=bgarcia
R=bgarcia
CC=golang-codereviews
https://golang.org/cl/84410045
2014-04-07 12:54:28 -07:00
Brad Garcia
61bd98e5b3 godoc: Fix m=src URLs.
For source code links, prepend /src/pkg if not already prefixed.
Fixes golang/go#7383.

R=bradfitz, sameer
CC=golang-codereviews
https://golang.org/cl/67110043
2014-02-21 19:51:51 -05:00
Brad Garcia
ff7cfafc58 godoc: Add URLForSrcQuery option to godoc.Presentation.
This allows the creation of URLs to lines of source code with a query
term highlighted without assuming godoc source code URL parameters.
Needed for interfacing with other source code viewing servers.

R=bradfitz
CC=golang-dev
https://golang.org/cl/34200043
2013-12-04 10:37:01 -05:00