SM::ToHtml does not convert urls to hyperlinks

Discussion in 'Ruby' started by Shri Borde, May 19, 2009.

  1. Shri Borde

    Shri Borde Guest

    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
     
    Shri Borde, May 19, 2009
    #1
    1. Advertising

  2. Shri Borde

    Eric Hodel Guest

    On May 18, 2009, at 23:30, Shri Borde wrote:

    > 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...a>, <a href="http://www.foo.com">foo</a> </p>
     
    Eric Hodel, May 19, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kaidi
    Replies:
    5
    Views:
    475
    Andrew Thompson
    Jan 4, 2004
  2. Nathan Sokalski

    Converting Relative URLs into Absolute URLs

    Nathan Sokalski, Aug 11, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    747
    Sriram Srivatsan
    Aug 12, 2008
  3. Adam Monsen

    JDBC URLs ...not really URLs?

    Adam Monsen, Feb 6, 2009, in forum: Java
    Replies:
    11
    Views:
    6,219
    Adam Monsen
    Feb 8, 2009
  4. Steve T.

    dynamic URLS convert to static URLS for search engines

    Steve T., Mar 1, 2004, in forum: ASP .Net Web Services
    Replies:
    7
    Views:
    293
    Steve T.
    Mar 4, 2004
  5. Jason
    Replies:
    2
    Views:
    106
Loading...

Share This Page