Make RDoc escape inner element strings

J

Jose Fernandez

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?
 
J

Jano Svitok

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/TimeZone.html has it
correct.
Check with "rdoc --version", update with "gem install rdoc", latest is 2.2.1.
 
J

Jano Svitok

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&aid=22968&group_id=627&atid=2472
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,190
Messages
2,571,017
Members
47,618
Latest member
Leemorton01

Latest Threads

Top