Wie kann ich RDoc von Parsen einer URL zu verhindern?
Frage
Nehmen wir an, ich die Folge Klasse haben.
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
Und dann laufe ich es durch rdoc.
$ rdoc foo.rb
Es erzeugt diese:
<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>
Ich mag es so etwas wie dieses, anstatt generieren:
<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>
Was wäre der beste Weg, dies zu erreichen?
Lösung
Schritt 1:
Stellen Sie sicher, dass Sie verwenden:
ruby 1.9.2
rdoc 2.5.8
Schritt 2
Escape es, und Sie sollten in Ordnung sein.
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
Ausgabe:
<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>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow