1
0
mirror of https://github.com/golang/go synced 2024-09-30 22:48:32 -06:00
Commit Graph

105 Commits

Author SHA1 Message Date
Andrew Bonventre
25101aadb9 godoc,cmd/getgo: update download links to dl.google.com
Change-Id: Idd003c76edbf9d3ecf3354036e734386c55ed1f2
Reviewed-on: https://go-review.googlesource.com/89695
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-25 02:56:30 +00:00
Andrew Bonventre
b790d0ba03 godoc: set proper content-type header on share request
When sending the request to /share, it defaulted to
application/x-www-form-urlencoded. This caused the body to be
empty since it was sending a form with the actual code as a
key in the r.Form map.

Set the content type explicitly to text/plain.

Fixes golang/go#21691

Change-Id: I0d5981d9c9aa901010af65b0d0a7670870b77f2b
Reviewed-on: https://go-review.googlesource.com/86317
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-01-05 03:31:22 +00:00
Andrew Bonventre
64890f4e2b godoc: fix missing search icon on /dl and correct borders
Some default browser stylesheets set a border radius on <button>
elements that was not being overridden in style.css. The button
should not have any border radii on the left as it should look
like an extension of the search field.

Change-Id: I458bd2e3a903a4c1dd246ff0304e7d3cf29c0988
Reviewed-on: https://go-review.googlesource.com/83296
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-12-11 20:09:31 +00:00
Andrew Bonventre
9b61fcc4c5 Revert "godoc: better distinguish links and link state"
This reverts commit 9bd2f44268.

Reason for revert: https://github.com/golang/go/issues/22171#issuecomment-339125376

Update golang/go#22171

Change-Id: I41da526912b3484721782e0dad02d97ab2845a12
Reviewed-on: https://go-review.googlesource.com/73151
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2017-10-24 20:47:20 +00:00
Andrew Bonventre
5ec91747d9 Revert "godoc: accessible permalinks"
This reverts commit f57adc1821.

Reason for revert: See https://github.com/golang/go/issues/22171#issuecomment-339125376 for reasoning.

Change-Id: Ifd81ad716cf2acdf7a1d73602ac781186aca5596
Reviewed-on: https://go-review.googlesource.com/73150
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2017-10-24 20:46:10 +00:00
jimmyfrasche
9bd2f44268 godoc: better distinguish links and link state
There were two issues with links in godoc:

1) They were only distinguished from ordinary text only by color,
affecting those with color-vision deficiencies.

2) The same blue used for links is used by non-links,
affecting everybody.

This change adds a an underline to all links.

Usually, it is safe to skip underlining in locations where it clear
that the only contents are navigational links, such as #pkg-index.
However, (2) prevented this.

To work around this I used some less well supported CSS techniques:
http://caniuse.com/#feat=text-decoration

Less capable browsers, which are unlikely to be used by developers, may
have a less than optimal experience, unfortunately. In more capable
browsers, including those without full support, the experience is quite
pleasant and the additional underlying does not interfere with the godoc
aesthetic.

For golang/go#22171

Change-Id: I5a0d817793e8aa31912ba065b4e5a63d4a3f138c
Reviewed-on: https://go-review.googlesource.com/69150
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2017-10-13 18:14:03 +00:00
jimmyfrasche
5d186094d5 godoc: add label and button to search bar
To increase accessibility of the search bar,
an aria-label for screen readers and a submit
button was added.

The search field was given the semantically correct
input type and marked required field as hints to UAs
that can use that to provide context to the user.

The placeholder text was restyled for improved contrast.
The javascript for handling placeholders was removed
as it is no longer necessary.

For golang/go#22171

Change-Id: I8db6428bb727a09e7f175e77100b4bcf9b6a5f3e
Reviewed-on: https://go-review.googlesource.com/69190
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2017-10-13 18:09:24 +00:00
jimmyfrasche
f57adc1821 godoc: accessible permalinks
This CL makes permalinks accessible to keyboard-users and screen
readers.

Adding an aria-label to permalinks overrides the default content
of "pilcrow".

As the permalinks only showed on hover they were inaccessible
to users who could only use a keyboard and are now always shown.

For golang/go#22171

