ChangeLog
last update: $Date: 2004/04/26 20:30:16 $
- 2004-05-09
-
- [enhance] Now "..." represents a string, as well as '...'.
- [change] '\n' is now avairable only in "...", not avairable in '...'.
- [enhance] Auto-detect newline ("\n" or "\r\n") support. It's very useful for MS-Windows.
- [enhance] New command line option '--delete_idattr' support, which delete 'id="name"' from presentation data.
- 2004-04-27
-
- [enhance] mkmethod script supports --include_path and --load_path
- 2004-04-26
-
- [bugfix] fixed a bug around handling :foreach(local=global) statement in Analyzer#exec_stmt() (reported by Andreas).
- 2004-04-24
-
- [change] mkmethod script generates code "
require 'cgi'
" or "require 'erb'
" when sanitizing.### current: $ mkmethod -M hoge -s hoge.html require 'cgi' module Hoge def self.expand_hoge(_args) user = _args[:user] _s = '' _s << "Hello " << CGI.escapeHTML((user).to_s) << "\n" return _s end end
- [bugfix] mkmethod script generates 'include ERB::Util' code correctly (reported by Andreas)
### old: $ mkmethod -M Hoge -s hoge.html module Hoge include ERB::Util def self.expand_hoge(_args) user = _args[:user] _erbout = ''; _erbout.concat "Hello "; _erbout.concat(( html_escape(user) ).to_s); _erbout.concat "\n" _erbout end end ### current: $ mkmethod -M Hoge hoge.html require 'erb' include ERB::Util module Hoge def self.expand_hoge(_args) user = _args[:user] _erbout = ''; _erbout.concat "Hello "; _erbout.concat(( html_escape(user) ).to_s); _erbout.concat "\n" _erbout end end
- [change] mkmethod script generates code "
- 2004-04-23
-
- [enhance] new language 'ruby2' supported, which uses
_s << (...).to_s
instead ofprint ...
.### -l ruby $ kwartz -l ruby file.html print "<ul>\n" for item in list do print " <li>", item, "</li>\n" end print "</ul>\n" ### -l ruby2 $ kwartz -l ruby2 file.html _s << "<ul>\n" for item in list do _s << " <li>" << (item).to_s << "</li>\n" end _s << "</ul>\n"
- [enhance] new language 'php2' supported, which gets output as string using ob_start(), ob_get_contents() and ob_end_clean().
### -l php2 $ kwartz -l php2 file.html <?php ob_start(); ?> <ul> <?php foreach ($list as $item) { ?> <li><?php echo $item; ?></li> <?php } ?> </ul> <?php $_s = ob_get_contents(); ob_end_clean(); ?>
- [enhance] utility script 'mkmethod' now support 'ruby2', 'php' and 'php2'. And default lang is now 'ruby2'.
- [enhance] utility script 'mkmethod' now can take option -A, which specifies method arguments.
$ mkmethod -M Hoge -A user,list 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 << "<ul>\n" for item in list do _s << " <li>" << (item).to_s << "</li>\n" end _s << "</ul>\n" return _s end end
- [enhance] new language 'ruby2' supported, which uses
- 2004-04-05
-
- [bugfix] a bug is fixed which doesn't analyze right-hand expr of :set() statement when left-hand variable is already registered (reported by Shu-yu Go, he is a great programmer)
- 2004-04-04
-
- [bugfix] now can handle negative number in analyze action. (reported by Andreas)
- [update] user's guide updated.
- 2004-03-26
-
- [change] Use 'html_escape()' instead of 'CGI.escapeHTML()' when ERB.
You should include ERB::Util when sanitizing with ERB.
require 'erb' include ERB::Util str = File.open('file.erb') { |f| f.read } erb = ERB.new(str, $SAFE, '%') print erb.result()
- [enhance] Utility script 'mkmethod' added, which compile template and generate Ruby module.
This is a sample of 'mkmethod'.
bash$ mkmethod -h Usage: mkmethod [-p file] [-l lang] [-M module] [-m method] [-s] file.html Options: -p file : presentation logic file -l lang : ruby / eruby / erb (default 'ruby') -M module : module name (default none) -m method : method name (default 'expand_' + file) -s : sanitizing (equals to '--escape=true') --name=value : options for kwartz bash$ mkmethod -p hoge.plogic hoge.html def expand_hoge(_args) user = _args[:user] list = _args[:list] print "Hello " print user print "!\n" for item in list do print "<ul>\n" print " <li>", item, "</li>\n" print "</ul>\n" end end bash$ mkmethod -p hoge.plogic -M Hoge -l erb hoge.html module Hoge include ERB::Util def self.expand_hoge(_args) user = _args[:user] list = _args[:list] _erbout = ''; _erbout.concat "Hello "; _erbout.concat(( user ).to_s); _erbout.concat "!\n" for item in list do _erbout.concat "<ul>\n" _erbout.concat " <li>"; _erbout.concat(( item ).to_s); _erbout.concat "</li>\n" _erbout.concat "</ul>\n" end _erbout end end
- [change] Use 'html_escape()' instead of 'CGI.escapeHTML()' when ERB.
You should include ERB::Util when sanitizing with ERB.
- 2004-03-25
-
- [enhance] New directive 'include', which includes other presentation data file. (suggested by Andreas)
Presentation data:<span id="include:'file.html'"/>
- [enhance] New statement
:load()
added in intermediate language, and new directive 'load
' added. These are to load other presentation logic file. 'load
' directive is converted into:load()
statement.
Presentation data:<span id="load:'file.plogic'"/>
Presentation logic::load('file.plogic')
- [enhance] New command option
--include_path=dir1,dir2,
... added. This is to specify directories from which 'include
' directive includes a file.
- [enhance] New command option
--load_path=dir1,dir2,
... added. This is to specify directories from which 'load
' directive loads a file.
- [change]
CGI.escapeHTML(x)
==>CGI.escapeHTML((x).to_s)
when Ruby and eRuby (suggested by Andreas)
- [enhance] New directive 'include', which includes other presentation data file. (suggested by Andreas)
- 2004-03-24
-
- [enhance] function
E()
andX()
are supported in PL.E(expr)
sanitizes expression expr, andX(expr)
never sanitizes. These are independent of command line option-s
or--escape
.
Presentation data:#{expr}# #{E(expr)}# #{X(expr)}#
Output script (PHP):<?php echo expr; ?> <?php echo htmlspecialchars(expr); ?> <?php echo expr; ?>
Output script (PHP) (with command option -s):<?php echo htmlspecialchars(expr); ?> <?php echo htmlspecialchars(expr); ?> <?php echo expr; ?>
- [enhance] New directives
id="Value:expr"
andid="VALUE:expr"
support. The former is equal toid="value:E(expr)"
and it prints expr with sanitizing. The later is equal toid="value:X(expr)"
and it prints expr without sanitizing.
- [enhance] New directives
id="Attr:name:value"
andid="ATTR:name:value"
support. The former is equal toid="attr:name:E(value)"
and it prints value with sanitizing. The later is equal toid="attr:name:X(value)"
and it prints value without sanitizing.
- [enhance] function
- 2004-03-22
-
- [change] Delete only <span> tag and leave <div> tag. (suggested by Andreas)
- 2004-03-21
-
- [bugfix] Be able to handle nested tags correctly. (reported by Andreas)
- 2004-03-20
-
- [enhance] special macro BEGIN and END support
Macro
BEGIN
is printed at the begin of output script, and macroEND
is printed at the end of output script.
- [enhance] Ruby sanitizing support
- [enhance] special macro BEGIN and END support
Macro
- 2004-03-19
-
- [enhance] 'Id' attribute has now ability equal to 'kd' attribute. You can use 'id' attribute instead of 'kd' attribute. In addition, you can use both 'id' and 'kd' attribute in a tag.
- [enhance] '
id="name"
' is recognized as 'id="mark:name"
'
- [enhance] New keyword 'empty' supported.
str==empty
is equal tostr==null || str==''
.str!=empty
is equal tostr!=nil && str!=''
.
- [enhance] New action 'analyze', which analyzes template and reports global/local vars in template.
Presentation data (hoge.html):Hello #{user}# ! <ul id="mark:itemlist"> <li id="value:item">foo</li> </ul>
Presentation logic (hoge.plogic)::elem(itemlist) :foreach(item = itemlist) @stag @cont @etag :end :end
Result:$ kwartz -a analyze -p hoge.plogic hoge.html global variables: user itemlist local variables: item
- [enhance] New command line option '
--enable_eruby=true
' enables presentation logic to contain eRuby code. It means that you can embed multi rawcode into presentation logic.
- [enhance] New notation of directive '
id="foreach:item:list"
' and 'id="attr:name:value"
' supported. These are more suitable for id attribute, because id attribute cannot take a string containing '=
' according to HTML specification.
- [enhance] New directive 'id="replace:elemname"', which replaces the element with the element which is marked as elemame.
- 2004-03-08
-
- [change] '${expr}' => '$!{expr}' in Velocity
- [enhance] translate '
expr!=null
' and 'epxr==null
' into 'expr
' and '!expr
' in Velocity
- 2004-02-27
-
- [enhance] Don't sanitize when conditional operator returns constant string or number even if command line option
-s
is specified.
- [enhance] Don't sanitize when conditional operator returns constant string or number even if command line option
- 2004-02-24
-
- [enhance] Scripts of 'W3C Markup Validation Service for Kwartz' included. These are utility scripts which delete kd attributes in HTML file and send it to W3C Markup Validation Service.
- 2004-02-18
-
- [enhance] namespace support in
attr
directive.
- [enhance] namespace support in
- 2004-02-12
-
- public release