docmeta / rubydoc.info

Next generation rdoc.info site
http://rubydoc.info
MIT License
132 stars 43 forks source link

Fixes GitHub links #103

Closed TheLonelyGhost closed 4 years ago

TheLonelyGhost commented 8 years ago

Link "View on GitHub" ends up on a 404 page due to change in GitHub's URL structure. /blob/ changed to /tree/ is all a false assumption that the version would be in the rubydoc.info url. Since it's not, I've made it pull that value from the page content instead.

Also includes #102 because I couldn't run it locally without that change. Feel free to rebase it out.

TheLonelyGhost commented 8 years ago

Ack! Looks like this fix isn't right. JavaScript is parsing out the URL path to find the commit which is breaking things in this example: http://www.rubydoc.info/github/mongodb/mongoid/Mongoid/Relations/Macros/ClassMethods:has_many

lsegal commented 8 years ago

FWIW there's an outstanding bug that affects URLs on rubydoc that don't have the branch in them (i.e. omitting /master). It would be great to address that here too, and may be related to your issue.

lsegal commented 8 years ago

See #91

TheLonelyGhost commented 8 years ago

Good catch. I searched for the bug before this, but didn't find anything. That's exactly the issue I'm encountering.

TheLonelyGhost commented 8 years ago

I'm having trouble going directly to any of the versions besides master so I wholeheartedly welcome testing by others. Seems to work fine for master and should, in theory, work for other refs so long as they're properly detected and echo-ed into the breadcrumbs at the top of the page.