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 ?>:k:: -> :v::, <?tpl end ?>
<?tpl each b ?>:k:: -> :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]
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 ?>:k:: -> :v::, <?tpl end ?>
<?tpl each b ?>:k:: -> :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]