Как предотвратить разбор URL в RDoc? - PullRequest
1 голос
/ 13 января 2011

Предположим, у меня есть следующий класс.

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 Ответ

3 голосов
/ 13 января 2011

Шаг 1

Убедитесь, что вы используете:

ruby 1.9.2
rdoc 2.5.8

Шаг 2

Escape itи с тобой все будет в порядке.

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