[ANN] Template.rb (2003-10-22)

W

Wejn

Hi,

I'd like to announce first release of "Template.rb" library:
a not-so-simple template language, which is descendant of my
PHP version with the same name.

While being quite stable, it currently lacks any documentation
and website...

I'm releasing it mainly due to the fact that I currently have
no time to create the docs and I think it could be useful to
someone in this list.

The download URL is:

http://www.fi.muni.cz/~xsafran3/Template.rb-20031022-183020.tgz

To give you very rough understanding how it works (feels),
here's simple example:

===========================================================================
$ cat a.rb
require 'Template'
t = Template.new
t['a'] = {'a' => 'b', 1 => 'x', 's' => Time.now}
t['b'] = []
t['c'] = ['first', 'second', 'third', 'fourth']
t['n'] = 3
t.load('a.tmpl')
puts t.execute


$ cat a.tmpl
<?tpl each a ?>::mad:k:: -> ::mad:v::, <?tpl end ?>
<?tpl each b ?>::mad:k:: -> ::mad:v::, <?tpl else ?>No data.<?tpl end ?>
<?tpl run ?>Third element is: ::c[2]::,
while fourth is: ::c[n]::.<?tpl end ?>
<?tpl set _x pow n 8 ?>
<?tpl if eq _x 6561 ?>Fine.<?tpl else ?>Error.<?tpl end ?>
Static ::text:: here.


$ ruby a.rb
a -> b, 1 -> x, s -> Wed Oct 22 19:00:28 CEST 2003,
No data.
Third element is: third,
while fourth is: fourth.

Fine.
Static ::text:: here.


===========================================================================

If you have any comments (or you just happen to like it), don't hesitate
to drop me a note :)

Sincerely,
Michal[/QUOTE]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top