SM::ToHtml does not convert urls to hyperlinks

S

Shri Borde

I am trying to use my own output formatter with SimpleMarkup. Things seems =
to work, except for hyperlinks not working as expected. I tried to use SM::=
ToHtml to simplify things, and even if does not deal with hyperlinks. Here =
is the code snippet I am using.

require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_html'
s =3D "This is *bold*. These are urls - www.foo.com<http://www.foo.com> , h=
ttp://www.foo.com , foo[http://www.foo.com]"
p =3D SM::SimpleMarkup.new
puts p.convert(s, SM::ToHtml.new)

The output of this is as shown below. The word "bold" was surrounded by the=
<b> tag, but the urls were not surrounded with <a href> tags.

<p>
This is <b>bold</b>. These are urls - www.foo.com<http://www.foo.com> , htt=
p://www.foo.com , foo[http://www.foo.com]
</p>

Is there a way to make this happen?

Regards,
Shri
 
E

Eric Hodel

I am trying to use my own output formatter with SimpleMarkup. Things
seems to work, except for hyperlinks not working as expected. I
tried to use SM::ToHtml to simplify things, and even if does not
deal with hyperlinks. Here is the code snippet I am using.

[...]

You should use RDoc::Markup from RDoc 2. RDoc 1's SM is no longer
maintained.

As described in ri RDoc (for RDoc 2), valid URL formats are:
* Hyperlinks to the web starting http:, mailto:, ftp:, or www.
are recognized. An HTTP url that references an external image
file is converted into an inline <IMG..>. Hyperlinks starting
'link:' are assumed to refer to local files whose path is
relative to the --op directory.

Hyperlinks can also be of the form label, in which case the label is used i...a>, <a href="http://www.foo.com">foo</a> </p>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top