amrita - an html/xhtml template library for Ruby
Summary
Amrita is an html/xhtml template
library for Ruby. It makes html documents from a template and model data.
Key feature
- The template for amrita is a pure html/xhtml document without special tags
like <?...?> or <% .. %>
- The template can be written by designers using almost any html editor.
- There's no need to change Ruby code to modify the view of the
dynamic part of the template (or the static portion).
- The model data may be any standard Ruby data-- a Hash, Array, String... or an instance of
any user-defined class.
- The output is controlled by data, not by logic-- so it's easy to
write, test, and debug code. (Good for eXtremeProgramming)
- The html template can be compiled into Ruby code before execution with
little effort.
Amrita uses a template and model data
to create an html document by naturally matching the id attribute
of an html element to model data.
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>
.......
Installation
$ ruby install.rb config
$ ruby install.rb setup
# ruby install.rb install
Documents and sample
- docs/QuickStart
- Quick start guide
- docs/QuickStart_ja
- Quick start guide(Japanese version)
- docs/Tour
- Show various function of amrita
- docs/Tour2
- Show experimental features of amrita
- docs/XML
- XML support of amrita
- docs/Cgi
- using amrita for cgi
- sample/hello/*
- basic samples described in docs/QuickStart docs/XML
- sample/tour/*
- samples described in docs/Tour
- sample/cgi/*
- using amrita for cgi
- sample/cgikit/*
- using amrita with cgikit
- sample/bbs/*
- a moderate size sample: BBS with "theme"
Credits
- Thanks for many suggestions and contribution of Kaoru Shirai.
- The html parser in amrita/parser.rb is based on work of MoonWolf.
- sample/tour/rexml_doc.xml (sample data for sample/tour/xml3.rb) was editted
from documentation.xml in rexml archive and xml format of docs/index.xml is
based on it.
- ams(AmritaScript) is based on the idea and sugestion by Mr.Beyond
- Bruce Williams corrected many mistakes of this document.
License
Amrita is Copyright (c) 2002 Taku
Nakajima. It is free software, and may be redistributed under the terms
specified in the README file of the Ruby
distribution.
If you want to use Amrita in other
license form, I will give you a BSD-like special license for only specified
person and specified purpose. Please mail me about it in JAPANESE for
detail.
ToDos and plans
Other stuff
Author: | Taku Nakajima <tnakajima@brain-tokyo.jp>
|
Requires: | Ruby 1.6.7 or later strscan 0.6.5 or later
|
License: | Copyright (c) 2002 Taku Nakajima Released under Ruby's License
|