Q is a project mainly written in Ruby, it's free.
Fast, fun, east HTML generation from Ruby
= Q
== Programmatic generation of HTML
Often, within helpers, I want to output some HTML without resorting to a templating language. Here is my attempt to do so:
=> Q {_div { __'this my divs contents' }} <=
Or, with attributes
=> Q {_div(:id => 'test') { __'this my divs contents' }} <=
Of course, this is all escaped
=> Q {_div { __'<tag! tag!>' }} <=
Or, you can turn that off
=> Q {_div { __no_escape'<tag! tag!>' }} <=
Or, you can indent too
=> Q(:indent => 2) {_div { __'some awesome contents' }} <=
And, you can one-line those values
=> Q {_div 'some awesome contents' }} <=
Nest as much as you want, and use the QX method for XHTML based output.