문제

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?

도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top