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

78 Commits

Author SHA1 Message Date
Ted Kornish
396c176f11 godoc: preserve ?m=... query string
Right now, clicking around packages in the godoc web interface strips
the URL of any query strings it may have, which makes traversing
internal packages a clumsy experience (constantly have to re-add ?m=...).

This revision preserves the ?m=... flag in links between packages by examining
the current PageInfoMode and converting it to a query string.

Change-Id: I4e28279d8cbf221bcc7d5bce8de04c90cc907678
Reviewed-on: https://go-review.googlesource.com/34982
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 21:12:11 +00:00
Chris Broadfoot
19c96be7c4 static: fix playground share
Change-Id: I5decba3efb750e32fbc07ac1093cd37a00b65912
Reviewed-on: https://go-review.googlesource.com/36488
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-02-07 22:02:51 +00:00
Chris Broadfoot
69cfa78961 static: add optional save shortcut support to playground
If enabled (via the "enableShortcuts" option), Ctrl+S/Cmd+S now
saves/shares the playground snippet and initiates a download.

Credit to Alexander Kucherenko (see golang.org/cl/35950).

Updates golang/go#15378.

Change-Id: I8a2d733c25e4c95787fbe1f5ac00fa1befbb4693
Reviewed-on: https://go-review.googlesource.com/36486
Reviewed-by: Andrew Gerrand <adg@golang.org>
2017-02-07 20:35:01 +00:00
Chris Broadfoot
1a60337c22 godoc/static: clean up the expandos code that handles the hash
Change-Id: I14e6777f781253a574f76c7d8a345d248b5a4306
Reviewed-on: https://go-review.googlesource.com/36320
Reviewed-by: Russ Cox <rsc@golang.org>
2017-02-04 03:29:34 +00:00
Chris Broadfoot
5d76f8ce4f static: detect platform to hide/show unix/windows instructions
Currently both "testUnix" and "testWindows" elements are shown simultaneously.
This change detects the correct platform to hide/show the appropriate
elements based on the viewer's browser.

Change-Id: I3afee7507d61b2d756127166caede85adcd531b8
Reviewed-on: https://go-review.googlesource.com/35103
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-10 22:41:44 +00:00
Kevin Burke
b54fdb7e52 godoc: don't select line numbers in orange
Previously a selection of text that spanned multiple lines would
include the line number as part of the orange highlight. This is
misleading (the line numbers aren't copied when you highlight the
text with your mouse) and a little ugly.

I had to move the tab character inside the <span class="ln"> block,
otherwise the orange highlight goes right up to the number, which is
off-putting and means the orange highlights don't line up vertically.

Before: https://monosnap.com/file/F9L166Zxxnf3ev74Z3JoJT0xz0nYLn.png
After: https://monosnap.com/file/6jfeFBG6tzhy3ZErqYWn6BfZ4fyk1R.png

Fixes golang/go#18561

Change-Id: I312d30ce01071850f8724246c54ce2d7259619d2
Reviewed-on: https://go-review.googlesource.com/34924
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-09 17:48:59 +00:00
Chris Broadfoot
8b89e95de3 godoc/dl: change "All versions" to "Archived versions"
This change makes each release show only once on the whole page.
The current stable releases are not shown under the archive.

This change also fixes expandos to work correctly on IDs that are not
valid CSS selectors (i.e., "#go1.7.4") to ensure that the file listing
for a given version is expanded.

Updates golang/go#17574.

Change-Id: I7ff1041be3e0072286772ffa545a124764f81945
Reviewed-on: https://go-review.googlesource.com/34911
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-06 18:41:26 +00:00
Chris Broadfoot
2d7295cc9f godoc: allow nested toggles and toggles with <a name>
Toggles can now be nested within one another. They can also be
referenced using an <a> element with the name attribute, rather than
an element with the "id" attribute.

Updates golang/go#17574.

Change-Id: I43c17499a6879e983a79a74e14c99128296288e1
Reviewed-on: https://go-review.googlesource.com/34825
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-06 03:58:25 +00:00
Chris Broadfoot
4e83100c59 static: add underlines back to links in blog body
Specifically restricted to the "article" class, which is only used on
the blog.

