假设我有关注课程。

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>

做这件事的最佳方法是什么?

有帮助吗?

解决方案

步骤1

确保您正在使用:

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>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top