Amrita ホームページ
概略
Amritaは html/xhtml 用のテンプレートライブラリです。 テンプレートとモデルデータから html ドキュメントを生成します。

Amrita はデータとハイパーテキストを結びつけます
特色
- Amritaのテンプレートは <?...?> や <% .. %> のような特殊な タグを含まない純粋なhtml/xhtml 文書です。
- テンプレートは、ほとんどのHTMLエディタで作成することができます。
- 出力の動的な部分を修正しても、Rubyコードには修正が不要です。
- モデルデータは、 Hash Array 文字列のような標準のRubyのデータです。また、 自作のクラスのオブジェクトをそのままモデルデータにすることも可能です。
- 出力はロジックでなくデータでコントロールされます。ですから、テストや デバッグが簡単です。(eXtream Programing に向いています)
- 簡単にHTMLテンプレートをRubyのコードにコンパイルすることもできます。
例
Amrita は テンプレートとモデルデータを id 属性によってマッチさせて、 HTML文書を出力します。
- template
<table border="1"> <tr><th>name</th><th>author</th></tr> <tr id="table1"> <td id="name"><td id="author"> </tr> </table>
- data
data = { :table1 => [ { :name=>"Ruby", :author=>"matz" }, { :name=>"perl", :author=>"Larry Wall" }, { :name=>"python", :author=>"Guido van Rossum" }, ] }- template + data = output
<table> <tr> <th>name</th> <th>author</th> </tr> <tr> <td>Ruby</td> <td>matz</td> </tr> <tr> <td>perl</td> .......
ライセンス
Amrita is Copyright © 2002 Taku Nakajima. It is free software, and may be redistributed under the terms specified in the README file of the Ruby distribution.