[ANN] Kwartz (2004-04-23) - a template system for ruby, php and java

Hi folks,

I have released new version of Kwartz.
Kwartz is a template system, which has the following features.

  • separate presentation logic from HTML file.
  • very fast, as fast as mod_ruby
  • available in Ruby, PHP and Java.
  • doesn’t break HTML design at all.
  • can handle any type of text file.
  • auto-sanitizing
···

========================================
$ kwartz -l ruby2 file.html > file.rb
========================================

  Output script (file.rb):
  ----------------------------------------
  _s << "Hello " << (user).to_s << "!\n"
  _s << "<ul>\n"
  for item in list do
    _s << "  <li>" << (item).to_s << "</li>\n"
  end
  _s << "</ul>\n"
  ----------------------------------------

  Main program:
  ----------------------------------------
  code = File.open('file.rb') { |f| f.read }
  _s = ''
  eval code
  print _s
  ----------------------------------------
  • Utility script ‘mkmethod’ enhanced to be able to take
    argument names with command line option ‘-A’.

    ========================================
    $ mkmethod -A ‘user,list’ -M Hoge hoge.html
    module Hoge
    def self.expand_hoge(_args)
    user = _args[:user]
    list = _args[:list]
    return self._expand_hoge(user, list)
    end
    def self._expand_hoge(user, list)
    _s = ‘’
    _s << "Hello " << (user).to_s << “!\n”
    _s << "
      \n"
      for item in list do
      _s << "
    • " << (item).to_s << "
    • \n"
      end
      _s << "
    \n"
    return _s
    end
    end

  • New lang ‘php2’ supported. It uses output buffering functions
    to get output as string.

  • Utility script ‘mkmethod’ now support PHP.


regards,
kwa