# Does Rubi On Rails Generate XHTML or Accessible HTML?

**URL:** <https://www.ruby-forum.com/t/does-rubi-on-rails-generate-xhtml-or-accessible-html/77007>\
**Category:** Rails\
**Created:** [November 23, 2006, 11:45am UTC](https://www.ruby-forum.com/t/does-rubi-on-rails-generate-xhtml-or-accessible-html/77007 "2006-11-23T11:45:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![VPC](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/91b2a8/32.png) [@VPC](https://www.ruby-forum.com/u/VPC)\
**Post date:** [November 23, 2006, 11:45am UTC](https://www.ruby-forum.com/t/does-rubi-on-rails-generate-xhtml-or-accessible-html/77007/1 "2006-11-23T11:45:30Z")

</div>

Hi.

I’ve been testing different generated with Rubi On Rails pages for web  
Accessibility.

Is there a way of making them in accesible HTML or XHTML?

Thanks.

---

<div class="post-metadata">

**Author:** ![VPC](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/91b2a8/32.png) [@VPC](https://www.ruby-forum.com/u/VPC)\
**Post date:** [November 23, 2006, 12:13pm UTC](https://www.ruby-forum.com/t/does-rubi-on-rails-generate-xhtml-or-accessible-html/77007/2 "2006-11-23T12:13:34Z")

</div>

Yes. Make your own views, if the generated ones (using scaffolding)  
don’t fit your needs. Rails can generate crappy HTML or stuff that  
passes strictest of accessibility guidelines (or XML or even plain  
text).

Vish

---

<div class="post-metadata">

**Author:** ![VPC](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/91b2a8/32.png) [@VPC](https://www.ruby-forum.com/u/VPC)\
**Post date:** [November 23, 2006, 11:02pm UTC](https://www.ruby-forum.com/t/does-rubi-on-rails-generate-xhtml-or-accessible-html/77007/3 "2006-11-23T23:02:06Z")

</div>

VPC wrote:

> I’ve been testing different generated with Rubi On Rails pages for web  
> Accessibility.

> Is there a way of making them in accesible HTML or XHTML?

After a “functional” test that calls get :index or similar, the returned  
HTML is stored in html\_document.root

I triggered a thread about XHTML recently; the output is reputedly as  
well-formed as our browsers will permit.

(Funny how that excuse always works, even in Rails!)

To test for accessibility, I would start here:

def accessible?

```
File.open('scratch.html', 'w') do |fh|
  fh.write(html_document.root)
end

system('tidy scratch.html')

```

end # CONSIDER better system to trap syntax errors in rhtml

Now Tidy will scan the HTML and complain about things like missing ALT  
tags.  
Many other accessibility validators are probably available, too. Add  
command  
line arguments to Tidy to make it force XHTML, if you need that.

You can change system(‘’) to `` to collect the report in a string, and  
search it with regular expressions, to let accessible? return a boolean,  
instead of just spew!

–  
Phlip  
[Redirecting...](http://www.greencheese.us/ZeekLand) ← NOT a blog!!!

---

<div class="post-metadata">

**Author:** ![VPC](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/91b2a8/32.png) [@VPC](https://www.ruby-forum.com/u/VPC)\
**Post date:** [November 24, 2006, 1:30am UTC](https://www.ruby-forum.com/t/does-rubi-on-rails-generate-xhtml-or-accessible-html/77007/4 "2006-11-24T01:30:24Z")

</div>

If you want to test accessibility (as distinct from testing validity),  
there is a this  
-[Automated Accessibility Tests with RAAKT in Ruby on Rails – Standards Schmandards](http://www.standards-schmandards.com/2006/accessibility-in-ruby-on-rails/)
