From: Brian Candler Date: 2003-03-17T04:20:39+09:00 Subject: Re: Question about Amrita On Mon, Mar 17, 2003 at 02:39:25AM +0900, makotz wrote: > And, I want to generate a colored row table, like this: > ---------------------------------------- > > > > > > > > > > >
ruby
python
perl
> ---------------------------------------- > > But I don't know how to write an amrita code :-< > > In other words, what I want to do is to add an attribute > 'class' to ''. > I can add attributes to '' with a() method, > but cannot add to ''. sample/tour/proc.rb in the Amrita distribution does what you want, setting element attributes explicitly. See section entitled "proc" at: http://www.brain-tokyo.jp/research/amrita/rdocs/files/docs/Tour.html sample/hello/conditional.rb shows another way to achieve different HTML for odd/even rows, although in this case you'll probably end up with an extra
around each table row. It relies on the fact that if a particular id is missing (or points to nil or false) it is removed.
links = [ { :odd=> {:lang=>a(:href=>'http://www.ruby-lang.org') {"ruby"} } }, { :even=>{:lang=>a(:href=>'http://www.python.org') {"python"} } }, { :odd=> {:lang=>a(:href=>'http://www.perl.org') {"perl"} } }, ] Regards, Brian.