1
0
mirror of https://github.com/golang/go synced 2024-11-05 20:06:10 -07:00
Commit Graph

129 Commits

Author SHA1 Message Date
Andrew Bonventre
0700b576e4 godoc: don't display tar instructions for malformed download query
Ensure that the filename passed via ?download= matches the given
regexp before showing the command-line instructions to download it.

Change-Id: Ieb7c6912409474f31637ff1193fd195eb9f172b3
Reviewed-on: https://go-review.googlesource.com/126717
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-07-30 21:13:59 +00:00
Devon H. O'Dell
57f659e14d godoc: show version information for stdlib
This change reads $GOROOT/api/go1.*.txt when godoc starts and caches
information about which versions of Go introduce functions, types, and
methods. This information is displayed currently only in HTML output.
Functions, types, and methods introduced as part of Go 1 are not
annotated, as their presence at that version is implied.

This change does not address constants or variables, and completely
ignores the syscall package. The former are future work, the latter is
likely an exercise in futility. In all cases, this is because the story
around displaying the version information is not well developed.

Fixes golang/go#5778

Change-Id: Ieb3cc0da7b18e195bc9c443f14fd8a82e8b2bbf8
Reviewed-on: https://go-review.googlesource.com/85396
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Devon O'Dell <dhobsd@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-17 18:09:30 +00:00
Alan Donovan
53440098a4 godoc/static: resolve merge conflict, committed in error
Change-Id: Ica50edbae03eb1c6efad702841b926ffaf1c98ec
Reviewed-on: https://go-review.googlesource.com/119476
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-06-18 17:10:13 +00:00
Alan Donovan
e10d6c9a84 godoc/static: use a stable quote function
Printf(%q) aka strconv.AppendQuote depends on the Unicode tables du
jour, which means gen_test breaks after a Go release in which Unicode
evolves. This change uses a very dumb quotation function that emits
only ASCII and is independent of the Go release.

Perhaps an even better fix would have been to parse the generated file.

Change-Id: I197942f1c36a8b53d6a37be4bb2b1e63a208f7e2
Reviewed-on: https://go-review.googlesource.com/119157
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-18 16:36:09 +00:00
Agniva De Sarker
465e6f3992 godoc: add link to expand/close all examples
Fixes golang/go#3081

Change-Id: I096b22691a08d72b88dbe925e17893d24ba3c992
Reviewed-on: https://go-review.googlesource.com/118935
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-15 19:57:36 +00:00
Alan Donovan
903a227b9b godoc/static: mimic the pre-1.10 behavior of strconv.Quote
Thanks to iant for identifying the root cause.

Tested with go1.9 and go1.10.

Fixes golang/go#25880

Change-Id: Ibc3a2aadd92c1e512cf6c537134ee085398e8e6c
Reviewed-on: https://go-review.googlesource.com/118955
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 19:21:16 +00:00
Alan Donovan
49ce10d933 godoc/static: suppress gen_test on go1.9
Either string quotation or Go formatting has since changed.
Will investigate later, but this fixes the dashboard for now.

Change-Id: Ieab3800fc2c24ba86026d25dea12853131c04948
Reviewed-on: https://go-review.googlesource.com/118715
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-06-14 18:36:27 +00:00
Yury Smolsky
a5b4c53f6e playground.js: display vet errors when program has no output
When program has no output and vet errors are encountered,
initialize data.Events as an empty array.

Fixes golang/go#25455.

Change-Id: Icedd77685b784505da3bb6383629cdfa8b8b22e9
Reviewed-on: https://go-review.googlesource.com/113875
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-05-25 02:41:13 +00:00
Yury Smolsky
48418e5732 godoc: display "go vet" errors before the output of a program
This change adds an option to run "go vet" for the playground program
and display errors before any output. To enable this, the playground
function has to be supplied with opts.enableVet set to true.
Vet check is performed only for succesfully run programs,
meaning that the "/compile" endpoint returned no errors.

This change highlights lines printed to stderr as errors (in red).

There is a corresponding change for the Playground: CL 100776.

Updates golang/go#7597
Updates golang/go#24576

