By John Gruber
Jiiiii — Free to download, unlock your anime-watching-superpowers today!
Tim Bray, on Ruby libraries for generating markup:
All these markup generators adopt two principles:
You call a Ruby method to generate an element; it provides the opening and closing tags and relies on a body to fill in the middle.
To generate a
<foo>
element, you call a method namedfoo
.#1 is correct, and makes Ruby a really nice language for generating markup. #2 is completely wrong in the general case.
He then goes on to demo code from his own solution. I agree with this completely — I hate markup-generating libraries that map tag/element names to methods.
★ Monday, 11 September 2006