mislav / hanna

More than just a new RDoc template
MIT License
234 stars 40 forks source link

Links to Github source #17

Open rubiii opened 14 years ago

rubiii commented 14 years ago

hey mislav,

first of all: i love your template. thanks for that!

i'd like to request a feature which i found really useful when working with railsapi.com ( http://railsapi.com/doc/rails-v2.3.5 ). every method is linked to its class on github. there's a small "on Github" link after "source".

please let me know if this could be included in hanna and if you need any help.

mislav commented 14 years ago

RDoc supports the "--webcvs" parameter, and Hanna template renders it if I'm not mistaken. Read hanna --help for more info about how to use the parameter and check if it looks good when docs are generated.

Now, railsapi links every method to a specific line on GitHub. This currently isn't implemented, but this would be a welcome addition if you want to give it a stab.

rubiii commented 14 years ago

i'll give it a try! you can consider this feature request closed if you like. will get back to you when the feature is implemented.

mislav commented 14 years ago

It will stay open until the feature is done (or abandoned)

rubiii commented 14 years ago

after digging through lots if code, i think the best way to support this is to extend the webcvs option of rdoc (thanks for pointing me into this direction). by extending rdoc, every template can benefit from this new feature and i hope to see hanna default to rdoc >= 2.4 soon :)

rubiii commented 14 years ago

digged through even more code. both rdoc and hanna and realized that extending rdoc does not really help.

so i added 'view online' links to every method in hanna. the links are pointing to the webcvs file of the class/module and i appended a '#L' followed by the line of code of the method. the commit can be found at: http://github.com/rubiii/hanna/commit/c234a4963522a2be2307a621a2b802dc234a6ea8

this convention currently works for github and i can't think of any other major online code respository to support. so please post a comment if you want this to work for any other service.

also, the implementation of the feature might not be the best solution, but this is your chance to correct me :)