Change-Id: I8c0f8c1189c461338b5bce57777b12aecab268fb
Reviewed-on: https://go-review.googlesource.com/107455
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-05-08 19:22:17 +00:00
jimmyfrasche
76f5b51ce4 x/tools/godoc: make front page video respond to layout changes (2/2)
This part of a multi-repo change. See CL 108677 for details.

Note: this change also requires a CL to golang/go to complete the fix,
though either CL without the other is harmless.

Updates golang/go#24997.

Change-Id: I99ca9a4e6df16347b8706f24cef9689b3345854a
Reviewed-on: https://go-review.googlesource.com/108678
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-05-08 19:21:29 +00:00
Agniva De Sarker
ae8027637c godoc/static: add test for static.go file generation
Moved the code which generates static.go to remain in the static package.
This makes the code testable.

Additionally, it is very easy for developers to forget to run "go generate"
to update static.go. Because while development, the templates directory
can be directly passed as a flag to read the files from it.

This test catches that.

Change-Id: I314907b98907bb14e4eabfd3c532ba2d84ce7c5f
Reviewed-on: https://go-review.googlesource.com/110158
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-03 19:34:25 +00:00
Jeevanandam M
f4ce24f1d8 godoc/static: cleanup unused lines in makestatic.go
Change-Id: I9b930efb5efd4b32c41c40d2399e04bacd75b470
GitHub-Last-Rev: 53db7899927e5ae255310c6a765526a10552649f
GitHub-Pull-Request: golang/tools#36
Reviewed-on: https://go-review.googlesource.com/111155
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-03 05:28:33 +00:00
Agniva De Sarker
8e070db38e godoc: remove vendor prefixes for border-radius
All major browsers support the border-radius directive
without any vendor prefix. Hence, removing them.

https://caniuse.com/#search=border-radius

Change-Id: I2da5f109296df3c7f191df95876bd6849f51d9ae
Reviewed-on: https://go-review.googlesource.com/110155
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-28 22:29:17 +00:00
Agniva De Sarker
0b5ca0b040 godoc: use relative css unit
To scale the website elements independently of the default font size,
we use the css rem unit. This scales the elements proportionally if the
user has set a different font size than the default.

We make all calculations assuming that 1rem=16px, which is the
default font size for browsers.

Tested manually on FF 59 and Chrome 65 with permutations of different
resolutions and different default font-sizes upto 36px.

Fixes golang/go#6150

Change-Id: I7ded227ee2c55178271667009ab98ee0b4e7e8b3
Reviewed-on: https://go-review.googlesource.com/94935
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-04-27 00:46:46 +00:00
Agniva De Sarker
8b3cccae50 godoc/vfs: improve implementation of RootType
- Removed the StandAlone and Asset root types as they were just there
for other vfses to satisfy the FileSystem interface and causing unnecessary
confusion. Returning just empty strings in those scenarios now to clarify
that it is a dummy placeholder.

- Removed the prefix "Fs" from RootType as it was unnecessary.

- Using the RootType type to pass down to the html templates
instead of converting to string. The templates are capable of converting
to the actual string representation when comparing the value.

Change-Id: Iadc039f1354ecd814eec0af1e52cdbaaeff0cc89
Reviewed-on: https://go-review.googlesource.com/106196
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-11 20:41:25 +00:00
Agniva De Sarker
faed997d2c godoc: cleanup package templates
Separate the templates of package root directory and other
directories. This removes several if-else conditions and
makes the template code much cleaner.

To be merged after CL 95835.

For golang/go#3305

Change-Id: I435441dbe214e4c89271483173df7c30a42ee28f
Reviewed-on: https://go-review.googlesource.com/101295
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-04-10 16:42:09 +00:00
Agniva De Sarker
16d1af8d88 godoc: group package home page list by root
This CL groups the package list into two groups - standard library(GOROOT),
and third-party code(GOPATH).

It also wraps the list with a collapsible div header used in the package
documentation page. This makes the entire page easy to view and manage, and also
makes it consistent with the rest of the pages.

To implement this, a new function was added to the filesystem interface
which returns the root type of the filesystem. In most cases, it is either GOROOT
or GOPATH. There are other kinds of filesystems which are not used in the home page,
so additional values have been added to satisfy the interface.

