kwartz 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +36 -1
- data/LGPL +504 -0
- data/README.txt +16 -2
- data/bin/kwartz +1 -1
- data/doc-api/classes/Kwartz.html +47 -1
- data/doc-api/classes/Kwartz/Assertion.html +6 -6
- data/doc-api/classes/Kwartz/AssertionError.html +6 -6
- data/doc-api/classes/Kwartz/AttrInfo.html +42 -42
- data/doc-api/classes/Kwartz/BaseError.html +12 -12
- data/doc-api/classes/Kwartz/BaseTranslator.html +210 -43
- data/doc-api/classes/Kwartz/CharacterType.html +24 -24
- data/doc-api/classes/Kwartz/CommandOptionError.html +7 -7
- data/doc-api/classes/Kwartz/CommandOptions.html +49 -49
- data/doc-api/classes/Kwartz/Config.html +6 -1
- data/doc-api/classes/Kwartz/ConvertError.html +14 -14
- data/doc-api/classes/Kwartz/Converter.html +31 -30
- data/doc-api/classes/Kwartz/CssStyleParser.html +79 -57
- data/doc-api/classes/Kwartz/Defun.html +313 -0
- data/doc-api/classes/Kwartz/DocumentRuleset.html +58 -58
- data/doc-api/classes/Kwartz/ElementExpander.html +32 -32
- data/doc-api/classes/Kwartz/ElementInfo.html +29 -29
- data/doc-api/classes/Kwartz/ElementRuleset.html +126 -96
- data/doc-api/classes/Kwartz/EperlHandler.html +108 -84
- data/doc-api/classes/Kwartz/EperlTranslator.html +7 -7
- data/doc-api/classes/Kwartz/ErubisHandler.html +2 -2
- data/doc-api/classes/Kwartz/ErubisTranslator.html +8 -8
- data/doc-api/classes/Kwartz/ErubyHandler.html +2 -220
- data/doc-api/classes/Kwartz/ErubyTranslator.html +7 -7
- data/doc-api/classes/Kwartz/ExpandStatement.html +20 -20
- data/doc-api/classes/Kwartz/Handler.html +122 -117
- data/doc-api/classes/Kwartz/HandlerArgument.html +215 -0
- data/doc-api/classes/Kwartz/Helper.html +112 -0
- data/doc-api/classes/Kwartz/Helper/ActionViewHelper.html +221 -0
- data/doc-api/classes/Kwartz/Helper/RailsTemplate.html +630 -0
- data/doc-api/classes/Kwartz/JstlHandler.html +208 -193
- data/doc-api/classes/Kwartz/JstlTranslator.html +15 -15
- data/doc-api/classes/Kwartz/KwartzError.html +6 -6
- data/doc-api/classes/Kwartz/Main.html +39 -23
- data/doc-api/classes/Kwartz/NativeExpression.html +18 -18
- data/doc-api/classes/Kwartz/NativeStatement.html +25 -25
- data/doc-api/classes/Kwartz/Node.html +6 -6
- data/doc-api/classes/Kwartz/PIErubisHandler.html +113 -0
- data/doc-api/classes/Kwartz/PIErubisTranslator.html +200 -0
- data/doc-api/classes/Kwartz/ParseError.html +6 -6
- data/doc-api/classes/Kwartz/PhpHandler.html +102 -83
- data/doc-api/classes/Kwartz/PhpTranslator.html +14 -14
- data/doc-api/classes/Kwartz/PresentationLogicParser.html +136 -128
- data/doc-api/classes/Kwartz/PrintStatement.html +19 -19
- data/doc-api/classes/Kwartz/RailsHandler.html +121 -118
- data/doc-api/classes/Kwartz/RailsTranslator.html +7 -7
- data/doc-api/classes/Kwartz/RubyHandler.html +349 -0
- data/doc-api/classes/Kwartz/RubyStyleParser.html +85 -85
- data/doc-api/classes/Kwartz/RubyTranslator.html +218 -0
- data/doc-api/classes/Kwartz/StatementHelper.html +479 -0
- data/doc-api/classes/Kwartz/StrutsTranslator.html +12 -12
- data/doc-api/classes/Kwartz/TagInfo.html +28 -28
- data/doc-api/classes/Kwartz/TextConverter.html +28 -28
- data/doc-api/classes/Kwartz/Translator.html +42 -42
- data/doc-api/classes/Kwartz/Util.html +284 -0
- data/doc-api/created.rid +1 -1
- data/doc-api/files/__/README_txt.html +30 -3
- data/doc-api/files/kwartz/assert_rb.html +1 -1
- data/doc-api/files/kwartz/binding/eperl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/erubis_rb.html +3 -3
- data/doc-api/files/kwartz/binding/eruby_rb.html +3 -2
- data/doc-api/files/kwartz/binding/jstl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/php_rb.html +2 -2
- data/doc-api/files/kwartz/binding/pierubis_rb.html +116 -0
- data/doc-api/files/kwartz/binding/rails_rb.html +2 -2
- data/doc-api/files/kwartz/binding/ruby_rb.html +115 -0
- data/doc-api/files/kwartz/binding/struts_rb.html +1 -1
- data/doc-api/files/kwartz/config_rb.html +2 -2
- data/doc-api/files/kwartz/converter_rb.html +3 -2
- data/doc-api/files/kwartz/defun_rb.html +116 -0
- data/doc-api/files/kwartz/error_rb.html +1 -1
- data/doc-api/files/kwartz/helper/rails_rb.html +123 -0
- data/doc-api/files/kwartz/main_rb.html +5 -2
- data/doc-api/files/kwartz/node_rb.html +2 -2
- data/doc-api/files/kwartz/parser_rb.html +2 -2
- data/doc-api/files/kwartz/translator_rb.html +2 -2
- data/doc-api/files/kwartz/util/assert-text-equal_rb.html +1 -1
- data/doc-api/files/kwartz/util/testcase-helper_rb.html +2 -2
- data/doc-api/files/kwartz/util_rb.html +107 -0
- data/doc-api/files/kwartz_rb.html +3 -2
- data/doc-api/fr_class_index.html +11 -0
- data/doc-api/fr_file_index.html +5 -0
- data/doc-api/fr_method_index.html +242 -190
- data/doc/p-pattern.html +94 -94
- data/doc/reference.html +847 -612
- data/doc/users-guide.html +744 -241
- data/examples/rails1/README +2 -2
- data/examples/rails1/application_helper.rb +2 -27
- data/examples/rails1/link_to.plogic +5 -5
- data/examples/rails1/list.plogic +2 -2
- data/examples/rails2/app/controllers/application.rb +14 -0
- data/examples/rails2/app/controllers/groups_controller.rb +47 -0
- data/examples/rails2/app/controllers/members_controller.rb +56 -0
- data/examples/rails2/app/helpers/application_helper.rb +6 -0
- data/examples/rails2/app/helpers/groups_helper.rb +2 -0
- data/examples/rails2/app/helpers/members_helper.rb +2 -0
- data/examples/rails2/app/models/group.rb +2 -0
- data/examples/rails2/app/models/member.rb +3 -0
- data/examples/rails2/app/views/groups/_form.html +30 -0
- data/examples/rails2/app/views/groups/_form.plogic +11 -0
- data/examples/rails2/app/views/groups/_link.plogic +19 -0
- data/examples/rails2/app/views/groups/_read.plogic +7 -0
- data/examples/rails2/app/views/groups/edit.cfg.yaml +2 -0
- data/examples/rails2/app/views/groups/edit.html +26 -0
- data/examples/rails2/app/views/groups/edit.plogic +9 -0
- data/examples/rails2/app/views/groups/list.html +48 -0
- data/examples/rails2/app/views/groups/list.plogic +32 -0
- data/examples/rails2/app/views/groups/new.cfg.yaml +2 -0
- data/examples/rails2/app/views/groups/new.html +27 -0
- data/examples/rails2/app/views/groups/new.plogic +9 -0
- data/examples/rails2/app/views/groups/show.html +27 -0
- data/examples/rails2/app/views/groups/show.plogic +2 -0
- data/examples/rails2/app/views/layouts/groups.html +23 -0
- data/examples/rails2/app/views/layouts/groups.plogic +11 -0
- data/examples/rails2/app/views/layouts/members.html +23 -0
- data/examples/rails2/app/views/layouts/members.plogic +11 -0
- data/examples/rails2/app/views/layouts/members2.html +24 -0
- data/examples/rails2/app/views/layouts/members2.plogic +11 -0
- data/examples/rails2/app/views/members/_form.plogic +27 -0
- data/examples/rails2/app/views/members/_link.plogic +19 -0
- data/examples/rails2/app/views/members/_read.plogic +29 -0
- data/examples/rails2/app/views/members/edit.cfg.yaml +6 -0
- data/examples/rails2/app/views/members/edit.html +27 -0
- data/examples/rails2/app/views/members/edit.plogic +10 -0
- data/examples/rails2/app/views/members/list.html +53 -0
- data/examples/rails2/app/views/members/list.plogic +32 -0
- data/examples/rails2/app/views/members/new.html +61 -0
- data/examples/rails2/app/views/members/new.plogic +17 -0
- data/examples/rails2/app/views/members/show.html +41 -0
- data/examples/rails2/app/views/members/show.plogic +3 -0
- data/examples/rails2/db/create-tables.mysql.sql +27 -0
- data/examples/rails2/db/create-tables.pgsql.sql +27 -0
- data/examples/rails2/db/insert-data.sql +21 -0
- data/examples/rails2/db/tabledef.yaml +51 -0
- data/kwartz.gemspec +4 -4
- data/lib/kwartz.rb +10 -2
- data/lib/kwartz/assert.rb +1 -1
- data/lib/kwartz/binding/eperl.rb +85 -61
- data/lib/kwartz/binding/erubis.rb +6 -8
- data/lib/kwartz/binding/eruby.rb +5 -120
- data/lib/kwartz/binding/jstl.rb +116 -101
- data/lib/kwartz/binding/php.rb +79 -60
- data/lib/kwartz/binding/pierubis.rb +58 -0
- data/lib/kwartz/binding/rails.rb +45 -42
- data/lib/kwartz/binding/ruby.rb +193 -0
- data/lib/kwartz/binding/struts.rb +1 -1
- data/lib/kwartz/config.rb +4 -3
- data/lib/kwartz/converter.rb +231 -68
- data/lib/kwartz/defun.rb +126 -0
- data/lib/kwartz/error.rb +1 -1
- data/lib/kwartz/helper/rails.rb +437 -0
- data/lib/kwartz/main.rb +30 -38
- data/lib/kwartz/node.rb +46 -31
- data/lib/kwartz/parser.rb +43 -15
- data/lib/kwartz/translator.rb +104 -6
- data/lib/kwartz/util.rb +113 -0
- data/lib/kwartz/util/assert-text-equal.rb +1 -1
- data/lib/kwartz/util/testcase-helper.rb +26 -8
- data/test/test-compile.rb +3 -3
- data/test/test-compile.yaml +135 -5
- data/test/test-converter.rb +16 -8
- data/test/test-converter.yaml +307 -76
- data/test/test-directives.rb +1 -1
- data/test/test-directives.yaml +964 -979
- data/test/test-main.rb +61 -146
- data/test/test-main.yaml +235 -0
- data/test/test-parser.rb +10 -12
- data/test/test-parser.yaml +484 -326
- data/test/test-rails.rb +1 -1
- data/test/test-rails.yaml +37 -37
- data/test/test-ruleset.rb +1 -1
- data/test/test-ruleset.yaml +34 -40
- data/test/test.rb +1 -1
- metadata +82 -3
- data/COPYING +0 -340
@@ -0,0 +1,41 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Show member</title>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
|
8
|
+
<h1 id="page_title">Show member</h1>
|
9
|
+
|
10
|
+
<div id="page_content">
|
11
|
+
<p>
|
12
|
+
<b>Name:</b>
|
13
|
+
<span id="mark:member_name">Foo</span>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<b>Email:</b>
|
18
|
+
<span id="mark:member_email">foo@mail.com</span>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<p>
|
22
|
+
<b>Birth:</b>
|
23
|
+
<span id="mark:member_birth">2000-01-01</span>
|
24
|
+
</p>
|
25
|
+
|
26
|
+
<p>
|
27
|
+
<b>Gender:</b>
|
28
|
+
<span id="mark:member_gender">Woman</span>
|
29
|
+
</p>
|
30
|
+
|
31
|
+
<p>
|
32
|
+
<b>Group:</b>
|
33
|
+
<span id="mark:member_group">admin</span>
|
34
|
+
</p>
|
35
|
+
|
36
|
+
<a href="#" id="link_to_edit">Edit</a> |
|
37
|
+
<a href="#" id="link_to_list">Back</a>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
</body>
|
41
|
+
</html>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
----------------------------------------------------------------------
|
2
|
+
-- DDL for MySQL
|
3
|
+
-- generated by kwatable with template 'ddl-mysql.eruby'
|
4
|
+
-- at Sun Sep 17 21:18:57 JST 2006
|
5
|
+
----------------------------------------------------------------------
|
6
|
+
|
7
|
+
-- group master table
|
8
|
+
drop table if exists groups;
|
9
|
+
create table groups (
|
10
|
+
id integer auto_increment primary key,
|
11
|
+
name varchar(63) not null unique,
|
12
|
+
`desc` text
|
13
|
+
);
|
14
|
+
|
15
|
+
-- member master table
|
16
|
+
drop table if exists members;
|
17
|
+
create table members (
|
18
|
+
id integer auto_increment primary key,
|
19
|
+
name varchar(63) not null unique,
|
20
|
+
`desc` text ,
|
21
|
+
email varchar(63) ,
|
22
|
+
gender enum('M', 'W', 'X') ,
|
23
|
+
birth date ,
|
24
|
+
group_id integer not null references groups(id),
|
25
|
+
created_at timestamp not null,
|
26
|
+
updated_at timestamp not null
|
27
|
+
);
|
@@ -0,0 +1,27 @@
|
|
1
|
+
----------------------------------------------------------------------
|
2
|
+
-- DDL for PostgreSQL
|
3
|
+
-- generated by kwatable with template 'ddl-postgresql.eruby'
|
4
|
+
-- at Sun Sep 17 21:18:58 JST 2006
|
5
|
+
----------------------------------------------------------------------
|
6
|
+
|
7
|
+
-- group master table
|
8
|
+
drop table groups;
|
9
|
+
create table groups (
|
10
|
+
id serial primary key,
|
11
|
+
name varchar(63) not null unique,
|
12
|
+
"desc" text
|
13
|
+
);
|
14
|
+
|
15
|
+
-- member master table
|
16
|
+
drop table members;
|
17
|
+
create table members (
|
18
|
+
id serial primary key,
|
19
|
+
name varchar(63) not null unique,
|
20
|
+
"desc" text ,
|
21
|
+
email varchar(63) ,
|
22
|
+
gender varchar(1) , -- M,W,X
|
23
|
+
birth date ,
|
24
|
+
group_id integer not null references groups(id),
|
25
|
+
created_at timestamp not null,
|
26
|
+
updated_at timestamp not null
|
27
|
+
);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
-- groups
|
2
|
+
delete from groups;
|
3
|
+
insert into groups values (null, 'admin', 'administrators');
|
4
|
+
insert into groups values (null, 'users', 'common users');
|
5
|
+
insert into groups values (null, 'guest', 'guest group');
|
6
|
+
|
7
|
+
-- members
|
8
|
+
delete from members;
|
9
|
+
insert into members values (null, 'root', 'administrator', 'root@localhost', 'X', null, 1, current_timestamp, current_timestamp);
|
10
|
+
insert into members values (null, 'guest', 'guest user', null, 'X', null, 3, current_timestamp, current_timestamp);
|
11
|
+
insert into members values (null, 'foo', 'user foo', 'foo@mail.com', 'W', '1980-02-03', 2, current_timestamp, current_timestamp);
|
12
|
+
insert into members values (null, 'bar', 'user bar', 'bar@mail.net', 'W', '1981-04-05', 2, current_timestamp, current_timestamp);
|
13
|
+
insert into members values (null, 'baz', 'user baz', 'baz@mail.org', 'M', '1982-06-07', 2, current_timestamp, current_timestamp);
|
14
|
+
insert into members values (null, '<b>"X&Y"</b>', '<i>"escape test&"</i>', '"<&>"@xxx.com', 'W', '1990-01-01', 2, current_timestamp, current_timestamp);
|
15
|
+
insert into members values (null, 'aaa', 'user aaa', 'aaa@aaa.com', 'W', '1990-01-01', 2, current_timestamp, current_timestamp);
|
16
|
+
insert into members values (null, 'bbb', 'user bbb', 'bbb@bbb.com', 'W', '1990-01-01', 2, current_timestamp, current_timestamp);
|
17
|
+
insert into members values (null, 'ccc', 'user ccc', 'ccc@ccc.com', 'W', '1990-01-01', 2, current_timestamp, current_timestamp);
|
18
|
+
insert into members values (null, 'ddd', 'user ddd', 'ddd@ddd.com', 'W', '1990-01-01', 2, current_timestamp, current_timestamp);
|
19
|
+
insert into members values (null, 'eee', 'user eee', 'eee@eee.com', 'W', '1990-01-01', 2, current_timestamp, current_timestamp);
|
20
|
+
insert into members values (null, 'fff', 'user fff', 'fff@fff.com', 'W', '1990-01-01', 2, current_timestamp, current_timestamp);
|
21
|
+
insert into members values (null, 'ggg', 'user ggg', 'ggg@ggg.com', 'W', '1990-01-01', 2, current_timestamp, current_timestamp);
|
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
columns:
|
3
|
+
- name: id
|
4
|
+
type: integer
|
5
|
+
required: yes
|
6
|
+
serial: yes
|
7
|
+
ident: yes
|
8
|
+
- name: name
|
9
|
+
type: string
|
10
|
+
width: 63
|
11
|
+
required: yes
|
12
|
+
unique: yes
|
13
|
+
- name: desc
|
14
|
+
type: text
|
15
|
+
- name: created_at
|
16
|
+
type: timestamp
|
17
|
+
required: yes
|
18
|
+
- name: updated_at
|
19
|
+
type: timestamp
|
20
|
+
required: yes
|
21
|
+
|
22
|
+
tables:
|
23
|
+
|
24
|
+
- name: groups
|
25
|
+
desc: group master table
|
26
|
+
class: Group
|
27
|
+
columns:
|
28
|
+
- name: id
|
29
|
+
- name: name
|
30
|
+
- name: desc
|
31
|
+
|
32
|
+
- name: members
|
33
|
+
desc: member master table
|
34
|
+
class: Member
|
35
|
+
columns:
|
36
|
+
- name: id
|
37
|
+
- name: name
|
38
|
+
- name: desc
|
39
|
+
- name: email
|
40
|
+
type: str
|
41
|
+
width: 63
|
42
|
+
- name: gender
|
43
|
+
type: str
|
44
|
+
enum: [ M, W, X ]
|
45
|
+
- name: birth
|
46
|
+
type: date
|
47
|
+
- name: group_id
|
48
|
+
ref: groups.id
|
49
|
+
required: yes
|
50
|
+
- name: created_at
|
51
|
+
- name: updated_at
|
data/kwartz.gemspec
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
###
|
4
4
|
### RubyGems Specification file for Kwartz-ruby
|
5
5
|
###
|
6
|
-
### $Rev:
|
7
|
-
### $Release: 3.
|
6
|
+
### $Rev: 137 $
|
7
|
+
### $Release: 3.1.0 $
|
8
8
|
### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
|
9
9
|
###
|
10
10
|
|
@@ -14,7 +14,7 @@ spec = Gem::Specification.new do |s|
|
|
14
14
|
## package information
|
15
15
|
s.name = 'kwartz'
|
16
16
|
s.author = 'Makoto Kuwata'
|
17
|
-
s.version = ("$Release: 3.
|
17
|
+
s.version = ("$Release: 3.1.0 $" =~ /[\.\d]+/) && $&
|
18
18
|
s.platform = Gem::Platform::RUBY
|
19
19
|
s.homepage = 'http://www.kuwata-lab.com/kwartz'
|
20
20
|
s.summary = "a template system for Ruby, PHP, and Java"
|
@@ -41,7 +41,7 @@ spec = Gem::Specification.new do |s|
|
|
41
41
|
#"doc/design.css", "doc/design.html",
|
42
42
|
]
|
43
43
|
files += Dir.glob('doc-api/**/*')
|
44
|
-
files += %w[README.txt ChangeLog
|
44
|
+
files += %w[README.txt ChangeLog LGPL setup.rb kwartz.gemspec]
|
45
45
|
s.files = files
|
46
46
|
s.executables = ["kwartz"]
|
47
47
|
s.bindir = "bin"
|
data/lib/kwartz.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
###
|
2
|
-
### $Rev:
|
3
|
-
### $Release: 3.
|
2
|
+
### $Rev: 136 $
|
3
|
+
### $Release: 3.1.0 $
|
4
4
|
### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
|
5
5
|
###
|
6
6
|
|
7
|
+
|
8
|
+
module Kwartz
|
9
|
+
|
10
|
+
RELEASE = ('$Release: 3.1.0 $' =~ /\$Release: (\S+)\s*\$/) && $1
|
11
|
+
|
12
|
+
end
|
13
|
+
|
7
14
|
require 'kwartz/config'
|
8
15
|
require 'kwartz/error'
|
9
16
|
require 'kwartz/assert'
|
@@ -11,3 +18,4 @@ require 'kwartz/node'
|
|
11
18
|
require 'kwartz/parser'
|
12
19
|
require 'kwartz/converter'
|
13
20
|
require 'kwartz/translator'
|
21
|
+
require 'kwartz/defun'
|
data/lib/kwartz/assert.rb
CHANGED
data/lib/kwartz/binding/eperl.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
###
|
2
|
-
### $Rev:
|
3
|
-
### $Release: 3.
|
2
|
+
### $Rev: 123 $
|
3
|
+
### $Release: 3.1.0 $
|
4
4
|
### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
|
5
5
|
###
|
6
6
|
|
@@ -41,15 +41,16 @@ module Kwartz
|
|
41
41
|
end
|
42
42
|
|
43
43
|
|
44
|
-
def handle(
|
44
|
+
def handle(stmt_list, handler_arg)
|
45
45
|
ret = super
|
46
46
|
return ret if ret
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
arg = handler_arg
|
49
|
+
d_name = arg.directive_name
|
50
|
+
d_arg = arg.directive_arg
|
51
|
+
d_str = arg.directive_str
|
51
52
|
|
52
|
-
case
|
53
|
+
case d_name
|
53
54
|
|
54
55
|
when :foreach, :Foreach, :FOREACH, :list, :List, :LIST
|
55
56
|
is_foreach = d_name == :foreach || d_name == :Foreach || d_name == :FOREACH
|
@@ -59,72 +60,95 @@ module Kwartz
|
|
59
60
|
loopvar = $1 ; loopval = $2 ; looplist = $3
|
60
61
|
counter = d_name == :foreach || d_name == :list ? nil : "#{loopvar}_ctr"
|
61
62
|
toggle = d_name != :FOREACH && d_name != :LIST ? nil : "#{loopvar}_tgl"
|
62
|
-
|
63
|
-
|
63
|
+
code = []
|
64
|
+
code << "my #{counter} = 0;" if counter
|
64
65
|
if loopval
|
65
|
-
|
66
|
-
|
66
|
+
code << "foreach my #{loopvar} (keys #{looplist}) {"
|
67
|
+
code << " my #{loopval} = #{looplist.sub(/\A%/,'$')}{#{loopvar}};"
|
67
68
|
else
|
68
|
-
|
69
|
+
code << "foreach my #{loopvar} (#{looplist}) {"
|
69
70
|
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
stmt_list <<
|
81
|
-
stmt_list << NativeStatement.new("
|
82
|
-
|
83
|
-
stmt_list.
|
84
|
-
|
85
|
-
stmt_list
|
86
|
-
stmt_list
|
71
|
+
code << " #{counter}++;" if counter
|
72
|
+
code << " my #{toggle} = #{counter}%2==0 ? #{self.even} : #{self.odd};" if toggle
|
73
|
+
if is_foreach
|
74
|
+
wrap_element_with_native_stmt(stmt_list, arg, code, "}", :foreach)
|
75
|
+
else
|
76
|
+
wrap_content_with_native_stmt(stmt_list, arg, code, "}", :foreach)
|
77
|
+
end
|
78
|
+
#stmt_list << stag_stmt(arg) if !is_foreach
|
79
|
+
#stmt_list << NativeStatement.new("my #{counter} = 0;") if counter
|
80
|
+
#if loopval
|
81
|
+
# stmt_list << NativeStatement.new("foreach my #{loopvar} (keys #{looplist}) {", :foreach)
|
82
|
+
# stmt_list << NativeStatement.new(" my #{loopval} = #{looplist.sub(/\A%/,'$')}{#{loopvar}};")
|
83
|
+
#else
|
84
|
+
# stmt_list << NativeStatement.new("foreach my #{loopvar} (#{looplist}) {", :foreach)
|
85
|
+
#end
|
86
|
+
#stmt_list << NativeStatement.new(" #{counter}++;") if counter
|
87
|
+
#stmt_list << NativeStatement.new(" my #{toggle} = #{counter}%2==0 ? #{self.even} : #{self.odd};") if toggle
|
88
|
+
#stmt_list << stag_stmt(arg) if is_foreach
|
89
|
+
#stmt_list.concat(arg.cont_stmts)
|
90
|
+
#stmt_list << etag_stmt(arg) if is_foreach
|
91
|
+
#stmt_list << NativeStatement.new("}", :foreach)
|
92
|
+
#stmt_list << etag_stmt(arg) if !is_foreach
|
93
|
+
|
94
|
+
when :while
|
95
|
+
wrap_element_with_native_stmt(stmt_list, arg, "while (#{d_arg}) {", "}", :while)
|
96
|
+
#stmt_list << NativeStatement.new("while (#{d_arg}) {", :while)
|
97
|
+
#stmt_list << stag_stmt(arg)
|
98
|
+
#stmt_list.concat(cont_stmts)
|
99
|
+
#stmt_list << etag_stmt(arg)
|
100
|
+
#stmt_list << NativeStatement.new("}", :while)
|
101
|
+
|
102
|
+
when :loop
|
103
|
+
error_if_empty_tag(arg)
|
104
|
+
wrap_content_with_native_stmt(stmt_list, arg, "while (#{d_arg}) {", "}", :while)
|
105
|
+
#stmt_list << stag_stmt
|
106
|
+
#stmt_list << NativeStatement.new("while (#{d_arg}) {", :while)
|
107
|
+
#stmt_list.concat(cont_stmts)
|
108
|
+
#stmt_list << NativeStatement.new("}", :while)
|
109
|
+
#stmt_list << etag_stmt
|
87
110
|
|
88
111
|
when :set
|
89
|
-
stmt_list
|
90
|
-
stmt_list <<
|
91
|
-
stmt_list
|
92
|
-
stmt_list
|
112
|
+
wrap_element_with_native_stmt(stmt_list, arg, "#{d_arg};", nil, :set)
|
113
|
+
#stmt_list << NativeStatement.new("#{d_arg};", :set)
|
114
|
+
#stmt_list << stag_stmt
|
115
|
+
#stmt_list.concat(cont_stmts)
|
116
|
+
#stmt_list << etag_stmt
|
93
117
|
|
94
118
|
when :if
|
95
|
-
stmt_list
|
96
|
-
stmt_list <<
|
97
|
-
stmt_list
|
98
|
-
stmt_list
|
99
|
-
stmt_list <<
|
119
|
+
wrap_element_with_native_stmt(stmt_list, arg, "if (#{d_arg}) {", "}", :if)
|
120
|
+
#stmt_list << NativeStatement.new("if (#{d_arg}) {", :if)
|
121
|
+
#stmt_list << stag_stmt
|
122
|
+
#stmt_list.concat(cont_stmts)
|
123
|
+
#stmt_list << etag_stmt
|
124
|
+
#stmt_list << NativeStatement.new("}", :if)
|
100
125
|
|
101
126
|
when :elsif, :else
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
end
|
113
|
-
stmt_list << build_print_stmt(stag_info, attr_info, append_exprs)
|
114
|
-
stmt_list.concat(cont_stmts)
|
115
|
-
stmt_list << build_print_stmt(etag_info, nil, nil)
|
116
|
-
stmt_list << NativeStatement.new("}", kind)
|
127
|
+
error_when_last_stmt_is_not_if(stmt_list, arg)
|
128
|
+
stmt_list.pop # delete '}'
|
129
|
+
kind = d_name == :else ? :else : :elseif
|
130
|
+
code = d_name == :else ? "} else {" : "} elsif (#{d_arg}) {"
|
131
|
+
wrap_element_with_native_stmt(stmt_list, arg, code, "}", kind)
|
132
|
+
#stmt_list << NativeStatement.new(code, kind)
|
133
|
+
#stmt_list << stag_stmt
|
134
|
+
#stmt_list.concat(cont_stmts)
|
135
|
+
#stmt_list << etag_stmt
|
136
|
+
#stmt_list << NativeStatement.new("}", kind)
|
117
137
|
|
118
138
|
when :default, :Default, :DEFAULT
|
119
|
-
error_if_empty_tag(
|
120
|
-
|
121
|
-
stmt_list << NativeStatement.new_without_newline("if (#{d_arg}) {", :if)
|
139
|
+
error_if_empty_tag(arg)
|
140
|
+
expr_code = d_arg
|
122
141
|
flag_escape = d_name == :default ? nil : (d_name == :Default)
|
123
|
-
stmt_list
|
124
|
-
|
125
|
-
stmt_list
|
126
|
-
stmt_list << NativeStatement.new_without_newline("}", :
|
127
|
-
|
142
|
+
add_native_expr_with_default(stmt_list, arg, expr_code, flag_escape,
|
143
|
+
"if (#{d_arg}) {", "} else {", "}")
|
144
|
+
#stmt_list << stag_stmt(arg)
|
145
|
+
#stmt_list << NativeStatement.new_without_newline("if (#{d_arg}) {", :if)
|
146
|
+
#flag_escape = d_name == :default ? nil : (d_name == :Default)
|
147
|
+
#stmt_list << PrintStatement.new([ NativeExpression.new(d_arg, flag_escape) ])
|
148
|
+
#stmt_list << NativeStatement.new_without_newline("} else {", :else)
|
149
|
+
#stmt_list.concat(arg.cont_stmts)
|
150
|
+
#stmt_list << NativeStatement.new_without_newline("}", :else)
|
151
|
+
#stmt_list << etag_stmt(arg)
|
128
152
|
|
129
153
|
else
|
130
154
|
return false
|
@@ -1,12 +1,12 @@
|
|
1
1
|
###
|
2
|
-
### $Rev:
|
3
|
-
### $Release: 3.
|
2
|
+
### $Rev: 124 $
|
3
|
+
### $Release: 3.1.0 $
|
4
4
|
### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
|
5
5
|
###
|
6
6
|
|
7
7
|
require 'kwartz/converter'
|
8
8
|
require 'kwartz/translator'
|
9
|
-
require 'kwartz/binding/
|
9
|
+
require 'kwartz/binding/ruby'
|
10
10
|
|
11
11
|
|
12
12
|
|
@@ -14,10 +14,8 @@ module Kwartz
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
class ErubisHandler <
|
18
|
-
|
19
|
-
|
20
|
-
end #class
|
17
|
+
class ErubisHandler < RubyHandler
|
18
|
+
end
|
21
19
|
Handler.register_class('erubis', ErubisHandler)
|
22
20
|
|
23
21
|
|
@@ -37,7 +35,7 @@ module Kwartz
|
|
37
35
|
|
38
36
|
def initialize(properties={})
|
39
37
|
super(ERUBIS_EMBED_PATTERNS, properties)
|
40
|
-
|
38
|
+
#@escape = true if @escape == nil
|
41
39
|
end
|
42
40
|
|
43
41
|
|