T
Taku Nakajima
------=_Part_28839_5549044.1133946173167
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Amrita2 is a XML/HTML template library for Ruby. I released a new
version 1.9.6 as BETA1 for 2.0. Get it from
http://amrita2.rubyforge.org/
I reduced undocumented features and refactored much to prepare the
comming stable release. And ..
* added gemspec and make it Rails plugin
* simplified the ERB processing feature
* new feature for setting two attributes (like class=3D'odd' and
class=3D'even') alternately
Now Amrita2 template can contain ERB source in it.
<table border=3D'1'>
<tr><th>name</th><th>author</th></tr>
<tr id=3D'languages'>
<td><![CDATA[
<a href=3D'<%=3D $_.url %>'><%=3D $_.name %></a>
]]></td>
<td id=3D'creator'></td>
</tr>
</table>
CDATA in <td> element will be evaluated as many times as number of
'languages' data. And each item will be set to '$_' before ERB
evaluating. See this page for detail.
How to use Amrita2 with Ruby On Rails
http://amrita2.rubyforge.org/Rails.html
And this method setup Template to insert two attributes alternately.
def languages_setup_template(template)
tmpl =3D Amrita2::TemplateText.new(template)
tmpl.use_erb(binding)
tmpl.element_option[:languages] =3D { :mv_attr=3D> { :class=3D>%w(odd e=
ven)
} }
tmpl
end
This template produces output like this.
<table border=3D'1'>
<tr><th>name</th><th>author</th></tr>
</tr>
</table>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Amrita2 is a XML/HTML template library for Ruby. I released a new
version 1.9.6 as BETA1 for 2.0. Get it from
http://amrita2.rubyforge.org/
I reduced undocumented features and refactored much to prepare the
comming stable release. And ..
* added gemspec and make it Rails plugin
* simplified the ERB processing feature
* new feature for setting two attributes (like class=3D'odd' and
class=3D'even') alternately
Now Amrita2 template can contain ERB source in it.
<table border=3D'1'>
<tr><th>name</th><th>author</th></tr>
<tr id=3D'languages'>
<td><![CDATA[
<a href=3D'<%=3D $_.url %>'><%=3D $_.name %></a>
]]></td>
<td id=3D'creator'></td>
</tr>
</table>
CDATA in <td> element will be evaluated as many times as number of
'languages' data. And each item will be set to '$_' before ERB
evaluating. See this page for detail.
How to use Amrita2 with Ruby On Rails
http://amrita2.rubyforge.org/Rails.html
And this method setup Template to insert two attributes alternately.
def languages_setup_template(template)
tmpl =3D Amrita2::TemplateText.new(template)
tmpl.use_erb(binding)
tmpl.element_option[:languages] =3D { :mv_attr=3D> { :class=3D>%w(odd e=
ven)
} }
tmpl
end
This template produces output like this.
<table border=3D'1'>
<tr><th>name</th><th>author</th></tr>
<td>matz</td>Ruby</a></td>
<td>Larry Wall</td>perl</a></td>
<td>Guido van Rossum</td>python</a></td>
</tr>
</table>