Fixes golang/go#18302.

Change-Id: I5988c3df70f0de93d77544edf091640b0c5df30c
Reviewed-on: https://go-review.googlesource.com/34828
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-06 03:36:46 +00:00
Robert Griesemer
ae02084200 godoc: flip order of signature and doc string for functions and methods
This partially reverts https://go-review.googlesource.com/#/c/33279/
(which moved doc strings above the declaration for all kinds of objects)
by moving the doc string for functions and methods below the signature
where they traditionally were.

Fixes golang/go#18150.

Change-Id: Icbb9e7edcb3b34ad1d900acb3180217abdc56a16
Reviewed-on: https://go-review.googlesource.com/34332
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-12-13 20:58:18 +00:00
Kevin Burke
0a14ca4e16 godoc: don't select line numbers when highlighting source code
CSS3 introduces the user-select property, which you can use to prevent snippets
of text from being highlighted. This is also the technique used by Github to
avoid highlighting line numbers when highlighting source code.

For more information, see:

https://developer.mozilla.org/en-US/docs/Web/CSS/user-select
https://www.w3.org/TR/1999/WD-css3-userint-19990916#user-select

Fixes golang/go#18279

Change-Id: Ia5eb68d5a042d6ee2a1c8e7bbad753a35de5c487
Reviewed-on: https://go-review.googlesource.com/34278
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-12-12 20:17:32 +00:00
Kevin Burke
7932c3d4c8 godoc: Regenerate static/static.go
Picks up changes made in previous commits.

Change-Id: I8edc9e0a512e4d687c471274faaa06e0b40ea657
Reviewed-on: https://go-review.googlesource.com/34283
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-12 20:16:38 +00:00
Chris Broadfoot
c97d1a2623 godoc: add on-hover permalink anchors across the site
We already have anchors for godoc types and functions. Add them for
every heading (and "dl") on every other page on the site.

Change-Id: Ibad77f04442e48dd5a41de759010625f89b48604
Reviewed-on: https://go-review.googlesource.com/33641
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-29 00:47:29 +00:00
Luigi Riefolo
a829d47117 cmd/godoc: show comment before code block
The existing implementation shows a comment after its code block.
This causes confusion regarding how the comment relates to a code block.
Comments have been moved before their relative code blocks.

Fixes golang/go#16728

Change-Id: Ie07a6dd2f340a2555513662f263d26377060f93b
Reviewed-on: https://go-review.googlesource.com/33279
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-23 22:16:29 +00:00
Andrew Gerrand
681db090d9 godoc/static: use window scope for checking notesEnabled
This prevents a JS error when the notes are not present.

Change-Id: Ib8875306027b7e43441310d4228c690e2249056e
Reviewed-on: https://go-review.googlesource.com/24963
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-07-17 07:19:41 +00:00
Audrey Lim
19c2ab042a x/tools/present: display presenter notes and synchronize browser windows
Change-Id: If7d5cc52f7594c141060d40e8393ac69cb7ba9ad
Reviewed-on: https://go-review.googlesource.com/21488
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-01 05:16:27 +00:00
Konstantin Shaposhnikov
6eef0b4fad cmd/godoc: fix anchor links for constructors
Fixes golang/go#15866

