Forum: Ruby Make RDoc escape inner element strings

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3cc7ed7c36e8eec971cc8991084bdf00?d=identicon&s=25 Jose Fernandez (jfernandez)
on 2008-11-20 23:10
Is there a way to make RDoc use the html entities of stuff like:

<a href="classes/ActiveSupport/TimeZone.html#M001007"><=>
(ActiveSupport::TimeZone)</a><br />

The xml parser im using is getting confused by the '<' '>' strings
inside elements... wondering if you can make Rdoc use their char
reference entity instead?
97550977337c9f0a0e1a9553e55bfaa0?d=identicon&s=25 Jano Svitok (Guest)
on 2008-11-23 11:17
(Received via mailing list)
On Thu, Nov 20, 2008 at 23:06, Jose Fernandez <jose@umn.edu> wrote:
> Is there a way to make RDoc use the html entities of stuff like:
>
> <a href="classes/ActiveSupport/TimeZone.html#M001007"><=>
> (ActiveSupport::TimeZone)</a><br />
>
> The xml parser im using is getting confused by the '<' '>' strings
> inside elements... wondering if you can make Rdoc use their char
> reference entity instead?

What version rdoc do you have? It seems that
http://api.rubyonrails.org/classes/ActiveSupport/T... has it
correct.
Check with "rdoc --version", update with "gem install rdoc", latest is
2.2.1.
3cc7ed7c36e8eec971cc8991084bdf00?d=identicon&s=25 Jose Fernandez (jfernandez)
on 2008-11-25 00:38
Jano Svitok wrote:
> On Thu, Nov 20, 2008 at 23:06, Jose Fernandez <jose@umn.edu> wrote:
>> Is there a way to make RDoc use the html entities of stuff like:
>>
>> <a href="classes/ActiveSupport/TimeZone.html#M001007"><=>
>> (ActiveSupport::TimeZone)</a><br />
>>
>> The xml parser im using is getting confused by the '<' '>' strings
>> inside elements... wondering if you can make Rdoc use their char
>> reference entity instead?
>
> What version rdoc do you have? It seems that
> http://api.rubyonrails.org/classes/ActiveSupport/T... has it
> correct.
> Check with "rdoc --version", update with "gem install rdoc", latest is
> 2.2.1.

I updated to 2.2.1 but it still wont escape the < > characters in the
fr_method_index.html file (which I need to parse), only in the actual
documentation.
97550977337c9f0a0e1a9553e55bfaa0?d=identicon&s=25 Jano Svitok (Guest)
on 2008-11-25 02:41
(Received via mailing list)
On Tue, Nov 25, 2008 at 00:33, Jose Fernandez <jose@umn.edu> wrote:
> I updated to 2.2.1 but it still wont escape the < > characters in the
> fr_method_index.html file (which I need to parse), only in the actual
> documentation.

Now I see. I've reported this to rdoc's tracker [1] along with a patch:

Index: lib/rdoc/generator/html.rb
===================================================================
--- lib/rdoc/generator/html.rb  (revision 192)
+++ lib/rdoc/generator/html.rb  (working copy)
@@ -253,7 +253,7 @@
     res = []
     collection.sort.each do |f|
       if f.document_self
-        res << { "href" => f.path, "name" => f.index_name }
+        res << { "href" => f.path, "name" =>
CGI.escapeHTML(f.index_name) }
       end
     end


i.e.

- open
C:\ruby\lib\ruby\gems\1.8\gems\rdoc-2.2.1\lib\rdoc\generator\html.rb
- go to line 256
- add "CGI.escapeHTML("
- close the parenthesis

Jano

[1]
http://rubyforge.org/tracker/index.php?func=detail...
This topic is locked and can not be replied to.