On 9/26/05, Adam Van Den Hoven <mail / adamvandenhoven.com> wrote: > I've been dabbling with ruby on and off for a year or so and recently > more often. At work we do Java development and I keep thinking that it > would be nice to be able to bring some of the stuff I designed there > into my own work, which I want to do in ruby. > > I was wondering if anyone had thought about adding something like the > Java TagLibs to ruby (I guess it would embedded ruby). In my case, it > would make long term maintenance of files MUCH easier as I can give it > to a non-technical person without much documentation. In most cases > people who don't understand programming do understand parts of HTML > markup. If I could hide what is currently inline code behind things > that look like tags, its easier to give maintenance over to > non-technical folks. Frankly, I think that TagLibs are overblown nonsense ;) You can implement much of this with Amrita, I think, which completely separates code from data. Even with erb/eruby, though, you could do something like: <table> <% max = data.size data.each_with_index do |el, ix| %> <tr class="<%= (((ix % 2) == 0) ? "even" : "odd") + ((ix == max) ? " last" : "") %>"> <td><%= el %></td> </tr> <% end %> </table> There's other ways to do this, but as I don't really do a lot of stuff that needs this, this is simple enough. -austin -- Austin Ziegler * halostatue / gmail.com * Alternate: austin / halostatue.ca