How do I prevent RDoc from parsing a URL?
Assume that I have the follow class.
class Foo
# I want the following to appear as-is in my documentation, not as an开发者_如何学Python 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>
精彩评论