From: Taku Nakajima Date: 2003-03-20T15:30:47+09:00 Subject: Re: Question about Amrita At Mon, 17 Mar 2003 13:20:38 +0900, makotz wrote: > > Brian Candler wrote in message news:<20030316193632.GA58317@uk.tiscali.com>... > > > > links = [ > > a(:class=>'odd') { {:lang=>a(:href=>'http://www.ruby-lang.org') {"ruby"} }}, > > a(:class=>'even') { {:lang=>a(:href=>'http://www.python.org') {"python"}}}, > > a(:class=>'odd') { {:lang=>a(:href=>'http://www.perl.org') {"perl"} }}, > > ] > > > > Great! This is what I want! > Thank you very much. > > # and this code is OK in amrita 1.0.2 but NG in 1.8.0. This is a bug of amrita 1.8.0 and I fixed it. The next release will be OK with this code. And amrita V2.0 provides a new feature called 'Amulet'. With Amulet, you can do the same thing keeping clean seperation of model and view. ---------------------------------------------------------- require 'amrita/template' include Amrita t = TemplateText.new < dummy data dummy data END t.define_amulet(:row, :row2) links = [ t[:row][{:lang=>a(:href=>'http://www.ruby-lang.org'){"ruby"} }], t[:row2][{:lang=>a(:href=>'http://www.python.org') {"python"} }], t[:row][{:lang=>a(:href=>'http://www.perl.org') {"perl"}}], ] t.expand(STDOUT, :row=>links) ---------------------------------------------------------- This code makes same result and you can adjust the color or any appearance of each row touching only the template without running or modifying the code. I wrote some pages to amrita-Wiki from this thread. http://www.walrus-ruby.org/aswiki/aswiki.cgi?c=v;p=EvenOddRow http://www.walrus-ruby.org/aswiki/aswiki.cgi?c=v;p=Amulet For detail of Amulet, see them. Thank you for a useful question. -- Taku Nakajima http://www.walrus-ruby.org/amrita/