I relased amrita V0.8.5. It is a html/xhtml template library for Ruby.
Get it from
This release contains a new experimental feature “amx”: AMrita
eXtention for XML. amx is a yet another style-sheet, a command-line
tools that converts an XML document into a HTML document.
I used amx to generate the top page of amrita home page. The source
document of it is like this.
<body>
<section title="amrita home page">
<p>
Amrita is a a html/xhtml template library for Ruby.
It makes html documents from a template and a model data.
</p>
.....
amx uses template ( “index.amx” ) and a Ruby class optionally.
The template is also an XML document. It contains amrita’s template
like this.
.......
The id attribute values like “header_title” are mapped to Ruby methods
of “AmritaDocumentTemplate” in “amritadoc.rb”. Both names are
specified in root element.
These methods returns REXML element of source document …
def header_title
doc_root.elements[‘head/title’]
end
or Objects created by REXML elements.
def sections
doc_root.elements.to_a(‘body/section’).collect do |sec|
Section.new(sec)
end
end
For detail, you can see the full source code of these files from
http://kari.to/amrita/sources/docs/
I did not fixed the spec of this feature yet because I don’t know
about XML well and I am not sure this is useful. But I’m pleased with
it myself and I think this framework may be extended easily to support
wide variety of needs.
If you are interested in this, please mail me your need for XML with
- source XML document
- desired HTML output
If I think it can be treated by amx, I will make a template and Ruby
class for it to make it another sample of amx. And if enough samples
are collected, I will fix the spec of this feature and make it an
official feature of amrita (or spearate it from amrita adn release it
as a independed package).
···
–
Taku Nakajima
of “AmritaDocumentTemplate” in “amritadoc.rb”. Both names are
specified in root element.
doc_root.elements[‘head/title’]
end
doc_root.elements.to_a(‘body/section’).collect do |sec|
Section.new(sec)
end
end
about XML well and I am not sure this is useful. But I’m pleased with
it myself and I think this framework may be extended easily to support
wide variety of needs.
class for it to make it another sample of amx. And if enough samples
are collected, I will fix the spec of this feature and make it an
official feature of amrita (or spearate it from amrita adn release it
as a independed package).
···
–
Taku Nakajima