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

'View Source' links to Github not working on many repos #91

Closed
tinco opened this issue Mar 26, 2015 · 11 comments
Closed

'View Source' links to Github not working on many repos #91

tinco opened this issue Mar 26, 2015 · 11 comments

Comments

@tinco
Copy link

tinco commented Mar 26, 2015

Hi,

I'm not sure if this is a known problem or perhaps someone elses problem, for a while I've noticed many view source on github urls to be broken. An example of a page that has broken links is this one:

http://www.rubydoc.info/github/carlhuda/bundler/Bundler/GemHelper

There are many more.

Is this the right place to report this? Is this a problem with Rubydoc.info, or are these docs out of date and should I file an issue with the creator of the github project?

@jirutka
Copy link

jirutka commented May 9, 2015

I have the same problem with my projects.

@lsegal
Copy link
Collaborator

lsegal commented May 19, 2015

GitHub links only work when the branch name is part of the URL. This is something we could fix by inferring master, but it would never be 100% reliable. The easy fix is to ensure you're browsing from the rubydoc generated URLs, which always include the branch name / ref you're viewing:

http://www.rubydoc.info/github/carlhuda/bundler/master

@jirutka
Copy link

jirutka commented May 19, 2015

Thanks for your advice, it works! However, this should be written in some FAQ…

@TheLonelyGhost
Copy link
Contributor

@lsegal Going from the search section of rubydoc.info into the docs for a particular repository actually end up on the page without the ref.

http://www.rubydoc.info/find/github?q=mongoid

@lsegal
Copy link
Collaborator

lsegal commented Dec 28, 2019

Closing out this old issue due to inactivity. If this report is related to a production issue on rubydoc.info, it is very likely that the issue has since been resolved. If the issue is still persisting, feel free to comment or file an updated issue.

@lsegal lsegal closed this as completed Dec 28, 2019
@heynan0
Copy link

heynan0 commented Jul 1, 2020

I was looking at the documentation for capybara and ran into this issue. The links to view source on GitHub do not work. They use "Capybara" instead of the branch name "master" (replacing that in the redirected url fixes it).

[...] The easy fix is to ensure you're browsing from the rubydoc generated URLs [...]

@lsegal, How can one go about doing that through the web interface without having to manually type in the branch name? It seems that the interface already knows about the branch yet redirects without its name. See example screenshot with oval highlight:

Screen Shot 2020-06-30 at 5 46 40 PM

@lsegal
Copy link
Collaborator

lsegal commented Jul 1, 2020

@heynan0 you're right, this is something that can be fixed if the layout template made the current active library version available to the rest of the JS scripts running on the page. It was something I was about to pick up a few weeks ago actually but it fell off my plate.

The process would be roughly:

  1. Override the breadcrumb.erb (or any of the header) template(s) in layout (this is the directory but you would need to add the appropriate .erb files documented here)
  2. Set some variable on window that contains the library version. You can look at YARD's own breadcrumb template when you override to see where it's coming from and just put that into a variable.
  3. Jump into https://github.com/docmeta/rubydoc.info/blob/main/templates/default/fulldoc/html/js/rubydoc_custom.js and use that variable.

Overall not that difficult but haven't had a chance to sit down and solve this.

@lsegal
Copy link
Collaborator

lsegal commented Jul 1, 2020

Ok yes VERY easy indeed ^

@lsegal
Copy link
Collaborator

lsegal commented Jul 1, 2020

This is live now btw.

@heynan0
Copy link

heynan0 commented Jul 1, 2020

@lsegal it works fine now. Thank you very much for fixing it! :)

@tinco
Copy link
Author

tinco commented Jul 2, 2020

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants