Devin Mullins wrote:

> Hi, Adam,
>
> (I, for instance, am not a fan of passing around _erbout.)

I cleaned up the syntax, btw, with a dependency on my favorite Rails 
support class:

require 'rubygems'
require 'binding_of_caller'

class AvTable
  def initialize(out)
    @out = out; @side = :odd
  end
  def av_trow
    @out << %Q{<tr class="#@side">}
    yield
    @out << "</tr>"
    @side = (@side == :odd) ? :even : :odd
  end
end

def av_table(&blk)
  Binding.of_caller do |b|
    out = eval '_erbout', b
    out << "<table>"
    AvTable.new(out).instance_eval &blk
    out << "</table>"
  end
end

ERB.new( <<RHTML ).result.display
<% av_table do %>
  <% av_trow do %><td>...</td><% end %>
  <% av_trow do %><td>...</td><% end %>
  <% av_trow do %><td>...</td><% end %>
  <% av_trow do %><td>...</td><% end %>
  <% av_trow do %><td>...</td><% end %>
<% end %>
RHTML

__END__

And, of course, you can replace do ... end with { ... } if you prefer.

Yeah, you might need/want a different templating framework than yet 
exists for Ruby. I dunno. I hope somebody else responds who has 
experience in some of the other templating systems, 'cause I'm pretty 
much clueless. :)

Devin