# Make RDoc escape inner element strings

**URL:** <https://www.ruby-forum.com/t/make-rdoc-escape-inner-element-strings/153773>\
**Category:** Ruby\
**Created:** [November 20, 2008, 11:10pm UTC](https://www.ruby-forum.com/t/make-rdoc-escape-inner-element-strings/153773 "2008-11-20T23:10:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [November 20, 2008, 11:10pm UTC](https://www.ruby-forum.com/t/make-rdoc-escape-inner-element-strings/153773/1 "2008-11-20T23:10:41Z")

</div>

Is there a way to make RDoc use the html entities of stuff like:

\<=\>  
(ActiveSupport::TimeZone)

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?

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [November 23, 2008, 11:17am UTC](https://www.ruby-forum.com/t/make-rdoc-escape-inner-element-strings/153773/2 "2008-11-23T11:17:49Z")

</div>

On Thu, Nov 20, 2008 at 23:06, Jose F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there a way to make RDoc use the html entities of stuff like:
> 
> \<=\>  
> (ActiveSupport::TimeZone)
> 
> 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  
[ActiveSupport::TimeZone](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.

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [November 25, 2008, 12:38am UTC](https://www.ruby-forum.com/t/make-rdoc-escape-inner-element-strings/153773/3 "2008-11-25T00:38:11Z")

</div>

Jano S. wrote:

> On Thu, Nov 20, 2008 at 23:06, Jose F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Is there a way to make RDoc use the html entities of stuff like:
> > 
> > \<=\>  
> > (ActiveSupport::TimeZone)
> > 
> > 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  
> [ActiveSupport::TimeZone](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.

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.

---

<div class="post-metadata">

**Author:** ![jfernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e495f1/32.png) [@jfernandez](https://www.ruby-forum.com/u/jfernandez)\
**Post date:** [November 25, 2008, 2:41am UTC](https://www.ruby-forum.com/t/make-rdoc-escape-inner-element-strings/153773/4 "2008-11-25T02:41:40Z")

</div>

On Tue, Nov 25, 2008 at 00:33, Jose F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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&aid=22968&group\_id=627&atid=2472](http://rubyforge.org/tracker/index.php?func=detail&aid=22968&group_id=627&atid=2472)