Change-Id: I67f41026c64046ca581251fb0851d337d2651560
Reviewed-on: https://go-review.googlesource.com/23531
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-28 22:14:14 +00:00
nwidger
2c200eec40 cmd/godoc: Add anchor links to functions, types and methods
Added anchor link beside each function, type and method definition in
godoc's generated HTML.  Anchor links are only shown when the mouse is
hovering over the definition.  The link body is the Unicode PILCROW SIGN
character (&#xb6; HTML entity).

Fixes: golang/go#13748

Change-Id: I645269f6c229f76b2882899e1a7483577877ac30
Reviewed-on: https://go-review.googlesource.com/20246
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-05 16:36:38 +00:00
Simon Jefford
4b9c8b56b8 cmd/godoc: fix multi-paragraph marker rendering
Fixes golang/go#15231

Change-Id: Ia0e00f1eca41dfdd85158feb3fa300df40cfa185
Reviewed-on: https://go-review.googlesource.com/21972
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-14 23:55:41 +00:00
Andrew Gerrand
3868f57059 godoc/static: replace version strings with actual versions
This will allow the source installation instructions to
always show the current version, but only when that version
is a release version.

Fixes golang/go#14371

Change-Id: Ibfad8054f3c75d9320ca94ba5149ab9bf052157e
Reviewed-on: https://go-review.googlesource.com/22056
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-14 23:46:28 +00:00
Brad Fitzpatrick
093d7650ab Revert: godoc: Implement Unordered Output.
Revert https://go-review.googlesource.com/#/c/20458/3 (git rev 3d2dab63)

It doesn't compile.

Change-Id: I62fb10fe611e9ba0f599f037b03a91600b024d30
Reviewed-on: https://go-review.googlesource.com/20492
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-09 22:01:01 +00:00
Brady Catherman
3d2dab63d9 godoc: Implement Unordered Output.
When an Example's output is listed as being Unordered this will make
godoc display "Unordered output:" rather than the normal "Output:".

For an example of where this is useful, see the recently added example
for math.rand.Perm().

Change-Id: I737c901102dca46434f46a48300445bb43ce34e0
Reviewed-on: https://go-review.googlesource.com/20458
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-09 21:21:03 +00:00
Chris Broadfoot
3440805344 godoc/static: disable spellcheck on textareas
Fixes golang/go#14287.

Change-Id: I028eb6d669998b59e1bf1e3b40a337d5e28fbc57
Reviewed-on: https://go-review.googlesource.com/19430
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-02-10 23:35:39 +00:00
Andrew Gerrand
95cc01bac9 godoc/static: fix dd styles
This makes /doc/install/source render correctly.

Fixes golang/go#14104

Change-Id: I58a883abd875197064a5e120a47e5ea8faad7df9
Reviewed-on: https://go-review.googlesource.com/18955
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-27 04:50:12 +00:00
Timothy Studd
4ad533583d x/tools/godoc: fixed width limit for non-paragraph text
Change-Id: I6020e03959a434622e3e999e0054849f0bfb522f
Fixes: golang/go#13602
Reviewed-on: https://go-review.googlesource.com/18361
Reviewed-by: Francesc Campoy Flores <campoy@golang.org>
2016-01-09 02:08:43 +00:00
Andrew Gerrand
791f468ced godoc/static: show relevant test instructions on install page
Fixes golang/go#12490

Change-Id: Ifb408f225a84b3c5daf739e1e0afc4f5540e4ebd
Reviewed-on: https://go-review.googlesource.com/18278
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-07 01:41:21 +00:00
Tamir Duberstein
0f7bc42285 godoc/static: have makestatic use the same code header comment as stringer
This allows Github to hide diffs in generated files. See:
https://github.com/github/linguist/blob/473282d/lib/linguist/generated.rb#L241

Change-Id: I0565c729dacfa7861e7da7eb66bc8021d191fc3e
Reviewed-on: https://go-review.googlesource.com/15074
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-28 01:46:00 +00:00
Andrew Gerrand
1330b289ad godoc: hide and block share functionality from specific countries
This will permit us to serve *.golang.org to Chinese users.

Change-Id: I5217753aa67931522c7e6be106477534c99a20b2
Reviewed-on: https://go-review.googlesource.com/14194
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-02 05:52:45 +00:00
Nathan Youngman
6c9aff3429 website: fix JavaScript error on website and blog in non-ES6 browsers
In Safari a JavaScript error in personalizeInstallInstructions prevents
the featured articles from displaying. startsWith is an ES6-only feature.

Fixes golang/go#12283

Change-Id: I9f471362cdac0243758e482ed3a21b0d6aa48c8b
Reviewed-on: https://go-review.googlesource.com/13841
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-08-24 08:00:06 +00:00
Andrew Gerrand
7e0ad01d16 godoc/static: tweak regular expression to match source builds
(This time for sure!)

Change-Id: Ic9b7dbfb527af9aa029365f7a91bd3b949985431
Reviewed-on: https://go-review.googlesource.com/13220
Reviewed-by: Chris Broadfoot <cbro@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-08-05 07:07:08 +00:00
Andrew Gerrand
18635ec5c3 godoc/static: tweak regular expression to match old darwin builds
Change-Id: I74020ece0cf8b4aceb60d75475500569d08416ee
Reviewed-on: https://go-review.googlesource.com/13211
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-08-05 06:32:32 +00:00
Andrew Gerrand
a29e96e3bf godoc/static: redirect to download from installation instructions page
Change-Id: If29d04ced7404d6ba8761f734b4a16fe96959635
Reviewed-on: https://go-review.googlesource.com/13200
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-08-05 05:57:28 +00:00
Andrew Gerrand
46829bf9ce godoc/static: dynamically adjust install instructions for a given download
This change allows the download page to redirect the user to
/doc/install?download=filename so the user can see installation
instructions specific to the file they are downloading.

This is related to this change to the core repo:
https://golang.org/cl/13151

Change-Id: Ia81344ed913aea1d1a4deed021c0e07f7360ff68
Reviewed-on: https://go-review.googlesource.com/13180
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-08-05 04:18:54 +00:00
Andrew Gerrand
bbc4202318 godoc/static: shorten vertical space above headings
Without this change, a h3 below a h2 looks weird.

Change-Id: I96cd1545615547b03460cf6896acd0df1abfc1a1
Reviewed-on: https://go-review.googlesource.com/13052
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-08-03 23:58:58 +00:00
Jeff R. Allen
06e42bd9eb tools/godoc: list all sub-repos
The list of sub-repos at the bottom of the /pkg
page is unfortunately hand-maintained. With this
commit, it is now up-to-date and ready to get out
of date again.

Fixes golang/go#9081.

Change-Id: I3dc5e11ed65f53ea7299a259575ebcb6ad6b13ec
Reviewed-on: https://go-review.googlesource.com/12512
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-29 07:17:33 +00:00
Andrew Gerrand
0f0e72bcc3 godoc/static: fix handling of playground snippets with no output
Fixes golang/go#11903

Change-Id: Ia7f85d83f1f697fd787a87cd74971f6cf0540792
Reviewed-on: https://go-review.googlesource.com/12751
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-28 06:47:23 +00:00
Michael Stapelberg
4d49207e6b fix typo: s/connnection/connection/
Change-Id: Ib59dd669cf44b10f5ba811b4916721e6aea611d7
Reviewed-on: https://go-review.googlesource.com/12630
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-24 17:26:06 +00:00
Matthew Holt
9febd36660 tools/godoc: Fix indentation in doc contents
Mobile-friendly design overlooked indentation in table of contents
for article table of contents; this change restores indentation.

Change-Id: I9a3013497e1659ebfb657a8fb9374b8ad9b04b16
Reviewed-on: https://go-review.googlesource.com/11582
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-28 23:35:27 +00:00
Matthew Holt
f671283c22 tools/godoc: Mobile-friendly site design
This change makes golang.org responsive, including a top
bar menu and appropriate font sizing. The result is a
website that looks pleasing and is functional both on
mobile and on desktop. Also added a few print styles so
the site looks great on paper or PDF.

Change-Id: I16ee25ef4afde2002f240aec0804414bfb172a24
Reviewed-on: https://go-review.googlesource.com/9062
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-06-24 07:57:00 +00:00
Shenghou Ma
cd3ef3b6f0 godoc/static: set explicit page background color
Fixes golang/go#10961.

Change-Id: I3fc947bb18535853b278bad5fa449cf259eba59c
Reviewed-on: https://go-review.googlesource.com/10451
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-05-28 01:09:23 +00:00
Sebastien Binet
473fd854f8 godoc/static: insert newlines in -src mode
Running 'godoc -src' would end up with concatenated sources:

$ godoc -src github.com/bradfitz/http2 Frame
// a frameParser parses a frame given its FrameHeader and payload
// bytes. The length of payload will always equal fh.Length (which
// might be 0).
type frameParser func(fh FrameHeader, payload []byte) (Frame, error)//
A Frame is the base interface implemented by all frame types.
// Callers will generally type-assert the specific frame type:
// *HeadersFrame, *SettingsFrame, *WindowUpdateFrame, etc.
//
// Frames are only valid until the next call to Framer.ReadFrame.
type Frame interface {

Unconditionnally insert two newlines:

$ godoc -src github.com/bradfitz/http2 Frame
// a frameParser parses a frame given its FrameHeader and payload
// bytes. The length of payload will always equal fh.Length (which
// might be 0).
type frameParser func(fh FrameHeader, payload []byte) (Frame, error)

// A Frame is the base interface implemented by all frame types.
// Callers will generally type-assert the specific frame type:
// *HeadersFrame, *SettingsFrame, *WindowUpdateFrame, etc.
//
// Frames are only valid until the next call to Framer.ReadFrame.
type Frame interface {

Fixes #9726.

Change-Id: I51ee04e53d4962c890ea601125eda8fce84d6a46
Reviewed-on: https://go-review.googlesource.com/7681
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-03-18 17:28:59 +00:00
Péter Surányi
705f1dfb24 godoc/static: fix variable reference in search.txt
Change to match searchdoc.html which works.
(Was referring to "$val.Idents" in line 26, but "$val" here is
already an element of Idents.)
Also clarify naming and comments for makestatic.

Fixes golang/go#10022.

Change-Id: Ia3f2fdadd5d10f31a1825e8db966b6e92da2b93e
Reviewed-on: https://go-review.googlesource.com/6236
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-02 02:09:35 +00:00
Andrew Gerrand
5ebbcd132f go.tools: use golang.org/x/... import paths
Rewrite performed with this command:
  sed -i '' 's_code.google.com/p/go\._golang.org/x/_g' \
    $(grep -lr 'code.google.com/p/go.' *)

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/170920043
2014-11-10 08:50:40 +11:00
Alan Donovan
b94e29089b godoc: run bake.sh again.
CL 141540043 was half-baked.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/142130043
2014-09-15 13:13:07 -04:00
Alan Donovan
ebc87c5c5e godoc: fix bug in "internal call graph" tree widget.
Today I learned that getElementByClass returns an
HTMLContainer, not an array, so the for loop was iterating its
properties, which include:
- the methods of the type, which were filtered out by the condition;
- the array-like integer indices of the elements, which we want;
- the ids of the same elements (!), which we weren't expecting.
The net result is that various functions were called twice,
causing the tree to be double-populated and clicks to cause
and expand+collapse.

It's a miracle to me that any JS program even approximately works.

Fixes golang/go#8237

LGTM=bradfitz
R=gri, bradfitz
CC=golang-codereviews
https://golang.org/cl/141540043
2014-09-15 13:00:40 -04: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
Andrew Gerrand
96adaa5618 go.tools/godoc: remove Google+ buttons
LGTM=bradfitz
R=golang-codereviews, bradfitz, dsymonds
CC=golang-codereviews
https://golang.org/cl/138180043
2014-09-08 10:05:20 +10:00
Andrew Gerrand
277e5a16d7 go.tools/godoc: mention sub-repos and package indexes on packages page
Also several cosmetic tweaks to the package page.

LGTM=r, bradfitz
R=bradfitz, r
CC=golang-codereviews
https://golang.org/cl/128490043
2014-08-21 09:53:57 +10:00
Francesc Campoy
82b913fb17 playground: add ctrl-enter shortcut for gofmt (as in the tour)
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/120420044
2014-08-04 15:55:39 -07:00
Andrew Gerrand
8aabc9a084 go.tools/godoc: drop scheme from links
golang.org now serves HTTPS,
so the scripts should work
with either HTTP ot HTTPS.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/111640043
2014-07-25 10:27:31 +10:00