SM::ToHtml does not convert urls to hyperlinks

View: New views
4 Messages — Rating Filter:   Alert me  

SM::ToHtml does not convert urls to hyperlinks

by Shri Borde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

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 = "This is *bold*. These are urls - www.foo.com , http://www.foo.com , foo[http://www.foo.com]"

p = 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 , foo[http://www.foo.com]

</p>

 

Is there a way to make this happen?

 

Regards,

Shri

 


Re: SM::ToHtml does not convert urls to hyperlinks

by darugula srinivas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Tue, May 19, 2009 at 12:32 AM, Shri Borde <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.

 

require 'rdoc/markup/simple_markup'

require 'rdoc/markup/simple_markup/to_html'

s = "This is *bold*. These are urls - www.foo.com , http://www.foo.com , foo[http://www.foo.com]"

p = 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 , foo[http://www.foo.com]

</p>

 

Is there a way to make this happen?


         You have to use <a herf> for hyperlinks
 means start your urls with <a herf> and end with </herf>  

 

Regards,

Shri

 



Re: SM::ToHtml does not convert urls to hyperlinks

by Hugh Sasse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 19 May 2009, darugula srinivas wrote:

> On Tue, May 19, 2009 at 12:32 AM, Shri Borde <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.
> >
> >
> >
> > require 'rdoc/markup/simple_markup'
> >
> > require 'rdoc/markup/simple_markup/to_html'
> >
> > s = "This is *bold*. These are urls - www.foo.com , http://www.foo.com ,
> > foo[http://www.foo.com]"
> >
> > p = 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 ,
> > foo[http://www.foo.com]
> >
> > </p>
> >
> >
> >
> > Is there a way to make this happen?
> >
>
>          You have to use <a herf> for hyperlinks
>  means start your urls with <a herf> and end with </herf>
I think that would be: You have to construct the anchor link yourself
  <a href="url">text</a>
The only things I can see in Rdoc online docs for handling anchors and
URLs are for internally generated ones to tie up the names of clasess,
modules and methods in the HTML docs being generated.

But I'm unfamiliar with the internals.

You could extend the classes to do the magic for you I suppose.

        Hugh

Re: SM::ToHtml does not convert urls to hyperlinks

by Eric Hodel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On May 18, 2009, at 16:32, 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.

Don't use SimpleMarkup, use RDoc::Markup from RDoc 2.  See my reply on  
ruby-talk.