zapnap / rdocinfo

New development has moved to http://github.com/lsegal/rubydoc.info
http://rdoc.info
MIT License
18 stars 3 forks source link

No support multi-word links in RDoc #27

Closed norman closed 14 years ago

norman commented 14 years ago

Your RDoc compiling does not properly support multiword links. For example, my project's RDocs render like this:

Want to find out more? Read on. The {most recent version of the FriendlyId RDocs}[http://friendly-id.rubyforge.org] can always be found on Rubyforge[http://www.rubyforge.org].

This was also an issue on Github a few months back, and I gave them the following example code for them to fix it, which they applied:

require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_html'
require 'rdoc/generators/html_generator.rb'
require 'ostruct'

text = IO.read("/dev/stdin")
simple_markup = SM::SimpleMarkup.new
generator = Generators::HyperlinkHtml.new(nil, OpenStruct.new)
simple_markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK)
simple_markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\.\S+?\])/, :TIDYLINK)
puts simple_markup.convert(text, generator)

It would be great if you could get this added. I'm currently migrating all my projects away from Rubyforge and would like to make rdoc.info the place I tell all my users to go to read my documentation. At the moment, this is only thing holding me up.

Thanks a lot for offering such an excellent free service!

zapnap commented 14 years ago

Is the issue you're seeing specific to rdoc.info or a general YARD markdown issue? I'm assuming the latter but just wanted to make sure. I'll check it out this weekend.

norman commented 14 years ago

I looked into your source code and also just installed Yard. Since you're just invoking yarddoc really simply, I would also assume the problem is there rather than in your code. In the most recent release of Yard, the links actually work fine.

zapnap commented 14 years ago

Yeah we need to roll out support for the latest YARD (released earlier this week). I'll talk with Loren this afternoon and get that rolling.

norman commented 14 years ago

Great! Looking forward to the update.

zapnap commented 14 years ago

updated! let us know if you have any q's or p's.

norman commented 14 years ago

RDoc multi-word links are actually still not working. I looked into it, and this is because you're using the default RDoc that comes with 1.8.7, which is fairly old and doesn't support multi-word links. The RDoc from 1.9.1 is newer and works fine.

To solve the issue, all you have to do is install the latest RDoc gem, regardless of your Ruby version.

FYI, when generating the Yard docs for my project with 1.8.7 with the default RDoc, I get these errors:

[warn]: In file `':: Cannot resolve link to hosted from text:
[warn]: ...FriendlyId is {hosted on Github}[git://github.com/no...
[warn]: In file `':: Cannot resolve link to Norman from text:
[warn]: ...lyId was created by {Norman Clarke}[mailto:norman@njcla...
[warn]: In file `':: Cannot resolve link to Adrian from text:
[warn]: ...{Adrian Mugnolo}[mailto:adrian@mugno...
[warn]: In file `':: Cannot resolve link to Emilio from text.
[warn]: In file `':: Cannot resolve link to hosted from text:
[warn]: ...FriendlyId is {hosted on Github}[git://github.com/no...
[warn]: In file `':: Cannot resolve link to Norman from text:
[warn]: ...lyId was created by {Norman Clarke}[mailto:norman@njcla...
[warn]: In file `':: Cannot resolve link to Adrian from text:
[warn]: ...{Adrian Mugnolo}[mailto:adrian@mugno...
[warn]: In file `':: Cannot resolve link to Emilio from text.

If you're logging your Yard doc generation anywhere you'll probably see the same thing.

zapnap commented 14 years ago

I just updated the rdoc gem on the host; it's using 2.4.3 currently. Not sure if this will make a difference or not.

norman commented 14 years ago

Yup! Works fine now. Thanks a lot!

zapnap commented 14 years ago

No problem! Thanks for reporting it and doing some sleuthing, and let us know if you have other problems or suggestions.