very nice work. i thiink this is the best looking html/xhtml template
system i’ve seen so far. few questions:
can dummy data be used in the template itself for designer purposes?
how does it far with xml itself? (if no, would you add that support?)
and finally, how fast is it?
i had stared my own xml/html/xhtml template system myself based on
zope’s tals, call xmlTails, though i got it to work it used eval a lot,
which i didn’t like and it was exceedly slow. with Amrita i think i can
happily dump that into my trash can. yes?
···
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.
Amrita is a a html/xhtml template library for Ruby.
It makes html documents from a template and a model data.
This is a really cool, clean approach - I very much like being able to
see the skeleton of the page without looking at the template (most
templating systems require starting by reading the template and
piecing everything together from there).
To throw out a couple of thoughts:
It would be cool during development to have the template completely
inferred from the data; obviously it would have to make some arbitrary
choices (lists vs. tables, anchors vs. buttons) but it would probably
be good enough to get a prototype up for simple sites.
If I were using it, I’d want to mix callbacks in for form elements
and links, so that you could do, say,
i = 0
data = {“count” => i,
“increment” => callback{i += 1},
“decrement” => callback{i -= 1}}
I downloaded amrita (stable version) and ran
make test_it
and got several errors. Did I do something wrong or get the
incorrect version?
Thanks
Jim
make test_it
(cd test; ruby -I…/lib testall.rb)
E.E…E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E…E.E.E.F…E…E…
Time: 0.654986
FAILURES!!!
Test Results:
Run: 82/82(158 asserts) Failures: 1 Errors: 45
Failures: 1
./testparser.rb:31:in test_scanner'(TestHtmlParser): expected:<[#<Amrita::HtmlScanner::TagInline:0x80bb8ec @attrs=[["src", "xxx.gif"]], @name="img">]> but was:<[#<Amrita::HtmlScanner::TagInline:0x80baf8c @attrs=[], @name="src">]> (RUNIT::AssertionFailedError) from testall.rb:22 Errors: 45 ../lib/amrita/parser.rb:433:inparse’(TestFormat): error hapend in :4(
can’t be in )
==> id=“body”>body text will be inserted here
(Amrita::HtmlParseError)
from ../lib/amrita/parser.rb:398:in `parse_text'
from ./testformat.rb:50:in `test_asisformatter'
from testall.rb:22
../lib/amrita/parser.rb:433:in `parse'(TestFormat): error hapend in :0( can't be in <__id>)
···
–
Jim Freeze
If only I had something clever to say for my comment…
~
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.
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>
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
…
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.
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.
···
On Fri, Jul 19, 2002 at 01:36:52PM +0900, Tom Sawyer wrote:
.E.E.E…E.E.E.F…E…E…
Time: 0.654986
FAILURES!!!
Test Results:
Run: 82/82(158 asserts) Failures: 1 Errors: 45
Failures: 1
./testparser.rb:31:in test_scanner'(TestHtmlParser): expected:<[#<Amrita::HtmlScanner::TagInline:0x80bb8ec @attrs=[["src", "xxx.gif"]], @name="img">]> but was:<[#<Amrita::HtmlScanner::TagInline:0x80baf8c @attrs=[], @name="src">]> (RUNIT::AssertionFailedError) from testall.rb:22 Errors: 45 ../lib/amrita/parser.rb:433:in parse’(TestFormat): error hapend in
:4(
···
-----Original Message-----
can’t be in )
==> id=“body”>body text will be inserted here
(Amrita::HtmlParseError)
from ../lib/amrita/parser.rb:398:in `parse_text'
from ./testformat.rb:50:in `test_asisformatter'
from testall.rb:22
../lib/amrita/parser.rb:433:in `parse'(TestFormat): error hapend in
:0( can't be in <__id>)
–
Jim Freeze
If only I had something clever to say for my comment…
~
I’ve got the same messages when I removed cscan.so ( c version of
strscan in my system: linux) for testing. I think you have strscan.rb
installed but the c-version was not installed or it does not work now.
I should have inserted checking if strscan of c version is running. I
will put this check to next release of amrita. Thank you for
reporting.
Doesn’t Iowa have a similar approach? How would you compare
both?
Similar, yes, although a comparison is difficult because Iowa is
bidirectional (data goes from your model out to the template, through
an HTTP response/request cycle, and the back to your model), which
complicates things a lot.
The two main differences in terms of templating are that Iowa’s
bindings are a flat namespace whereas Amrita uses hierarchy, and that
Iowa has a lot of back and forth interaction between the template and
the model, whereas Amrita takes a more pipelined approach - once the
data tree is built, that’s all the template refers to. This
simplifies iteration logic in particular.
What would be interesting to me would be an Amrita like system that
introduced Iowa’s bidirectionality by storing blocks inside the data
tree. Particularly if combined with call/cc based session management.
Anyone can tell me how to use the TkImage class method? Seems it is much
different from the Perl/Tk.
In Perl/Tk there is no “new” method, but according to the
Rdoc,http://www.eng.dmu.ac.uk/~hgs/ruby/ruby-1.6.7-rdocs/,there is a new
method. And I have tried for severl times,such as
TkImage.new{type "phoimage"
file “xxxx.gif”
}
but still cannot use it to create a image. Thanks.
Could someone who has access to the adequate compilation software
build a win32 version of this library ?
Thanks a lot,
Pierre Baillet
It is a good viewpoint to see the world as a dream. When you have something
like a nightmare, you will wake up and tell yourself that it was only a dream.
It is said that the world we live in is not a bit different from this.
wonderful to hear! i’m planning to use amrita for a report engine.
essentially it will pull from a database and use amrita to generate
texml (texml is a way to mark-up (La)Tex in XML) from there is gets
converted into LaTex and then into a dvi.
thanks for such a great tool,
~transami
···
On Wed, 2002-07-24 at 20:00, Taku Nakajima wrote:
Now my answer is “amrita can be used with XML very well” . I hope you
like it.
not sure if i follow you here exactly, but i’ve been trying to do
something similiar with object ↔ gui communication. in fact after
reading you plug for amrita i was surprised by the coorelations, the
distinction being only that Amrita goes one direction, where i was
trying to go back again.
i have yet to succeed in this endeavor. i have come to realize that
there is much more to the whole thing then i initially thought, but i
will keep tinkering away at it. perhaps eventually i have something
useable. (in the mean time, i’ve switched to rebol for gui front ends.
oh well.)
~transami
(") dobee dobee do…
\v/
^ ^
···
On Fri, 2002-07-19 at 15:41, Avi Bryant wrote:
What would be interesting to me would be an Amrita like system that
introduced Iowa’s bidirectionality by storing blocks inside the data
tree. Particularly if combined with call/cc based session management.
Could someone who has access to the adequate compilation software
build a win32 version of this library ?
Thanks a lot,
Pierre Baillet
It is a good viewpoint to see the world as a dream. When you have
something
like a nightmare, you will wake up and tell yourself that it was only
a
···
-----Original Message-----
On Sun, Jul 21, 2002, Rich Kilmer wrote:
dream.
It is said that the world we live in is not a bit different from this.
Do you have any sample texml documents or good information
on texml usage?
Thanks
···
On Thu, Jul 25, 2002 at 12:23:44PM +0900, Tom Sawyer wrote:
On Wed, 2002-07-24 at 20:00, Taku Nakajima wrote:
Now my answer is “amrita can be used with XML very well” . I hope you
like it.
wonderful to hear! i’m planning to use amrita for a report engine.
essentially it will pull from a database and use amrita to generate
texml (texml is a way to mark-up (La)Tex in XML) from there is gets
converted into LaTex and then into a dvi.
thanks for such a great tool,
~transami
–
Jim Freeze
If only I had something clever to say for my comment…
~