Greg Barozzi wrote:
[...]
> If I was going to write this myself I'd try something like:
> 
> def h1
>    print "<H1>"
>    yield
>    print "</H1>"
> end
> 
> h1 do
>    print "I'm a heading!"
> end
> 
> => <H1>I'm a heading!</h1>
> 
> 
> By yielding to the block you allow yourself to nest other tags
> inside of tags which is something you often have to do when writing
> html.
> 
> Good luck.

Good point.  This is the approach that Builder and Markaby take.  In Web 
apps, I prefer my markup not to look like Ruby, but in a situation like 
that of the OP, Builder might be useful.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen / marnen.org

-- 
Posted via http://www.ruby-forum.com/.