On Fri, Jul 19, 2002 at 01:36:52PM +0900,
 Tom Sawyer wrote:

> On Thu, 2002-07-18 at 20:26, Taku Nakajima wrote:
> > Amrita is a a html/xhtml template library for Ruby. 
> > It makes html documents from a template and a model data.
> 
> very nice work. i thiink this is the best looking html/xhtml template
> system i've seen so far. few questions:

Thnak you.

> 1. can dummy data be used in the template itself for designer purposes?

Yes, dummy data will be deleted in real use.

    tmpl = TemplateText.new "<p id=xyz>This is dummy data</p>"
    data = {  :xyz => "This is real data" }
    tmpl.expand(STDOUT, data) # =><p>This is real data</p>

> 2. how does it far with xml itself? (if no, would you add that support?)

I think it can be used with xml right now.

Html dependent parts are

   * parser will add omitted tags for html
   
     but it doese not matter for well-formed xml/xhtml

   * parser will generate special data for <pre>.....</pre>

     I think I can provide a flag to avoid this feature if you need.

   * pretty printer uses html tag info (see lib/amrita/format.rb:227)
     
     but you can avoid this feature not setting prettypring flag or
     provide tag info yourself fit to your DTD.

> 3. and finally, how fast is it?

It's slow but has pre-compiled mode. In pre-compiled mode, it runs as
fast as a standard ruby script like

    STDOUT << "<html>........"
    STDOUT << "<ul>"
    some_array.each do |x|
      STDOUT << "<li>"> << x
    end
    .....



see sample/tour/precompile.rb and docs/Tour:177 for detail.

-- 
Taku Nakajima