gpt4 book ai didi

ruby - 如何防止 RDoc 解析 URL?

转载 作者:太空宇宙 更新时间:2023-11-03 18:30:44 26 4
gpt4 key购买 nike

假设我有以下类(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

然后我通过 rdoc 运行它。

$ rdoc foo.rb

它生成这个:

<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>

我希望它生成这样的东西:

<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>

实现此目标的最佳方法是什么?

最佳答案

第一步

确保您正在使用:

ruby 1.9.2
rdoc 2.5.8

第 2 步

逃避它,你应该没问题。

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

输出:

<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>

关于ruby - 如何防止 RDoc 解析 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4676167/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com