kwartz 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +340 -0
- data/ChangeLog +103 -0
- data/README.txt +37 -0
- data/bin/kwartz +12 -0
- data/doc-api/classes/Kwartz.html +218 -0
- data/doc-api/classes/Kwartz/Assertion.html +140 -0
- data/doc-api/classes/Kwartz/AssertionError.html +148 -0
- data/doc-api/classes/Kwartz/AttrInfo.html +320 -0
- data/doc-api/classes/Kwartz/BaseError.html +206 -0
- data/doc-api/classes/Kwartz/BaseTranslator.html +331 -0
- data/doc-api/classes/Kwartz/CharacterType.html +212 -0
- data/doc-api/classes/Kwartz/CommandOptionError.html +154 -0
- data/doc-api/classes/Kwartz/CommandOptions.html +374 -0
- data/doc-api/classes/Kwartz/Config.html +150 -0
- data/doc-api/classes/Kwartz/ConvertError.html +191 -0
- data/doc-api/classes/Kwartz/Converter.html +252 -0
- data/doc-api/classes/Kwartz/CssStyleParser.html +483 -0
- data/doc-api/classes/Kwartz/DocumentRuleset.html +369 -0
- data/doc-api/classes/Kwartz/ElementExpander.html +325 -0
- data/doc-api/classes/Kwartz/ElementInfo.html +312 -0
- data/doc-api/classes/Kwartz/ElementRuleset.html +582 -0
- data/doc-api/classes/Kwartz/EperlHandler.html +338 -0
- data/doc-api/classes/Kwartz/EperlTranslator.html +167 -0
- data/doc-api/classes/Kwartz/ErubisHandler.html +113 -0
- data/doc-api/classes/Kwartz/ErubisTranslator.html +168 -0
- data/doc-api/classes/Kwartz/ErubyHandler.html +337 -0
- data/doc-api/classes/Kwartz/ErubyTranslator.html +167 -0
- data/doc-api/classes/Kwartz/ExpandStatement.html +227 -0
- data/doc-api/classes/Kwartz/Expression.html +119 -0
- data/doc-api/classes/Kwartz/Handler.html +558 -0
- data/doc-api/classes/Kwartz/JstlHandler.html +657 -0
- data/doc-api/classes/Kwartz/JstlTranslator.html +226 -0
- data/doc-api/classes/Kwartz/KwartzError.html +146 -0
- data/doc-api/classes/Kwartz/Main.html +384 -0
- data/doc-api/classes/Kwartz/NativeExpression.html +236 -0
- data/doc-api/classes/Kwartz/NativeStatement.html +254 -0
- data/doc-api/classes/Kwartz/Node.html +156 -0
- data/doc-api/classes/Kwartz/ParseError.html +148 -0
- data/doc-api/classes/Kwartz/PhpHandler.html +333 -0
- data/doc-api/classes/Kwartz/PhpTranslator.html +194 -0
- data/doc-api/classes/Kwartz/PresentationLogicParser.html +830 -0
- data/doc-api/classes/Kwartz/PrintStatement.html +221 -0
- data/doc-api/classes/Kwartz/RailsHandler.html +587 -0
- data/doc-api/classes/Kwartz/RailsTranslator.html +167 -0
- data/doc-api/classes/Kwartz/RubyStyleParser.html +558 -0
- data/doc-api/classes/Kwartz/Ruleset.html +117 -0
- data/doc-api/classes/Kwartz/Statement.html +119 -0
- data/doc-api/classes/Kwartz/StrutsTranslator.html +190 -0
- data/doc-api/classes/Kwartz/TagInfo.html +314 -0
- data/doc-api/classes/Kwartz/TextConverter.html +270 -0
- data/doc-api/classes/Kwartz/Translator.html +318 -0
- data/doc-api/classes/Test.html +107 -0
- data/doc-api/classes/Test/Unit.html +101 -0
- data/doc-api/created.rid +1 -0
- data/doc-api/files/__/README_txt.html +150 -0
- data/doc-api/files/kwartz/assert_rb.html +114 -0
- data/doc-api/files/kwartz/binding/eperl_rb.html +116 -0
- data/doc-api/files/kwartz/binding/erubis_rb.html +116 -0
- data/doc-api/files/kwartz/binding/eruby_rb.html +115 -0
- data/doc-api/files/kwartz/binding/jstl_rb.html +116 -0
- data/doc-api/files/kwartz/binding/php_rb.html +116 -0
- data/doc-api/files/kwartz/binding/rails_rb.html +115 -0
- data/doc-api/files/kwartz/binding/struts_rb.html +117 -0
- data/doc-api/files/kwartz/config_rb.html +107 -0
- data/doc-api/files/kwartz/converter_rb.html +119 -0
- data/doc-api/files/kwartz/error_rb.html +107 -0
- data/doc-api/files/kwartz/main_rb.html +124 -0
- data/doc-api/files/kwartz/node_rb.html +114 -0
- data/doc-api/files/kwartz/parser_rb.html +117 -0
- data/doc-api/files/kwartz/translator_rb.html +115 -0
- data/doc-api/files/kwartz/util/assert-text-equal_rb.html +115 -0
- data/doc-api/files/kwartz/util/testcase-helper_rb.html +115 -0
- data/doc-api/files/kwartz_rb.html +120 -0
- data/doc-api/fr_class_index.html +75 -0
- data/doc-api/fr_file_index.html +45 -0
- data/doc-api/fr_method_index.html +216 -0
- data/doc-api/index.html +24 -0
- data/doc-api/rdoc-style.css +208 -0
- data/doc/docstyle.css +188 -0
- data/doc/p-pattern.html +1207 -0
- data/doc/reference.html +3396 -0
- data/doc/users-guide.html +1670 -0
- data/examples/breadcrumbs1/Makefile +15 -0
- data/examples/breadcrumbs1/breadcrumbs.eruby.plogic +27 -0
- data/examples/breadcrumbs1/breadcrumbs.html +12 -0
- data/examples/breadcrumbs1/breadcrumbs.jstl.plogic +28 -0
- data/examples/breadcrumbs1/breadcrumbs.php.plogic +26 -0
- data/examples/breadcrumbs1/main.php +12 -0
- data/examples/breadcrumbs1/main.rb +12 -0
- data/examples/breadcrumbs2/Makefile +15 -0
- data/examples/breadcrumbs2/breadcrumbs.eruby.plogic +22 -0
- data/examples/breadcrumbs2/breadcrumbs.html +14 -0
- data/examples/breadcrumbs2/breadcrumbs.jstl.plogic +24 -0
- data/examples/breadcrumbs2/breadcrumbs.php.plogic +23 -0
- data/examples/breadcrumbs2/main.php +12 -0
- data/examples/breadcrumbs2/main.rb +12 -0
- data/examples/pagelayout/Makefile +47 -0
- data/examples/pagelayout/content.eruby.plogic +44 -0
- data/examples/pagelayout/content.jstl.plogic +36 -0
- data/examples/pagelayout/content.php.plogic +37 -0
- data/examples/pagelayout/content1.html +36 -0
- data/examples/pagelayout/content2.html +29 -0
- data/examples/pagelayout/design.css +40 -0
- data/examples/pagelayout/layout.html +50 -0
- data/examples/pagelayout/main.php +55 -0
- data/examples/pagelayout/main.rb +77 -0
- data/examples/pagelayout/menu.eruby.plogic +14 -0
- data/examples/pagelayout/menu.html +13 -0
- data/examples/pagelayout/menu.jstl.plogic +14 -0
- data/examples/pagelayout/menu.php.plogic +14 -0
- data/examples/rails1/Makefile +36 -0
- data/examples/rails1/README +19 -0
- data/examples/rails1/application_helper.rb +31 -0
- data/examples/rails1/edit.html +28 -0
- data/examples/rails1/edit.plogic +10 -0
- data/examples/rails1/form.html +52 -0
- data/examples/rails1/form.plogic +33 -0
- data/examples/rails1/layout.plogic +15 -0
- data/examples/rails1/link_to.plogic +19 -0
- data/examples/rails1/list.html +48 -0
- data/examples/rails1/list.plogic +28 -0
- data/examples/rails1/new.html +27 -0
- data/examples/rails1/new.plogic +10 -0
- data/examples/rails1/reader.plogic +29 -0
- data/examples/rails1/show.html +40 -0
- data/examples/rails1/show.plogic +4 -0
- data/examples/rails1/writer.plogic +8 -0
- data/examples/table1/Makefile +15 -0
- data/examples/table1/main.php +11 -0
- data/examples/table1/main.rb +11 -0
- data/examples/table1/table1.eruby.plogic +21 -0
- data/examples/table1/table1.html +16 -0
- data/examples/table1/table1.jstl.plogic +21 -0
- data/examples/table1/table1.php.plogic +22 -0
- data/kwartz.gemspec +55 -0
- data/lib/kwartz.rb +13 -0
- data/lib/kwartz/assert.rb +31 -0
- data/lib/kwartz/binding/eperl.rb +166 -0
- data/lib/kwartz/binding/erubis.rb +61 -0
- data/lib/kwartz/binding/eruby.rb +164 -0
- data/lib/kwartz/binding/jstl.rb +334 -0
- data/lib/kwartz/binding/php.rb +167 -0
- data/lib/kwartz/binding/rails.rb +295 -0
- data/lib/kwartz/binding/struts.rb +109 -0
- data/lib/kwartz/config.rb +28 -0
- data/lib/kwartz/converter.rb +920 -0
- data/lib/kwartz/error.rb +41 -0
- data/lib/kwartz/main.rb +464 -0
- data/lib/kwartz/node.rb +454 -0
- data/lib/kwartz/parser.rb +903 -0
- data/lib/kwartz/translator.rb +153 -0
- data/lib/kwartz/util/assert-text-equal.rb +44 -0
- data/lib/kwartz/util/testcase-helper.rb +112 -0
- data/setup.rb +1331 -0
- data/test/test-compile.rb +36 -0
- data/test/test-compile.yaml +178 -0
- data/test/test-converter.rb +34 -0
- data/test/test-converter.yaml +127 -0
- data/test/test-directives.rb +32 -0
- data/test/test-directives.yaml +1411 -0
- data/test/test-main.rb +464 -0
- data/test/test-parser.rb +54 -0
- data/test/test-parser.yaml +394 -0
- data/test/test-rails.rb +28 -0
- data/test/test-rails.yaml +301 -0
- data/test/test-ruleset.rb +36 -0
- data/test/test-ruleset.yaml +804 -0
- data/test/test.rb +44 -0
- metadata +236 -0
@@ -0,0 +1,301 @@
|
|
1
|
+
---
|
2
|
+
###
|
3
|
+
### FormHelper:
|
4
|
+
### - [v] check_box
|
5
|
+
### - [v] file_field
|
6
|
+
### - [v] hidden_field
|
7
|
+
### - [v] password_field
|
8
|
+
### - [v] radio_button
|
9
|
+
### - [v] text_area
|
10
|
+
### - [v] text_field
|
11
|
+
###
|
12
|
+
|
13
|
+
##
|
14
|
+
- name: check_box1
|
15
|
+
binding: rails
|
16
|
+
pdata: |
|
17
|
+
<input type="checkbox" id="user_chk1" title="check_box">
|
18
|
+
<input type="checkbox" name="user[chk2]" title="check_box">
|
19
|
+
expected: |
|
20
|
+
<%= check_box 'user', 'chk1' %>
|
21
|
+
<%= check_box 'user', 'chk2' %>
|
22
|
+
|
23
|
+
##
|
24
|
+
- name: file_field1
|
25
|
+
binding: rails
|
26
|
+
pdata: |
|
27
|
+
<input type="file" id="user_attach" title="file_field">
|
28
|
+
<input type="file" name="user[attach]" title="file_field">
|
29
|
+
expected: |
|
30
|
+
<%= file_field 'user', 'attach' %>
|
31
|
+
<%= file_field 'user', 'attach' %>
|
32
|
+
|
33
|
+
##
|
34
|
+
- name: hidden_field1
|
35
|
+
binding: rails
|
36
|
+
pdata: |
|
37
|
+
<input type="hidden" id="user_id" title="hidden_field">
|
38
|
+
<input type="hidden" name="user[id]" title="hidden_field">
|
39
|
+
expected: |
|
40
|
+
<%= hidden_field 'user', 'id' %>
|
41
|
+
<%= hidden_field 'user', 'id' %>
|
42
|
+
|
43
|
+
##
|
44
|
+
- name: password_field1
|
45
|
+
binding: rails
|
46
|
+
pdata: |
|
47
|
+
<input type="password" size="10" maxsize="20" title="password_field 'user1', 'name1'">
|
48
|
+
<input type="password" size="10" maxsize="20" id="user2_name2" title="password_field">
|
49
|
+
<input type="password" size="10" maxsize="20" name="user3[name3]" title="password_field">
|
50
|
+
expected: |
|
51
|
+
<%= password_field 'user1', 'name1', :size=>10, :maxsize=>20 %>
|
52
|
+
<%= password_field 'user2', 'name2', :size=>10, :maxsize=>20 %>
|
53
|
+
<%= password_field 'user3', 'name3', :size=>10, :maxsize=>20 %>
|
54
|
+
|
55
|
+
##
|
56
|
+
- name: radio_button1
|
57
|
+
binding: rails
|
58
|
+
pdata: |
|
59
|
+
<input type="radio" id="user_radio_button1" value="button1" title="radio_button">
|
60
|
+
<input type="radio" name="user[radio]" value="button2" title="radio_button">
|
61
|
+
expected: |
|
62
|
+
<%= radio_button 'user', 'radio', 'button1' %>
|
63
|
+
<%= radio_button 'user', 'radio', 'button2' %>
|
64
|
+
|
65
|
+
##
|
66
|
+
- name: text_area1
|
67
|
+
binding: rails
|
68
|
+
pdata: |
|
69
|
+
<textarea cols="3" rows="10" title="text_area 'user1', 'desc1'">...</textarea>
|
70
|
+
<textarea cols="2" rows="20" id="user2_desc2" title="text_area">...</textarea>
|
71
|
+
<textarea cols="1" rows="30" name="user3[desc3]" title="text_area">...</textarea>
|
72
|
+
expected: |
|
73
|
+
<%= text_area 'user1', 'desc1', :cols=>3, :rows=>10 %>
|
74
|
+
<%= text_area 'user2', 'desc2', :cols=>2, :rows=>20 %>
|
75
|
+
<%= text_area 'user3', 'desc3', :cols=>1, :rows=>30 %>
|
76
|
+
|
77
|
+
##
|
78
|
+
- name: text_field1
|
79
|
+
binding: rails
|
80
|
+
pdata: |
|
81
|
+
<input type="text" size="10" maxsize="20" title="text_field 'user1', 'name1'">
|
82
|
+
<input type="text" size="10" maxsize="20" id="user2_name2" title="text_field">
|
83
|
+
<input type="text" size="10" maxsize="20" name="user3[name3]" title="text_field">
|
84
|
+
expected: |
|
85
|
+
<%= text_field 'user1', 'name1', :size=>10, :maxsize=>20 %>
|
86
|
+
<%= text_field 'user2', 'name2', :size=>10, :maxsize=>20 %>
|
87
|
+
<%= text_field 'user3', 'name3', :size=>10, :maxsize=>20 %>
|
88
|
+
|
89
|
+
---
|
90
|
+
###
|
91
|
+
### FormTagHelper:
|
92
|
+
### - [_]check_box_tag
|
93
|
+
### - [_]end_form_tag
|
94
|
+
### - [_]file_field_tag
|
95
|
+
### - [v]form_tag
|
96
|
+
### - [_]hidden_field_tag
|
97
|
+
### - [_]image_submit_tag
|
98
|
+
### - [_]password_field_tag
|
99
|
+
### - [_]radio_button_tag
|
100
|
+
### - [_]select_tag
|
101
|
+
### - [_]start_form_tag
|
102
|
+
### - [_]submit_tag
|
103
|
+
### - [_]text_area_tag
|
104
|
+
### - [_]text_field_tag
|
105
|
+
###
|
106
|
+
|
107
|
+
##
|
108
|
+
- name: form_tag1
|
109
|
+
binding: rails
|
110
|
+
pdata: |
|
111
|
+
<form action="show" method="get" multipart="" title="form_tag">
|
112
|
+
</form>
|
113
|
+
<form title="form_tag ( {:action=>'show', :id=>2}, {:method=>'get', :multipart=>true} )">
|
114
|
+
</form>
|
115
|
+
expected: |
|
116
|
+
<%= form_tag 'action'=>'show' %>
|
117
|
+
</form>
|
118
|
+
<%= form_tag ( {:action=>'show', :id=>2}, {:method=>'get', :multipart=>true} ) %>
|
119
|
+
</form>
|
120
|
+
|
121
|
+
##
|
122
|
+
- name: submit_tag1
|
123
|
+
binding: rails
|
124
|
+
pdata: |
|
125
|
+
<input type="submit" value="OK" title="submit_tag:">
|
126
|
+
<input type="submit" value="OK" title="submit_tag">
|
127
|
+
<input type="submit" title="submit_tag">
|
128
|
+
expected: |
|
129
|
+
<%= submit_tag 'OK' %>
|
130
|
+
<%= submit_tag 'OK' %>
|
131
|
+
<%= submit_tag %>
|
132
|
+
|
133
|
+
---
|
134
|
+
###
|
135
|
+
### FormOptionsHelper
|
136
|
+
### - [v] collection_select
|
137
|
+
### - [_] country_options_for_select
|
138
|
+
### - [v] country_select
|
139
|
+
### - [_] option_groups_from_collection_for_select
|
140
|
+
### - [_] options_for_select
|
141
|
+
### - [_] options_from_collection_for_select
|
142
|
+
### - [v] select
|
143
|
+
### - [_] time_zone_options_for_select
|
144
|
+
### - [v] time_zone_select
|
145
|
+
###
|
146
|
+
|
147
|
+
##
|
148
|
+
- name: select1
|
149
|
+
binding: rails
|
150
|
+
pdata: |
|
151
|
+
<select name="user[id]" title="select %[foo bar baz]">
|
152
|
+
<option value="1">aaa</option>
|
153
|
+
</select>
|
154
|
+
<select name="user[id]" title="collection_select @users">
|
155
|
+
<option value="1">aaa</option>
|
156
|
+
</select>
|
157
|
+
<select name="user[country]" title="country_select">
|
158
|
+
<option value="us">United States</option>
|
159
|
+
</select>
|
160
|
+
<select name="user[timezone]" title="time_zone_select">
|
161
|
+
<option value="1">timezone</option>
|
162
|
+
</select>
|
163
|
+
expected: |
|
164
|
+
<%= select 'user', 'id', %[foo bar baz] %>
|
165
|
+
<%= collection_select 'user', 'id', @users %>
|
166
|
+
<%= country_select 'user', 'country' %>
|
167
|
+
<%= time_zone_select 'user', 'timezone' %>
|
168
|
+
|
169
|
+
---
|
170
|
+
### UrlHelper
|
171
|
+
###
|
172
|
+
### - [ ] button_to
|
173
|
+
### - [ ] current_page?
|
174
|
+
### - [v] link_image_to
|
175
|
+
### - [v] link_to
|
176
|
+
### - [ ] link_to_if
|
177
|
+
### - [v] link_to_image
|
178
|
+
### - [ ] link_to_unless
|
179
|
+
### - [v] link_to_unless_current
|
180
|
+
### - [v] mail_to
|
181
|
+
### - [ ] url_for
|
182
|
+
###
|
183
|
+
|
184
|
+
##
|
185
|
+
- name: link_to1
|
186
|
+
binding: rails
|
187
|
+
pdata: |
|
188
|
+
<a href="#" title="link_to :action=>'show', :id=>@user.id">Show user</a>
|
189
|
+
<a href="#" title="link_to text, :action=>'list'">All</a>
|
190
|
+
expected: |
|
191
|
+
<%= link_to 'Show user', :action=>'show', :id=>@user.id %>
|
192
|
+
<%= link_to text, :action=>'list' %>
|
193
|
+
|
194
|
+
##
|
195
|
+
- name: link_image_to1
|
196
|
+
binding: rails
|
197
|
+
pdata: |
|
198
|
+
<img src="foo.jpg" title="link_image_to :action=>'new', :id=>10">
|
199
|
+
<img src="foo.jpg" title="link_to_image :action=>'new', :id=>10">
|
200
|
+
expected: |
|
201
|
+
<%= link_image_to 'foo.jpg', :action=>'new', :id=>10 %>
|
202
|
+
<%= link_to_image 'foo.jpg', :action=>'new', :id=>10 %>
|
203
|
+
|
204
|
+
##
|
205
|
+
- name: mail_to1
|
206
|
+
binding: rails
|
207
|
+
pdata: |
|
208
|
+
<a href="mailto:admin@example.com" title="mail_to">contact</a>
|
209
|
+
expected: |
|
210
|
+
<%= mail_to 'admin@example.com', 'contact' %>
|
211
|
+
|
212
|
+
---
|
213
|
+
###
|
214
|
+
### JavaScriptHelper
|
215
|
+
### - [ ] define_javascript_functions
|
216
|
+
### - [ ] draggable_element
|
217
|
+
### - [ ] drop_receiving_element
|
218
|
+
### - [ ] escape_javascript
|
219
|
+
### - [ ] evaluate_remote_response
|
220
|
+
### - [ ] form_remote_tag
|
221
|
+
### - [ ] javascript_tag
|
222
|
+
### - [ ] link_to_function
|
223
|
+
### - [v] link_to_remote
|
224
|
+
### - [ ] observe_field
|
225
|
+
### - [ ] observe_form
|
226
|
+
### - [ ] periodically_call_remote
|
227
|
+
### - [ ] remote_function
|
228
|
+
### - [ ] sortable_element
|
229
|
+
### - [v] submit_to_remote
|
230
|
+
### - [ ] update_element_function
|
231
|
+
### - [ ] visual_effect
|
232
|
+
###
|
233
|
+
|
234
|
+
##
|
235
|
+
- name: link_remote_to1
|
236
|
+
binding: rails
|
237
|
+
pdata: |
|
238
|
+
<a href="#" title="link_to_remote :action=>'show', :id=>@user.id">Show user</a>
|
239
|
+
<a href="#" title="link_to_remote @text, :action=>'list'">All</a>
|
240
|
+
expected: |
|
241
|
+
<%= link_to_remote 'Show user', :action=>'show', :id=>@user.id %>
|
242
|
+
<%= link_to_remote @text, :action=>'list' %>
|
243
|
+
|
244
|
+
##
|
245
|
+
- name: submit_to_remote1
|
246
|
+
binding: rails
|
247
|
+
pdata: |
|
248
|
+
<input type="submit" name="NAME" value="SUBMIT" title="submit_to_remote">
|
249
|
+
expected: |
|
250
|
+
<%= submit_to_remote 'NAME', 'SUBMIT' %>
|
251
|
+
|
252
|
+
|
253
|
+
---
|
254
|
+
###
|
255
|
+
### AssetTagHelper
|
256
|
+
### - [_] auto_discovery_link_tag
|
257
|
+
### - [_] image_path
|
258
|
+
### - [v] image_tag
|
259
|
+
### - [_] javascript_include_tag
|
260
|
+
### - [_] javascript_path
|
261
|
+
### - [_] register_javascript_include_default
|
262
|
+
### - [_] stylesheet_link_tag
|
263
|
+
### - [_] stylesheet_path
|
264
|
+
###
|
265
|
+
|
266
|
+
##
|
267
|
+
- name: image_tag1
|
268
|
+
binding: rails
|
269
|
+
pdata: |
|
270
|
+
<img src="/image/foo.gif" alt="text" title="image_tag">
|
271
|
+
expected: |
|
272
|
+
<%= image_tag '/image/foo.gif', :alt=>'text' %>
|
273
|
+
|
274
|
+
---
|
275
|
+
### DateHelper
|
276
|
+
### - [v] date_select
|
277
|
+
### - [v] datetime_select
|
278
|
+
### - [_] distance_of_time_in_words
|
279
|
+
### - [_] distance_of_time_in_words_to_now
|
280
|
+
### - [_] select_date
|
281
|
+
### - [_] select_datetime
|
282
|
+
### - [_] select_day
|
283
|
+
### - [_] select_hour
|
284
|
+
### - [_] select_minute
|
285
|
+
### - [_] select_month
|
286
|
+
### - [_] select_second
|
287
|
+
### - [_] select_time
|
288
|
+
### - [_] select_year
|
289
|
+
### - [_] time_ago_in_words
|
290
|
+
|
291
|
+
##
|
292
|
+
- name: date_select1
|
293
|
+
binding: rails
|
294
|
+
pdata: |
|
295
|
+
<select id="user_birth" title="date_select :start_year=>2000, :include_blank=>true">
|
296
|
+
</select>
|
297
|
+
<select id="user_time" title="datetime_select :start_year=>1900">
|
298
|
+
</select>
|
299
|
+
expected: |
|
300
|
+
<%= date_select 'user', 'birth', :start_year=>2000, :include_blank=>true %>
|
301
|
+
<%= datetime_select 'user', 'time', :start_year=>1900 %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
###
|
2
|
+
### $Rev: 117 $
|
3
|
+
### $Release: 3.0.0 $
|
4
|
+
### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
|
5
|
+
###
|
6
|
+
|
7
|
+
|
8
|
+
require "#{File.dirname(__FILE__)}/test.rb"
|
9
|
+
|
10
|
+
|
11
|
+
class RulesetTest < Test::Unit::TestCase
|
12
|
+
|
13
|
+
|
14
|
+
## define test methods
|
15
|
+
filename = __FILE__.sub(/\.rb$/, '.yaml')
|
16
|
+
load_yaml_testdata_with_each_lang(filename, :langs=>%w[eruby php jstl eperl])
|
17
|
+
|
18
|
+
|
19
|
+
def _test
|
20
|
+
regexp = /(\{\{\*|\*\}\})/
|
21
|
+
@pdata.gsub!(regexp, '') if @pdata
|
22
|
+
@plogic.gsub!(regexp, '') if @plogic
|
23
|
+
@expected.gsub!(regexp, '') if @expected
|
24
|
+
#
|
25
|
+
parser = Kwartz::PresentationLogicParser.get_class('css').new
|
26
|
+
ruleset_list = parser.parse(@plogic)
|
27
|
+
handler = Kwartz::Handler.get_class(@lang).new(ruleset_list)
|
28
|
+
converter = Kwartz::TextConverter.new(handler)
|
29
|
+
stmt_list = converter.convert(@pdata)
|
30
|
+
translator = Kwartz::Translator.get_class(@lang).new
|
31
|
+
actual = translator.translate(stmt_list)
|
32
|
+
assert_text_equal(@expected, actual)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,804 @@
|
|
1
|
+
---
|
2
|
+
- name: elem
|
3
|
+
title: elem, Elem, ELEM
|
4
|
+
desc: |
|
5
|
+
{{,elem:,}}, {{,Elem:,}}, and {{,ELEM:,}} properties replaces the element
|
6
|
+
with expression value.
|
7
|
+
|
8
|
+
{{,Elem:,}} always escape expression value while {{,ELEM:,}} never escape it.
|
9
|
+
{{,elem:,}} escapes when command-line option '-e' is specified or
|
10
|
+
configuration option 'PROPERTY_ESCAPE' is ture.
|
11
|
+
|
12
|
+
pdata: |
|
13
|
+
<p id="mark:name1">aaa</p>
|
14
|
+
<p id="mark:name2">bbb</p>
|
15
|
+
<p id="mark:name3">ccc</p>
|
16
|
+
|
17
|
+
plogic*:
|
18
|
+
eruby: |
|
19
|
+
#name1 {
|
20
|
+
{{*elem:*}} user[:name];
|
21
|
+
}
|
22
|
+
#name2 {
|
23
|
+
{{*Elem:*}} user[:name];
|
24
|
+
}
|
25
|
+
#name3 {
|
26
|
+
{{*ELEM:*}} user[:name];
|
27
|
+
}
|
28
|
+
php: |
|
29
|
+
#name1 {
|
30
|
+
{{*elem:*}} $user['name'];
|
31
|
+
}
|
32
|
+
#name2 {
|
33
|
+
{{*Elem:*}} $user['name'];
|
34
|
+
}
|
35
|
+
#name3 {
|
36
|
+
{{*ELEM:*}} $user['name'];
|
37
|
+
}
|
38
|
+
eperl: |
|
39
|
+
#name1 {
|
40
|
+
{{*elem:*}} $user{'name'};
|
41
|
+
}
|
42
|
+
#name2 {
|
43
|
+
{{*Elem:*}} $user{'name'};
|
44
|
+
}
|
45
|
+
#name3 {
|
46
|
+
{{*ELEM:*}} $user{'name'};
|
47
|
+
}
|
48
|
+
jstl: |
|
49
|
+
#name1 {
|
50
|
+
{{*elem:*}} user.name;
|
51
|
+
}
|
52
|
+
#name2 {
|
53
|
+
{{*Elem:*}} user.name;
|
54
|
+
}
|
55
|
+
#name3 {
|
56
|
+
{{*ELEM:*}} user.name;
|
57
|
+
}
|
58
|
+
|
59
|
+
expected*:
|
60
|
+
eruby: |
|
61
|
+
{{*<%= user[:name] %>*}}
|
62
|
+
{{*<%=h user[:name] %>*}}
|
63
|
+
{{*<%= user[:name] %>*}}
|
64
|
+
php: |
|
65
|
+
{{*<?php echo $user['name']; ?>*}}
|
66
|
+
{{*<?php echo htmlspecialchars($user['name']); ?>*}}
|
67
|
+
{{*<?php echo $user['name']; ?>*}}
|
68
|
+
eperl: |
|
69
|
+
{{*<?= $user{'name'} !>*}}
|
70
|
+
{{*<?= encode_entities($user{'name'}) !>*}}
|
71
|
+
{{*<?= $user{'name'} !>*}}
|
72
|
+
jstl: |
|
73
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
74
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
75
|
+
{{*${user.name}*}}
|
76
|
+
{{*${user.name}*}}
|
77
|
+
{{*<c:out value="${user.name}" escapeXml="false"/>*}}
|
78
|
+
|
79
|
+
##
|
80
|
+
- name: cont
|
81
|
+
title: cont, Cont, CONT
|
82
|
+
desc: |
|
83
|
+
{{,cont:,}}, {{,Cont:,}}, and {{,CONT:,}} properties replaces the element
|
84
|
+
with expression value.
|
85
|
+
|
86
|
+
{{,Cont:,}} always escape expression value while {{,CONT:,}} never escape it.
|
87
|
+
{{,cont:,}} escapes when command-line option '-e' is specified or
|
88
|
+
configuration option 'PROPERTY_ESCAPE' is ture.
|
89
|
+
|
90
|
+
pdata: |
|
91
|
+
<p id="mark:name1">aaa</p>
|
92
|
+
<p id="mark:name2">bbb</p>
|
93
|
+
<p id="mark:name3">ccc</p>
|
94
|
+
|
95
|
+
plogic*:
|
96
|
+
eruby: |
|
97
|
+
#name1 {
|
98
|
+
{{*cont:*}} user[:name];
|
99
|
+
}
|
100
|
+
#name2 {
|
101
|
+
{{*Cont:*}} user[:name];
|
102
|
+
}
|
103
|
+
#name3 {
|
104
|
+
{{*CONT:*}} user[:name];
|
105
|
+
}
|
106
|
+
php: |
|
107
|
+
#name1 {
|
108
|
+
{{*cont:*}} $user['name'];
|
109
|
+
}
|
110
|
+
#name2 {
|
111
|
+
{{*Cont:*}} $user['name'];
|
112
|
+
}
|
113
|
+
#name3 {
|
114
|
+
{{*CONT:*}} $user['name'];
|
115
|
+
}
|
116
|
+
eperl: |
|
117
|
+
#name1 {
|
118
|
+
{{*cont:*}} $user{'name'};
|
119
|
+
}
|
120
|
+
#name2 {
|
121
|
+
{{*Cont:*}} $user{'name'};
|
122
|
+
}
|
123
|
+
#name3 {
|
124
|
+
{{*CONT:*}} $user{'name'};
|
125
|
+
}
|
126
|
+
jstl: |
|
127
|
+
#name1 {
|
128
|
+
{{*cont:*}} user.name;
|
129
|
+
}
|
130
|
+
#name2 {
|
131
|
+
{{*Cont:*}} user.name;
|
132
|
+
}
|
133
|
+
#name3 {
|
134
|
+
{{*CONT:*}} user.name;
|
135
|
+
}
|
136
|
+
|
137
|
+
expected*:
|
138
|
+
eruby: |
|
139
|
+
<p>{{*<%= user[:name] %>*}}</p>
|
140
|
+
<p>{{*<%=h user[:name] %>*}}</p>
|
141
|
+
<p>{{*<%= user[:name] %>*}}</p>
|
142
|
+
php: |
|
143
|
+
<p>{{*<?php echo $user['name']; ?>*}}</p>
|
144
|
+
<p>{{*<?php echo htmlspecialchars($user['name']); ?>*}}</p>
|
145
|
+
<p>{{*<?php echo $user['name']; ?>*}}</p>
|
146
|
+
eperl: |
|
147
|
+
<p>{{*<?= $user{'name'} !>*}}</p>
|
148
|
+
<p>{{*<?= encode_entities($user{'name'}) !>*}}</p>
|
149
|
+
<p>{{*<?= $user{'name'} !>*}}</p>
|
150
|
+
jstl: |
|
151
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
152
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
153
|
+
<p>{{*${user.name}*}}</p>
|
154
|
+
<p>{{*${user.name}*}}</p>
|
155
|
+
<p>{{*<c:out value="${user.name}" escapeXml="false"/>*}}</p>
|
156
|
+
|
157
|
+
##
|
158
|
+
- name: value
|
159
|
+
title: value, Value, VALUE
|
160
|
+
desc: |
|
161
|
+
{{,value:,}}, {{,Value:,}}, and {{,VALUE:,}} properties replaces the element
|
162
|
+
with expression value.
|
163
|
+
These are the same as {{,cont:,}}, {{,Cont:,}}, and {{,CONT:,}} properties
|
164
|
+
respectively.
|
165
|
+
|
166
|
+
pdata: |
|
167
|
+
<p id="mark:name1">aaa</p>
|
168
|
+
<p id="mark:name2">bbb</p>
|
169
|
+
<p id="mark:name3">ccc</p>
|
170
|
+
|
171
|
+
plogic*:
|
172
|
+
eruby: |
|
173
|
+
#name1 {
|
174
|
+
{{*value:*}} user[:name];
|
175
|
+
}
|
176
|
+
#name2 {
|
177
|
+
{{*Value:*}} user[:name];
|
178
|
+
}
|
179
|
+
#name3 {
|
180
|
+
{{*VALUE:*}} user[:name];
|
181
|
+
}
|
182
|
+
php: |
|
183
|
+
#name1 {
|
184
|
+
{{*value:*}} $user['name'];
|
185
|
+
}
|
186
|
+
#name2 {
|
187
|
+
{{*Value:*}} $user['name'];
|
188
|
+
}
|
189
|
+
#name3 {
|
190
|
+
{{*VALUE:*}} $user['name'];
|
191
|
+
}
|
192
|
+
eperl: |
|
193
|
+
#name1 {
|
194
|
+
{{*value:*}} $user{'name'};
|
195
|
+
}
|
196
|
+
#name2 {
|
197
|
+
{{*Value:*}} $user{'name'};
|
198
|
+
}
|
199
|
+
#name3 {
|
200
|
+
{{*VALUE:*}} $user{'name'};
|
201
|
+
}
|
202
|
+
jstl: |
|
203
|
+
#name1 {
|
204
|
+
{{*value:*}} user.name;
|
205
|
+
}
|
206
|
+
#name2 {
|
207
|
+
{{*Value:*}} user.name;
|
208
|
+
}
|
209
|
+
#name3 {
|
210
|
+
{{*VALUE:*}} user.name;
|
211
|
+
}
|
212
|
+
|
213
|
+
expected*:
|
214
|
+
eruby: |
|
215
|
+
<p>{{*<%= user[:name] %>*}}</p>
|
216
|
+
<p>{{*<%=h user[:name] %>*}}</p>
|
217
|
+
<p>{{*<%= user[:name] %>*}}</p>
|
218
|
+
php: |
|
219
|
+
<p>{{*<?php echo $user['name']; ?>*}}</p>
|
220
|
+
<p>{{*<?php echo htmlspecialchars($user['name']); ?>*}}</p>
|
221
|
+
<p>{{*<?php echo $user['name']; ?>*}}</p>
|
222
|
+
eperl: |
|
223
|
+
<p>{{*<?= $user{'name'} !>*}}</p>
|
224
|
+
<p>{{*<?= encode_entities($user{'name'}) !>*}}</p>
|
225
|
+
<p>{{*<?= $user{'name'} !>*}}</p>
|
226
|
+
jstl: |
|
227
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
228
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
229
|
+
<p>{{*${user.name}*}}</p>
|
230
|
+
<p>{{*${user.name}*}}</p>
|
231
|
+
<p>{{*<c:out value="${user.name}" escapeXml="false"/>*}}</p>
|
232
|
+
|
233
|
+
##
|
234
|
+
- name: stag
|
235
|
+
title: stag, Stag, STAG
|
236
|
+
desc: |
|
237
|
+
{{,stage:,}}, {{,Stag:,}}, and {{,STAG:,}} properties replaces the start-tag
|
238
|
+
with expression value.
|
239
|
+
|
240
|
+
{{,Stag:,}} always escape expression value while {{,STAG:,}} never escape it.
|
241
|
+
{{,stag:,}} escapes when command-line option '-e' is specified or
|
242
|
+
configuration option 'PROPERTY_ESCAPE' is ture.
|
243
|
+
|
244
|
+
pdata: |
|
245
|
+
<a href="#" id="mark:link1"><img src="button1.png"></a>
|
246
|
+
<a href="#" id="mark:link2"><img src="button2.png"></a>
|
247
|
+
<a href="#" id="mark:link3"><img src="button3.png"></a>
|
248
|
+
|
249
|
+
plogic*:
|
250
|
+
eruby: |
|
251
|
+
#link1 {
|
252
|
+
{{*stag:*}} start_link_to :action=>'list';
|
253
|
+
}
|
254
|
+
#link2 {
|
255
|
+
{{*Stag:*}} start_link_to :action=>'list';
|
256
|
+
}
|
257
|
+
#link3 {
|
258
|
+
{{*STAG:*}} start_link_to :action=>'list';
|
259
|
+
}
|
260
|
+
php: |
|
261
|
+
#link1 {
|
262
|
+
{{*stag:*}} start_link_to('list');
|
263
|
+
}
|
264
|
+
#link2 {
|
265
|
+
{{*Stag:*}} start_link_to('list');
|
266
|
+
}
|
267
|
+
#link3 {
|
268
|
+
{{*STAG:*}} start_link_to('list');
|
269
|
+
}
|
270
|
+
eperl: |
|
271
|
+
#link1 {
|
272
|
+
{{*stag:*}} start_link_to('list');
|
273
|
+
}
|
274
|
+
#link2 {
|
275
|
+
{{*Stag:*}} start_link_to('list');
|
276
|
+
}
|
277
|
+
#link3 {
|
278
|
+
{{*STAG:*}} start_link_to('list');
|
279
|
+
}
|
280
|
+
jstl: |
|
281
|
+
#link1 {
|
282
|
+
{{*stag:*}} fn:start_link_to('list');
|
283
|
+
}
|
284
|
+
#link2 {
|
285
|
+
{{*Stag:*}} fn:start_link_to('list');
|
286
|
+
}
|
287
|
+
#link3 {
|
288
|
+
{{*STAG:*}} fn:start_link_to('list');
|
289
|
+
}
|
290
|
+
|
291
|
+
expected*:
|
292
|
+
eruby: |
|
293
|
+
{{*<%= start_link_to :action=>'list' %>*}}<img src="button1.png"></a>
|
294
|
+
{{*<%=h start_link_to :action=>'list' %>*}}<img src="button2.png"></a>
|
295
|
+
{{*<%= start_link_to :action=>'list' %>*}}<img src="button3.png"></a>
|
296
|
+
php: |
|
297
|
+
{{*<?php echo start_link_to('list'); ?>*}}<img src="button1.png"></a>
|
298
|
+
{{*<?php echo htmlspecialchars(start_link_to('list')); ?>*}}<img src="button2.png"></a>
|
299
|
+
{{*<?php echo start_link_to('list'); ?>*}}<img src="button3.png"></a>
|
300
|
+
eperl: |
|
301
|
+
{{*<?= start_link_to('list') !>*}}<img src="button1.png"></a>
|
302
|
+
{{*<?= encode_entities(start_link_to('list')) !>*}}<img src="button2.png"></a>
|
303
|
+
{{*<?= start_link_to('list') !>*}}<img src="button3.png"></a>
|
304
|
+
jstl: |
|
305
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
306
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
307
|
+
{{*${fn:start_link_to('list')}*}}<img src="button1.png"></a>
|
308
|
+
{{*${fn:start_link_to('list')}*}}<img src="button2.png"></a>
|
309
|
+
{{*<c:out value="${fn:start_link_to('list')}" escapeXml="false"/>*}}<img src="button3.png"></a>
|
310
|
+
|
311
|
+
##
|
312
|
+
- name: etag
|
313
|
+
title: etag, Etag, ETAG
|
314
|
+
desc: |
|
315
|
+
{{,stage:,}}, {{,Etag:,}}, and {{,ETAG:,}} properties replaces the end-tag
|
316
|
+
with expression value.
|
317
|
+
|
318
|
+
{{,Etag:,}} always escape expression value while {{,ETAG:,}} never escape it.
|
319
|
+
{{,etag:,}} escapes when command-line option '-e' is specified or
|
320
|
+
configuration option 'PROPERTY_ESCAPE' is ture.
|
321
|
+
|
322
|
+
pdata: |
|
323
|
+
<li id="mark:item1">foo</li>
|
324
|
+
<li id="mark:item2">bar</li>
|
325
|
+
<li id="mark:item3">baz</li>
|
326
|
+
|
327
|
+
plogic*:
|
328
|
+
eruby: |
|
329
|
+
#item1 {
|
330
|
+
{{*etag:*}} is_xml ? '</li>' : '';
|
331
|
+
}
|
332
|
+
#item2 {
|
333
|
+
{{*Etag:*}} is_xml ? '</li>' : '';
|
334
|
+
}
|
335
|
+
#item3 {
|
336
|
+
{{*ETAG:*}} is_xml ? '</li>' : '';
|
337
|
+
}
|
338
|
+
php: |
|
339
|
+
#item1 {
|
340
|
+
{{*etag:*}} $is_xml ? '</li>' : '';
|
341
|
+
}
|
342
|
+
#item2 {
|
343
|
+
{{*Etag:*}} $is_xml ? '</li>' : '';
|
344
|
+
}
|
345
|
+
#item3 {
|
346
|
+
{{*ETAG:*}} $is_xml ? '</li>' : '';
|
347
|
+
}
|
348
|
+
eperl: |
|
349
|
+
#item1 {
|
350
|
+
{{*etag:*}} $is_xml ? '</li>' : '';
|
351
|
+
}
|
352
|
+
#item2 {
|
353
|
+
{{*Etag:*}} $is_xml ? '</li>' : '';
|
354
|
+
}
|
355
|
+
#item3 {
|
356
|
+
{{*ETAG:*}} $is_xml ? '</li>' : '';
|
357
|
+
}
|
358
|
+
jstl: |
|
359
|
+
#item1 {
|
360
|
+
{{*etag:*}} is_xml ? '</li>' : '';
|
361
|
+
}
|
362
|
+
#item2 {
|
363
|
+
{{*Etag:*}} is_xml ? '</li>' : '';
|
364
|
+
}
|
365
|
+
#item3 {
|
366
|
+
{{*ETAG:*}} is_xml ? '</li>' : '';
|
367
|
+
}
|
368
|
+
|
369
|
+
expected*:
|
370
|
+
eruby: |
|
371
|
+
<li>foo{{*<%= is_xml ? '</li>' : '' %>*}}
|
372
|
+
<li>bar{{*<%=h is_xml ? '</li>' : '' %>*}}
|
373
|
+
<li>baz{{*<%= is_xml ? '</li>' : '' %>*}}
|
374
|
+
php: |
|
375
|
+
<li>foo{{*<?php echo $is_xml ? '</li>' : ''; ?>*}}
|
376
|
+
<li>bar{{*<?php echo htmlspecialchars($is_xml ? '</li>' : ''); ?>*}}
|
377
|
+
<li>baz{{*<?php echo $is_xml ? '</li>' : ''; ?>*}}
|
378
|
+
eperl: |
|
379
|
+
<li>foo{{*<?= $is_xml ? '</li>' : '' !>*}}
|
380
|
+
<li>bar{{*<?= encode_entities($is_xml ? '</li>' : '') !>*}}
|
381
|
+
<li>baz{{*<?= $is_xml ? '</li>' : '' !>*}}
|
382
|
+
jstl: |
|
383
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
384
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
385
|
+
<li>foo{{*${is_xml ? '</li>' : ''}*}}
|
386
|
+
<li>bar{{*${is_xml ? '</li>' : ''}*}}
|
387
|
+
<li>baz{{*<c:out value="${is_xml ? '</li>' : ''}" escapeXml="false"/>*}}
|
388
|
+
|
389
|
+
##
|
390
|
+
- name: attrs
|
391
|
+
title: attrs, Attrs, ATTRS
|
392
|
+
desc: |
|
393
|
+
{{,attrs:,}}, {{,Attrs:,}}, {{,ATTRS:,}}, property replaces or adds attributes.
|
394
|
+
|
395
|
+
{{,Attrs:,}} always escape expression value while {{,ATTRS:,}} never escape it.
|
396
|
+
{{,attrs:,}} escapes when command-line option '-e' is specified or
|
397
|
+
configuration option 'PROPERTY_ESCAPE' is ture.
|
398
|
+
|
399
|
+
pdata: |
|
400
|
+
<p id="mark:item" class="para">
|
401
|
+
AAA
|
402
|
+
</p>
|
403
|
+
|
404
|
+
plogic*:
|
405
|
+
eruby: |
|
406
|
+
#item {
|
407
|
+
{{*attrs:*}} 'class' klass,
|
408
|
+
'style' style;
|
409
|
+
}
|
410
|
+
php: |
|
411
|
+
#item {
|
412
|
+
{{*attrs:*}} 'class' $class,
|
413
|
+
'style' $style;
|
414
|
+
}
|
415
|
+
jstl: |
|
416
|
+
#item {
|
417
|
+
{{*attrs:*}} 'class' klass,
|
418
|
+
'style' style;
|
419
|
+
}
|
420
|
+
eperl: |
|
421
|
+
#item {
|
422
|
+
{{*attrs:*}} 'class' $class,
|
423
|
+
'style' $style;
|
424
|
+
}
|
425
|
+
|
426
|
+
expected*:
|
427
|
+
eruby: |
|
428
|
+
<p {{*class="<%= klass %>"*}} {{*style="<%= style %>"*}}>
|
429
|
+
AAA
|
430
|
+
</p>
|
431
|
+
php: |
|
432
|
+
<p {{*class="<?php echo $class; ?>"*}} {{*style="<?php echo $style; ?>"*}}>
|
433
|
+
AAA
|
434
|
+
</p>
|
435
|
+
jstl: |
|
436
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
437
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
438
|
+
<p {{*class="${klass}"*}} {{*style="${style}"*}}>
|
439
|
+
AAA
|
440
|
+
</p>
|
441
|
+
eperl: |
|
442
|
+
<p {{*class="<?= $class !>"*}} {{*style="<?= $style !>"*}}>
|
443
|
+
AAA
|
444
|
+
</p>
|
445
|
+
|
446
|
+
postscript: |
|
447
|
+
Notice that the follwing will be parse error
|
448
|
+
because Kwartz parses {{,attrs:,}} property with pattern matching.
|
449
|
+
|
450
|
+
.--------------------
|
451
|
+
#foo {
|
452
|
+
attrs: 'class' klass, 'style' style;
|
453
|
+
}
|
454
|
+
.--------------------
|
455
|
+
|
456
|
+
##
|
457
|
+
- name: append
|
458
|
+
title: append, Append, APPEND
|
459
|
+
desc: |
|
460
|
+
{{,append:,}}, {{,Append:,}}, {{,APPEND:,}} directive appends
|
461
|
+
expressions to the start tag.
|
462
|
+
|
463
|
+
{{,Append:,}} always escape expression value while {{,APPEND:,}} never escape it.
|
464
|
+
{{,append:,}} escapes when command-line option '-e' is specified or
|
465
|
+
configuration option 'PROPERTY_ESCAPE' is ture.
|
466
|
+
|
467
|
+
pdata: |
|
468
|
+
<input type="checkboxk" id="mark:remember" value="y">Remeber me
|
469
|
+
|
470
|
+
plogic*:
|
471
|
+
eruby: |
|
472
|
+
#remember {
|
473
|
+
{{*append:*}} flag ? ' checked' : '';
|
474
|
+
}
|
475
|
+
php: |
|
476
|
+
#remember {
|
477
|
+
{{*append:*}} $flag ? ' checked' : '';
|
478
|
+
}
|
479
|
+
jstl: |
|
480
|
+
#remember {
|
481
|
+
{{*append:*}} flag ? ' checked' : '';
|
482
|
+
}
|
483
|
+
eperl: |
|
484
|
+
#remember {
|
485
|
+
{{*append:*}} $flag ? ' checked' : '';
|
486
|
+
}
|
487
|
+
|
488
|
+
expected*:
|
489
|
+
eruby: |
|
490
|
+
<input type="checkboxk" value="y"{{*<%= flag ? ' checked' : '' %>*}}>Remeber me
|
491
|
+
php: |
|
492
|
+
<input type="checkboxk" value="y"{{*<?php echo $flag ? ' checked' : ''; ?>*}}>Remeber me
|
493
|
+
jstl: |
|
494
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
495
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
496
|
+
<input type="checkboxk" value="y"{{*${flag ? ' checked' : ''}*}}>Remeber me
|
497
|
+
eperl: |
|
498
|
+
<input type="checkboxk" value="y"{{*<?= $flag ? ' checked' : '' !>*}}>Remeber me
|
499
|
+
|
500
|
+
|
501
|
+
postscript: |
|
502
|
+
The following is an example to append several expressions.
|
503
|
+
|
504
|
+
.--------------------
|
505
|
+
#remember {
|
506
|
+
append: expr1,
|
507
|
+
expr2,
|
508
|
+
expr3;
|
509
|
+
}
|
510
|
+
.--------------------
|
511
|
+
|
512
|
+
Notice that the following will be parse error.
|
513
|
+
|
514
|
+
.--------------------
|
515
|
+
#remember {
|
516
|
+
append: expr1, expr2, expr3;
|
517
|
+
}
|
518
|
+
.--------------------
|
519
|
+
|
520
|
+
##
|
521
|
+
- name: remove
|
522
|
+
title: remove
|
523
|
+
common: yes
|
524
|
+
desc: |
|
525
|
+
{{,remove:,}} property removes attributes.
|
526
|
+
|
527
|
+
pdata: |
|
528
|
+
<p id="foo" class="paragraph" style="color: red">
|
529
|
+
AAA
|
530
|
+
</p>
|
531
|
+
|
532
|
+
plogic*:
|
533
|
+
eruby: &remove_pdata |
|
534
|
+
#foo {
|
535
|
+
{{*remove:*}} 'id', 'style';
|
536
|
+
}
|
537
|
+
php: *remove_pdata
|
538
|
+
jstl: *remove_pdata
|
539
|
+
eperl: *remove_pdata
|
540
|
+
|
541
|
+
expected*:
|
542
|
+
eruby: &remove_expected |
|
543
|
+
<p class="paragraph">
|
544
|
+
AAA
|
545
|
+
</p>
|
546
|
+
php: *remove_expected
|
547
|
+
jstl: |
|
548
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
549
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
550
|
+
<p class="paragraph">
|
551
|
+
AAA
|
552
|
+
</p>
|
553
|
+
eperl: *remove_expected
|
554
|
+
|
555
|
+
|
556
|
+
##
|
557
|
+
- name: logic
|
558
|
+
title: logic
|
559
|
+
desc: |
|
560
|
+
{{,logic:,}} property represents the presentation logic body of the element.
|
561
|
+
In the {{,logic:,}} property, the folllowings are available.
|
562
|
+
.[ {{,_elem,}} ]
|
563
|
+
represents the element
|
564
|
+
.[ {{,_stag,}} ]
|
565
|
+
represents start-tag of the element
|
566
|
+
.[ {{,_cont,}} ]
|
567
|
+
represents content of the element
|
568
|
+
.[ {{,_stag,}} ]
|
569
|
+
represents end-tag of the element
|
570
|
+
.[ {{,_element({{/name/}}),}} ]
|
571
|
+
represents the other element marked as {{/name/}}.
|
572
|
+
.[ {{,_content({{/name/}}),}} ]
|
573
|
+
represents the content of other element marked as {{/name/}}.
|
574
|
+
|
575
|
+
In the {{,logic:,}} property, it is able to write statements in target language
|
576
|
+
(Ruby, PHP, Java, Perl, and so on).
|
577
|
+
|
578
|
+
pdata: |
|
579
|
+
<ul>
|
580
|
+
<li id="mark:items">AAA</li>
|
581
|
+
</ul>
|
582
|
+
|
583
|
+
plogic*:
|
584
|
+
eruby: |
|
585
|
+
#items {
|
586
|
+
value: item;
|
587
|
+
{{*logic:*}} {
|
588
|
+
@list.each do |item|
|
589
|
+
{{*_stag*}}
|
590
|
+
{{*_cont*}}
|
591
|
+
{{*_etag*}}
|
592
|
+
end
|
593
|
+
}
|
594
|
+
}
|
595
|
+
php: |
|
596
|
+
#items {
|
597
|
+
value: $item;
|
598
|
+
{{*logic:*}} {
|
599
|
+
foreach ($list as $item) {
|
600
|
+
{{*_stag();*}}
|
601
|
+
{{*_cont();*}}
|
602
|
+
{{*_etag();*}}
|
603
|
+
}
|
604
|
+
}
|
605
|
+
}
|
606
|
+
jstl: |
|
607
|
+
#items {
|
608
|
+
value: item;
|
609
|
+
{{*logic:*}} {
|
610
|
+
<c:forEach var="item" items="${list}">
|
611
|
+
{{*_stag();*}}
|
612
|
+
{{*_cont();*}}
|
613
|
+
{{*_etag();*}}
|
614
|
+
</c:forEach>
|
615
|
+
}
|
616
|
+
}
|
617
|
+
eperl: |
|
618
|
+
#items {
|
619
|
+
value: $item;
|
620
|
+
{{*logic:*}} {
|
621
|
+
foreach ($item in @list) {
|
622
|
+
{{*_stag();*}}
|
623
|
+
{{*_cont();*}}
|
624
|
+
{{*_etag();*}}
|
625
|
+
}
|
626
|
+
}
|
627
|
+
}
|
628
|
+
|
629
|
+
expected*:
|
630
|
+
eruby: |
|
631
|
+
<ul>
|
632
|
+
{{*<% @list.each do |item| %>*}}
|
633
|
+
<li><%= item %></li>
|
634
|
+
{{*<% end %>*}}
|
635
|
+
</ul>
|
636
|
+
php: |
|
637
|
+
<ul>
|
638
|
+
{{*<?php foreach ($list as $item) { ?>*}}
|
639
|
+
<li><?php echo $item; ?></li>
|
640
|
+
{{*<?php } ?>*}}
|
641
|
+
</ul>
|
642
|
+
jstl: |
|
643
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
644
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
645
|
+
<ul>
|
646
|
+
{{*<c:forEach var="item" items="${list}">*}}
|
647
|
+
<li>${item}</li>
|
648
|
+
{{*</c:forEach>*}}
|
649
|
+
</ul>
|
650
|
+
eperl: |
|
651
|
+
<ul>
|
652
|
+
{{*<? foreach ($item in @list) { !>*}}
|
653
|
+
<li><?= $item !></li>
|
654
|
+
{{*<? } !>*}}
|
655
|
+
</ul>
|
656
|
+
|
657
|
+
##
|
658
|
+
- name: begin
|
659
|
+
title: begin, end
|
660
|
+
desc: |
|
661
|
+
{{,begin:,}} and {{,end:,}} property represents the prework and postwork
|
662
|
+
of document respectively.
|
663
|
+
These properties takes target code block and are available only with
|
664
|
+
'#DOCUMENT' selector.
|
665
|
+
|
666
|
+
pdata: |
|
667
|
+
<p>Hello <span id="mark:username">world</span>!</p>
|
668
|
+
<ul>
|
669
|
+
<li id="mark:menu">menu item</li>
|
670
|
+
</ul>
|
671
|
+
|
672
|
+
plogic*:
|
673
|
+
eruby: |
|
674
|
+
#DOCUMENT {
|
675
|
+
{{*begin:*}} {
|
676
|
+
username = @context[:username]
|
677
|
+
menulist = @context[:menulist]
|
678
|
+
}
|
679
|
+
{{*end:*}} {
|
680
|
+
print "<!-- document end -->\n"
|
681
|
+
|
682
|
+
}
|
683
|
+
}
|
684
|
+
#username {
|
685
|
+
value: username;
|
686
|
+
}
|
687
|
+
#menu {
|
688
|
+
value: menu;
|
689
|
+
logic: {
|
690
|
+
for menu in menulist
|
691
|
+
_elem
|
692
|
+
end
|
693
|
+
}
|
694
|
+
}
|
695
|
+
php: |
|
696
|
+
#DOCUMENT {
|
697
|
+
{{*begin:*}} {
|
698
|
+
$username = $context['username'];
|
699
|
+
$menulist = $context['menulist'];
|
700
|
+
}
|
701
|
+
{{*end:*}} {
|
702
|
+
print("<!-- document end -->\n");
|
703
|
+
|
704
|
+
}
|
705
|
+
}
|
706
|
+
#username {
|
707
|
+
value: $username;
|
708
|
+
}
|
709
|
+
#menu {
|
710
|
+
value: $menu;
|
711
|
+
logic: {
|
712
|
+
foreach ($menulist as $menu) {
|
713
|
+
_elem();
|
714
|
+
}
|
715
|
+
}
|
716
|
+
}
|
717
|
+
jstl: |
|
718
|
+
#DOCUMENT {
|
719
|
+
{{*begin:*}} {
|
720
|
+
<c:set var="username" value="${context.username}"/>
|
721
|
+
<c:set var="menulist" value="${context.menulist}"/>
|
722
|
+
}
|
723
|
+
{{*end:*}} {
|
724
|
+
<c:out value="<!-- document end -->\n"/>
|
725
|
+
}
|
726
|
+
}
|
727
|
+
#username {
|
728
|
+
value: username;
|
729
|
+
}
|
730
|
+
#menu {
|
731
|
+
value: menu;
|
732
|
+
logic: {
|
733
|
+
<c:forEach var="menu" items="${menulist}">
|
734
|
+
_elem();
|
735
|
+
</c:forEach>
|
736
|
+
}
|
737
|
+
}
|
738
|
+
eperl: |
|
739
|
+
#DOCUMENT {
|
740
|
+
{{*begin:*}} {
|
741
|
+
$username = $context{'username'};
|
742
|
+
@menulist = $context{'menulist'};
|
743
|
+
}
|
744
|
+
{{*end:*}} {
|
745
|
+
print("<!-- document end -->\n");
|
746
|
+
|
747
|
+
}
|
748
|
+
}
|
749
|
+
#username {
|
750
|
+
value: $username;
|
751
|
+
}
|
752
|
+
#menu {
|
753
|
+
value: $menu;
|
754
|
+
logic: {
|
755
|
+
foreach ($menu in @menulist) {
|
756
|
+
_elem();
|
757
|
+
}
|
758
|
+
}
|
759
|
+
}
|
760
|
+
|
761
|
+
expected*:
|
762
|
+
eruby: |-
|
763
|
+
{{*<% username = @context[:username] %>*}}
|
764
|
+
{{*<% menulist = @context[:menulist] %>*}}
|
765
|
+
<p>Hello <span><%= username %></span>!</p>
|
766
|
+
<ul>
|
767
|
+
<% for menu in menulist %>
|
768
|
+
<li><%= menu %></li>
|
769
|
+
<% end %>
|
770
|
+
</ul>
|
771
|
+
{{*<%= "<!-- document end -->\n" %>*}}
|
772
|
+
|
773
|
+
php: |-
|
774
|
+
{{*<?php $username = $context['username']; ?>*}}
|
775
|
+
{{*<?php $menulist = $context['menulist']; ?>*}}
|
776
|
+
<p>Hello <span><?php echo $username; ?></span>!</p>
|
777
|
+
<ul>
|
778
|
+
<?php foreach ($menulist as $menu) { ?>
|
779
|
+
<li><?php echo $menu; ?></li>
|
780
|
+
<?php } ?>
|
781
|
+
</ul>
|
782
|
+
{{*<?php echo "<!-- document end -->\n"; ?>*}}
|
783
|
+
jstl: |
|
784
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
785
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
786
|
+
{{*<c:set var="username" value="${context.username}"/>*}}
|
787
|
+
{{*<c:set var="menulist" value="${context.menulist}"/>*}}
|
788
|
+
<p>Hello <span>${username}</span>!</p>
|
789
|
+
<ul>
|
790
|
+
<c:forEach var="menu" items="${menulist}">
|
791
|
+
<li>${menu}</li>
|
792
|
+
</c:forEach>
|
793
|
+
</ul>
|
794
|
+
{{*<c:out value="<!-- document end -->\n"/>*}}
|
795
|
+
eperl: |-
|
796
|
+
{{*<? $username = $context{'username'}; !>*}}
|
797
|
+
{{*<? @menulist = $context{'menulist'}; !>*}}
|
798
|
+
<p>Hello <span><?= $username !></span>!</p>
|
799
|
+
<ul>
|
800
|
+
<? foreach ($menu in @menulist) { !>
|
801
|
+
<li><?= $menu !></li>
|
802
|
+
<? } !>
|
803
|
+
</ul>
|
804
|
+
{{*<?= "<!-- document end -->\n" !>*}}
|