Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/cmd/godoc: Current online source code site makes it difficult to copy blocks of code #9042

Closed
gopherbot opened this issue Nov 2, 2014 · 6 comments

Comments

@gopherbot
Copy link

by mark@wolfe.id.au:

Whenever i copy and paste blocks from http://golang.org/src I get line numbers with it,
which i have to cleanup.

Would be great if the #golang online src was easier to copy and paste from similar to
the way github shows sources.

To reproduce navigate to
http://golang.org/src/pkg/net/http/server.go?s=53505:53596#L1942 and copy then paste a
block, in this case the handy internal tcpKeepalive helper. 

Cheers
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-tools, release-none.

@gopherbot
Copy link
Author

Comment 2 by mark@wolfe.id.au:

Started trying to fix this myself by moving the code into a table and putting the line
numbers in one column, and code in another however as soon as I change tags they aren't
emitted. 
And I have NO IDEA why!?
Currently using the code layout on https://bitbucket.org as a starting point as it is
neat and simple, and has the desired behaviour.

@gopherbot
Copy link
Author

Comment 3 by mark@wolfe.id.au:

After some work to make this work while retaining styling for code in other places I
have a patch which demonstrates the new view.
This supports just copying the code.
Note: This will require you to run bake.sh to regenerate static.go under
code.google.com/p/go.tools/godoc/static.
Cheers

Attachments:

  1. table_based_source_view.diff (7225 bytes)

@davecheney
Copy link
Contributor

Comment 4:

Hi Mark,
I'm sorry but we cannot accept patches via the issue tracker, please follow the
contribution guidelines here, http://golang.org/doc/contribute.html

@gopherbot
Copy link
Author

Comment 5 by mark@wolfe.id.au:

I have submitted a patch for this https://golang.org/cl/169300043/

@bradfitz bradfitz removed the new label Dec 18, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc removed the release-none label Apr 10, 2015
@rsc rsc changed the title cmd/godoc: Current online source code site makes it difficult to copy blocks of code x/tools/cmd/godoc: Current online source code site makes it difficult to copy blocks of code Apr 14, 2015
@rsc rsc removed the repo-tools label Apr 14, 2015
@ALTree
Copy link
Member

ALTree commented Jan 7, 2017

Same as #18279, fixed by golang/tools@0a14ca4.

@ALTree ALTree closed this as completed Jan 7, 2017
@golang golang locked and limited conversation to collaborators Jan 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants