# Amrita2 1.9.6

**URL:** <https://www.ruby-forum.com/t/amrita2-1-9-6/95718>\
**Category:** Ruby\
**Created:** [December 7, 2005, 10:06am UTC](https://www.ruby-forum.com/t/amrita2-1-9-6/95718 "2005-12-07T10:06:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![takunakajima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@takunakajima](https://www.ruby-forum.com/u/takunakajima)\
**Post date:** [December 7, 2005, 10:06am UTC](https://www.ruby-forum.com/t/amrita2-1-9-6/95718/1 "2005-12-07T10:06:43Z")

</div>

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/](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=‘odd’ and  
class=‘even’) alternately

Now Amrita2 template can contain ERB source in it.

```
   <table border='1'>
     <tr><th>name</th><th>author</th></tr>
     <tr id='languages'>
       <td><![CDATA[
          <a href='<%= $_.url %>'><%= $_.name %></a>
       ]]></td>
       <td id='creator'></td>
     </tr>
   </table>

```

CDATA in 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](http://amrita2.rubyforge.org/Rails.html)

And this method setup Template to insert two attributes alternately.

def languages\_setup\_template(template)  
tmpl = Amrita2::TemplateText.new(template)  
tmpl.use\_erb(binding)  
tmpl.element\_option[:languages] = { :mv\_attr=\> { :class=\>%w(odd  
even)  
} }  
tmpl  
end

This template produces output like this.

| name | author |
| --- | --- |
| \<a href='http://www.ruby-lang.org/' \>Ruby | matz |
| \<a href='http://www.perl.com/' \>perl | Larry Wall |
| \<a href='http://www.python.org/' \>python | Guido van Rossum |

---

<div class="post-metadata">

**Author:** ![takunakajima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@takunakajima](https://www.ruby-forum.com/u/takunakajima)\
**Post date:** [December 8, 2005, 4:54am UTC](https://www.ruby-forum.com/t/amrita2-1-9-6/95718/2 "2005-12-08T04:54:01Z")

</div>

Taku Nakajima wrote:

> Amrita2 is a XML/HTML template library for Ruby. I released a new  
> version 1.9.6 as BETA1 for 2.0.

Great. Any chance you could release Amrita as a gem?

Thanks,  
Gavin

---

<div class="post-metadata">

**Author:** ![takunakajima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@takunakajima](https://www.ruby-forum.com/u/takunakajima)\
**Post date:** [December 8, 2005, 3:27pm UTC](https://www.ruby-forum.com/t/amrita2-1-9-6/95718/3 "2005-12-08T15:27:10Z")

</div>

> Great. Any chance you could release Amrita as a gem?

I have uploaded gem of Amrita2 to rubyforge. So, you can install  
Amrita2 by gem now. Just type

# gem install amrita2

I will upload gem of Amrita 1.0.X with next release of Amrita2.
