2011-01-13 1 views
1

Предположим, что у меня есть класс.Как предотвратить разбор URL-адреса RDoc?

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> 

Что бы быть лучшим способом для достижения этой цели?

ответ

3

Шаг 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> 
+1

Это действительно выход, который вы получили? Все это создает для меня обратную косую черту перед якорной биркой. – jdl

+0

Да, все. http://img199.imageshack.us/img199/3476/outputf.png Извините за скриншот низкого размера. –

+0

Интересно. Какие версии ruby ​​и rdoc вы используете? – jdl