A side effect of this is that the html template code has become a bit spaghetti-like
with if conditions all over. This is because the same template is used to render
a package directory as well as the package home page. A better way is to use
two separate templates for the different tasks. This cleans out a lot of the
if conditions and make for a much cleaner code. This has been taken care in CL 101295.

Fixes golang/go#3305
Fixes golang/go#15020

Change-Id: I876357dc76280a7df2ed08d7c6bc53d9a41e69ab
Reviewed-on: https://go-review.googlesource.com/95835
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-04-10 16:41:40 +00:00
Dmitri Shuralyov
370143dbca godoc/static: add perf, review, sync subrepos
They exist and are considered to be worth listing based on the decision
made in golang/go#24432. They weren't listed previously. This change
fixes that.

Document the remaining subrepos that are not meant to be listed (per
decision in golang/go#24432), so it's clear that it's intentional for
them to not be visible at https://golang.org/pkg/#subrepo.

Closes golang/go#24432.
Updates golang/go#14304.

Change-Id: Icc50ebfcdbc490c32519d92a1a838eb3f54c823d
Reviewed-on: https://go-review.googlesource.com/103075
Reviewed-by: Austin Clements <austin@google.com>
2018-03-30 16:45:20 +00:00
Yury Smolsky
4c0f0e48a6 godoc: add vet support to playground.js
Playground needs godoc to support calls to /vet endpoint in playground.js.
Optional parameter "vetEl" is added to the function "playground".
If it's passed then the js installs the click handler to the element.

There is a corresponding CL 100776 for the playground code.

Updates golang/go#7597

Change-Id: Ica2e7cb9d76f6f19a1805c182e666b8142762da9
Reviewed-on: https://go-review.googlesource.com/100775
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-03-23 17:42:02 +00:00
Dmitri Shuralyov
14b3f5b193 godoc/static: add x/time subrepo
It exists, but wasn't listed previously. This change fixes that.

Fixes golang/go#24430.

Change-Id: Iaf83a4b7353794e6f411941de811ed1554955179
Reviewed-on: https://go-review.googlesource.com/101241
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-17 16:38:46 +00:00
Agniva De Sarker
5ad4d95e58 godoc: add the defer attribute to script tags
This allows the scripts to be downloaded concurrently as the
body is being parsed.

Deferred scripts are executed in order and only after the entire
document has been loaded. So essentially the entire effect remains same
but we reduce the network download time.

Also, CL 90396 missed out updating static.go. Packaging the change along
with this.

Change-Id: Ia850bd50b49f2a9e0e4fbc29617858ab0fa8a0b9
Reviewed-on: https://go-review.googlesource.com/100295
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-03-15 17:24:39 +00:00
peter zhang
10db2d12cf cmd/present: support being reverse proxied from https
Fixes golang/go#21921

Change-Id: Idc6ff2773dcef7210ce4d0eecb7affb357a213b5
GitHub-Last-Rev: 50b959e9b6f2f1513235c5ca0124d80b487c5296
GitHub-Pull-Request: golang/tools#26
Reviewed-on: https://go-review.googlesource.com/96295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-26 18:43:58 +00:00
Agniva De Sarker
ce871d1788 godoc: allow line numbers to be searched by ctrl+f
We used a css-pseudo class rule to move the line number inside
the pseudo element. The idea was to prevent line numbers from getting
selected while copying the code. But this was already implemented
with the "user-select: none" rule.

Since the spec was undefined on "user-select", we had to resort
to the pseudo-class, but now both FF and Chrome implement the correct
behavior.

Hence, moving the content to be inside the span, and removing the
pseudo-class rule.

Manually tested with Chrome 63 and Firefox 58 on Ubuntu.

Fixes golang/go#23724

Change-Id: I3e733db766b44875ba6bc3f6985cde2559d116e2
Reviewed-on: https://go-review.googlesource.com/93975
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-02-15 02:55:20 +00:00
Agniva De Sarker
7374a09fcc godoc: move package example section
The example_html was being rendered outside the ".expanded" div which
did not hide it when the parent Overview div was being hidden. Moving it
inside the div so that the behavior is consistent

Fixes golang/go#23590

Change-Id: I75ee0af1c4074e02629b84ce366b34711e6d823b
Reviewed-on: https://go-review.googlesource.com/90396
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-02-14 17:36:17 +00:00
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