2

Assume that I have the follow class.

class Foo

  # I want the following to appear as-is in my documentation, not as an anchor tag. 
  #
  # http://www.google.com/
  #
  def bar
    puts "bar"
  end
end

And then I run it through rdoc.

$ rdoc foo.rb

It generates this:

<div class="method-description">
  <p>
    I want the following to appear as-is in my documentation, not as an anchor tag.
  </p>
  <p>
    <a href="http://www.google.com">www.google.com</a>/
  </p>
</div>

I want it to generate something like this instead:

<div class="method-description">
  <p>
    I want the following to appear as-is in my documentation, not as an anchor tag.
  </p>
  <p>
    http://www.google.com/
  </p>
</div>

What would be the best way to accomplish this?

jdl
  • 17,702
  • 4
  • 51
  • 54

1 Answers1

3

Step 1

Make sure that you're using:

ruby 1.9.2
rdoc 2.5.8

Step 2

Escape it and you should be fine.

class Foo

  # I want the following to appear as-is in my documentation, not as an anchor tag. 
  #
  # \http://www.google.com/
  #
  def bar
    puts "bar"
  end
end

Output:

<div class="method-description"> 
  <p>
    I want the following to appear as-is in my documentation, not as an anchor tag.
  </p>  
  <p>
    http://www.google.com/
  </p>
</div>
jdl
  • 17,702
  • 4
  • 51
  • 54
Thiago Silveira
  • 5,033
  • 4
  • 26
  • 29
  • 1
    That's really the output that you got? All this produces for me is a backslash in front of the anchor tag. – jdl Jan 13 '11 at 03:16
  • Yep, that's it. http://img199.imageshack.us/img199/3476/outputf.png Sorry for the low sized screenshot. – Thiago Silveira Jan 13 '11 at 03:19
  • Interesting. Which versions of ruby and rdoc are you using? – jdl Jan 13 '11 at 03:44
  • It was a version problem. I was trying to use an older ruby / rdoc. I'm assuming that only the rdoc version actually matters, but I updated the answer to include both versions used. – jdl Jan 13 '11 at 18:57