Change-Id: I6ce3828dfedfd7edc29dd16f3eb94a0abcabfc7c
Reviewed-on: https://go-review.googlesource.com/69210
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2017-10-12 15:25:11 +00:00
Ben Haines
a567bbf739 godoc: avoid skipping heading level in package docs
The heading of the #pkg-index section of package documentation pages
uses an h2 heading but its 'Examples' and 'Package files' subsections
use h4 headings, skipping the h3 level.

This change switches the h4s to h3s and adds styling to preserve the
current font-size with the new heading level.

For golang/go#22171

Change-Id: Ifd2cacab22c1e82fd6f061b9322523fa5859a80f
Reviewed-on: https://go-review.googlesource.com/69171
Reviewed-by: jimmy frasche <soapboxcicero@gmail.com>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2017-10-09 17:51:41 +00:00
jimmyfrasche
0b88a3aa07 godoc: add alt attr to gopher on main package index
The gopher with a miner hat on /pkg had no alt attribute
so screen readers would announce the image by its filename.
As the image is purely decorative, adding the empty string
as alternative text prevents the image from being announced.

For golang/go#22171

Change-Id: Ib214f296d3d9f9084c44d4e33d1cbe432f2183ed
Reviewed-on: https://go-review.googlesource.com/69130
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-07 23:17:17 +00:00
Martin Möhrmann
421c33e678 godoc: update out of sync static.go
Replace references to Share by GoogleCN.

Fixes golang/go#21725

Change-Id: I6db4aa282cca7c104cbe34b40d152aa53ce07280
Reviewed-on: https://go-review.googlesource.com/60851
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2017-09-01 14:00:58 +00:00
Andrew Bonventre
2d19ab38fa godoc: hide link to blog in header in CN
Change-Id: I952ce003edecdd62179a8dfbc3c0e56f78eecfb1
Reviewed-on: https://go-review.googlesource.com/60071
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-29 20:47:10 +00:00
Andrew Bonventre
4e70a1b26a godoc: add GoogleCN property to pages
Use that property to determine whether to show share functionality
or link to sites that are blocked in mainland China.

This change requires https://go-review.googlesource.com/c/52872

Change-Id: I47327f9dbd2624206564fa99eb1cc6a10b4f46db
Reviewed-on: https://go-review.googlesource.com/52873
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-08-02 21:09:52 +00:00
Sina Siadat
5128de7288 godoc: add links to docs in text and dir pages
Fixes golang/go#17125

Change-Id: I22dd0561cd1c8eb30524797b6c0488d08a65285b
Reviewed-on: https://go-review.googlesource.com/29279
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-16 21:49:54 +00:00
Kevin Burke
75e5ff36f3 godoc: make line numbers unselectable
Insert line numbers via a ::before pseudo-element so you can't select
them when you copy text. See the code comment for more information.

Fixes golang/go#20077.

Change-Id: I24a5b17786a52c8107b4f830e824526ba03bc38d
Reviewed-on: https://go-review.googlesource.com/41418
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-25 02:28:06 +00:00
Kevin Burke
620ecdb8d7 all: apply new machine-generated doc spec to files
Updates golang/go#13560.

Change-Id: I1664807a065c7982a57d4dc9cee22ce261536c5b
Reviewed-on: https://go-review.googlesource.com/39202
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-01 01:24:29 +00:00
Kevin Burke
2946dd1f77 godoc/static: add license preamble to static file
Change-Id: Icfdb6b544ff8613efc5a183d50efe6bb92dc6784
Reviewed-on: https://go-review.googlesource.com/38165
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-16 00:32:22 +00:00
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
add1aac04e static: don't use the jQuery func for looking up based on hash
$.find is safer.

Change-Id: I51893b64ce804ac5a70f780a1255af2c91413110
Reviewed-on: https://go-review.googlesource.com/35430
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-18 20:16:46 +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
Konstantin Shaposhnikov
3560419ce9 godoc/static: makestatic.go: gofmt generated code
Change-Id: Ibe0948fa283af94b1213e9ef344ef9eda6e59c05
Reviewed-on: https://go-review.googlesource.com/23532
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-28 22:13:57 +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