kwartz 3.1.2 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +444 -0
- data/README.txt +4 -1
- data/bin/kwartz +2 -2
- data/doc-api/classes/Kwartz.html +16 -7
- 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 +71 -61
- data/doc-api/classes/Kwartz/BaseError.html +12 -12
- data/doc-api/classes/Kwartz/BaseTranslator.html +104 -74
- 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 +50 -50
- data/doc-api/classes/Kwartz/Config.html +5 -0
- data/doc-api/classes/Kwartz/ConvertError.html +12 -12
- data/doc-api/classes/Kwartz/Converter.html +31 -33
- data/doc-api/classes/Kwartz/CssStyleParser.html +207 -168
- data/doc-api/classes/Kwartz/Defun.html +32 -31
- data/doc-api/classes/Kwartz/{HandlerArgument.html → Directive.html} +27 -53
- data/doc-api/classes/Kwartz/ElementInfo.html +68 -53
- data/doc-api/classes/Kwartz/EperlExpressionParser.html +185 -0
- data/doc-api/classes/Kwartz/EperlHandler.html +65 -58
- data/doc-api/classes/Kwartz/EperlTranslator.html +14 -7
- data/doc-api/classes/Kwartz/ErubisTranslator.html +14 -7
- data/doc-api/classes/Kwartz/ErubyTranslator.html +14 -7
- data/doc-api/classes/Kwartz/ExpandStatement.html +20 -20
- data/doc-api/classes/Kwartz/Expander.html +358 -0
- data/doc-api/classes/Kwartz/Handler.html +287 -157
- data/doc-api/classes/Kwartz/{StatementHelper.html → HandlerHelper.html} +307 -112
- data/doc-api/classes/Kwartz/Helper/ActionViewHelper.html +23 -23
- data/doc-api/classes/Kwartz/Helper/RailsTemplate.html +96 -96
- data/doc-api/classes/Kwartz/JstlExpressionParser.html +181 -0
- data/doc-api/classes/Kwartz/JstlHandler.html +134 -126
- data/doc-api/classes/Kwartz/JstlTranslator.html +21 -14
- data/doc-api/classes/Kwartz/KwartzError.html +6 -6
- data/doc-api/classes/Kwartz/Main.html +4 -4
- data/doc-api/classes/Kwartz/NativeExpression.html +19 -19
- data/doc-api/classes/Kwartz/NativeStatement.html +24 -24
- data/doc-api/classes/Kwartz/Node.html +7 -7
- data/doc-api/classes/Kwartz/PIErubisTranslator.html +21 -14
- data/doc-api/classes/Kwartz/ParseError.html +6 -6
- data/doc-api/classes/Kwartz/PerlExpressionParser.html +185 -0
- data/doc-api/classes/Kwartz/PerlHandler.html +353 -0
- data/doc-api/classes/Kwartz/PerlTranslator.html +226 -0
- data/doc-api/classes/Kwartz/PhpExpressionParser.html +185 -0
- data/doc-api/classes/Kwartz/PhpHandler.html +63 -56
- data/doc-api/classes/Kwartz/PhpTranslator.html +21 -14
- data/doc-api/classes/Kwartz/PresentationLogicParser.html +126 -123
- data/doc-api/classes/Kwartz/PrintStatement.html +18 -18
- data/doc-api/classes/Kwartz/RailsHandler.html +84 -85
- data/doc-api/classes/Kwartz/RailsTranslator.html +13 -6
- data/doc-api/classes/Kwartz/RubyExpressionParser.html +180 -0
- data/doc-api/classes/Kwartz/RubyHandler.html +73 -69
- data/doc-api/classes/Kwartz/RubyStyleParser.html +86 -86
- data/doc-api/classes/Kwartz/RubyTranslator.html +28 -21
- data/doc-api/classes/Kwartz/Ruleset.html +622 -1
- data/doc-api/classes/Kwartz/StrutsTranslator.html +14 -14
- data/doc-api/classes/Kwartz/TagInfo.html +52 -27
- data/doc-api/classes/Kwartz/TextConverter.html +75 -37
- data/doc-api/classes/Kwartz/Translator.html +54 -53
- data/doc-api/classes/Kwartz/Util.html +25 -25
- data/doc-api/created.rid +1 -1
- data/doc-api/files/__/README_txt.html +7 -2
- data/doc-api/files/kwartz/assert_rb.html +2 -2
- data/doc-api/files/kwartz/binding/eperl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/erubis_rb.html +2 -2
- data/doc-api/files/kwartz/binding/eruby_rb.html +2 -2
- data/doc-api/files/kwartz/binding/jstl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/perl_rb.html +115 -0
- data/doc-api/files/kwartz/binding/php_rb.html +2 -2
- data/doc-api/files/kwartz/binding/pierubis_rb.html +2 -2
- data/doc-api/files/kwartz/binding/rails_rb.html +2 -2
- data/doc-api/files/kwartz/binding/ruby_rb.html +2 -2
- data/doc-api/files/kwartz/binding/struts_rb.html +2 -2
- data/doc-api/files/kwartz/config_rb.html +2 -2
- data/doc-api/files/kwartz/converter_rb.html +2 -2
- data/doc-api/files/kwartz/defun_rb.html +2 -2
- data/doc-api/files/kwartz/error_rb.html +2 -2
- data/doc-api/files/kwartz/helper/rails_rb.html +2 -2
- data/doc-api/files/kwartz/main_rb.html +3 -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 +2 -2
- data/doc-api/files/kwartz/util/testcase-helper_rb.html +2 -2
- data/doc-api/files/kwartz/util_rb.html +2 -2
- data/doc-api/files/kwartz_rb.html +2 -2
- data/doc-api/fr_class_index.html +10 -5
- data/doc-api/fr_file_index.html +1 -0
- data/doc-api/fr_method_index.html +268 -239
- data/doc/docstyle.css +9 -3
- data/doc/img/fig05.png +0 -0
- data/doc/introduction-to-kwartz.html +3040 -0
- data/doc/pattern-catalog.html +5 -3
- data/doc/reference.html +680 -26
- data/doc/users-guide.html +222 -67
- data/kwartz.gemspec +4 -4
- data/lib/kwartz.rb +3 -3
- data/lib/kwartz/assert.rb +2 -2
- data/lib/kwartz/binding/eperl.rb +71 -31
- data/lib/kwartz/binding/erubis.rb +3 -2
- data/lib/kwartz/binding/eruby.rb +3 -2
- data/lib/kwartz/binding/jstl.rb +66 -29
- data/lib/kwartz/binding/perl.rb +230 -0
- data/lib/kwartz/binding/php.rb +69 -29
- data/lib/kwartz/binding/pierubis.rb +3 -2
- data/lib/kwartz/binding/rails.rb +18 -18
- data/lib/kwartz/binding/ruby.rb +74 -42
- data/lib/kwartz/binding/struts.rb +22 -21
- data/lib/kwartz/config.rb +4 -4
- data/lib/kwartz/converter.rb +465 -345
- data/lib/kwartz/defun.rb +2 -2
- data/lib/kwartz/error.rb +2 -2
- data/lib/kwartz/helper/rails.rb +2 -2
- data/lib/kwartz/main.rb +5 -4
- data/lib/kwartz/node.rb +92 -144
- data/lib/kwartz/parser.rb +112 -103
- data/lib/kwartz/translator.rb +14 -6
- data/lib/kwartz/util.rb +2 -2
- data/lib/kwartz/util/assert-text-equal.rb +2 -2
- data/lib/kwartz/util/testcase-helper.rb +1 -1
- data/test/test-compile.rb +2 -2
- data/test/test-compile.yaml +81 -0
- data/test/test-converter.rb +4 -8
- data/test/test-converter.yaml +152 -3
- data/test/test-directives.rb +2 -2
- data/test/test-directives.yaml +222 -0
- data/test/test-main.rb +6 -4
- data/test/test-main.yaml +66 -1
- data/test/test-parser.rb +12 -3
- data/test/test-parser.yaml +64 -51
- data/test/test-rails.rb +2 -2
- data/test/test-ruleset.rb +2 -2
- data/test/test-ruleset.yaml +465 -4
- data/test/test.log +6 -0
- data/test/test.rb +2 -2
- metadata +116 -106
- data/ChangeLog +0 -156
- data/doc-api/classes/Kwartz/DocumentRuleset.html +0 -369
- data/doc-api/classes/Kwartz/ElementExpander.html +0 -325
- data/doc-api/classes/Kwartz/ElementRuleset.html +0 -612
data/lib/kwartz/translator.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
####
|
2
|
-
#### $Rev
|
3
|
-
#### $Release: 3.
|
2
|
+
#### $Rev$
|
3
|
+
#### $Release: 3.2.0 $
|
4
4
|
#### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
|
5
5
|
####
|
6
6
|
|
@@ -152,15 +152,16 @@ module Kwartz
|
|
152
152
|
|
153
153
|
def parse_embedded_expr(text)
|
154
154
|
pos = 0
|
155
|
-
text.scan(/@(!*)\{(.*?)\}@/) do |indicator,
|
155
|
+
text.scan(/@(!*)\{(.*?)\}@/) do |indicator, expr_str|
|
156
156
|
m = Regexp.last_match
|
157
157
|
s = text[pos, m.begin(0) - pos]
|
158
158
|
pos = m.end(0)
|
159
159
|
translate_string(s) unless s.empty?
|
160
|
+
expr_str = parse_expr_str!(expr_str)
|
160
161
|
case indicator
|
161
|
-
when nil, '' ; add_escaped_expr(
|
162
|
-
when '!' ; add_plain_expr(
|
163
|
-
when '!!' ; add_debug_expr(
|
162
|
+
when nil, '' ; add_escaped_expr(expr_str)
|
163
|
+
when '!' ; add_plain_expr(expr_str)
|
164
|
+
when '!!' ; add_debug_expr(expr_str)
|
164
165
|
else ; # do nothing
|
165
166
|
end
|
166
167
|
end
|
@@ -169,6 +170,13 @@ module Kwartz
|
|
169
170
|
end
|
170
171
|
|
171
172
|
|
173
|
+
## (abstract) convert expression to native expression string.
|
174
|
+
## ex. 'item.name' => '$item->name', '$item->name' => '$item->name'
|
175
|
+
def parse_expr_str!(expr_str)
|
176
|
+
not_implemented
|
177
|
+
end
|
178
|
+
|
179
|
+
|
172
180
|
def add_plain_expr(expr_code)
|
173
181
|
@sb << @expr_l << expr_code << @expr_r # ex. <%= expr_code %>
|
174
182
|
end
|
data/lib/kwartz/util.rb
CHANGED
data/test/test-compile.rb
CHANGED
data/test/test-compile.yaml
CHANGED
@@ -306,3 +306,84 @@
|
|
306
306
|
eperl: |
|
307
307
|
<a href="mailto:<?= $email !>"><?= encode_entities($name) !></a>
|
308
308
|
<a href="mailto:<?= $email !>"><?= encode_entities($name) !></a>
|
309
|
+
|
310
|
+
###
|
311
|
+
- name: embedded_expr2
|
312
|
+
desc: common expression string
|
313
|
+
pdata: |
|
314
|
+
@{variable}@
|
315
|
+
@{object.property}@
|
316
|
+
@{hash['key']}@
|
317
|
+
@{hash["key"]}@
|
318
|
+
@{hash[:key]}@
|
319
|
+
@{array[0]}@
|
320
|
+
@{array[index]}@
|
321
|
+
@{$unknown->style}@
|
322
|
+
plogic: |
|
323
|
+
expected*:
|
324
|
+
ruby: |
|
325
|
+
_buf = ""; _buf << ERB::Util.h(variable); _buf << "\n";
|
326
|
+
_buf << ERB::Util.h(object.property); _buf << "\n";
|
327
|
+
_buf << ERB::Util.h(hash['key']); _buf << "\n";
|
328
|
+
_buf << ERB::Util.h(hash["key"]); _buf << "\n";
|
329
|
+
_buf << ERB::Util.h(hash[:key]); _buf << "\n";
|
330
|
+
_buf << ERB::Util.h(array[0]); _buf << "\n";
|
331
|
+
_buf << ERB::Util.h(array[index]); _buf << "\n";
|
332
|
+
_buf << ERB::Util.h($unknown->style); _buf << "\n";
|
333
|
+
; _buf
|
334
|
+
eruby: |
|
335
|
+
<%=h variable %>
|
336
|
+
<%=h object.property %>
|
337
|
+
<%=h hash['key'] %>
|
338
|
+
<%=h hash["key"] %>
|
339
|
+
<%=h hash[:key] %>
|
340
|
+
<%=h array[0] %>
|
341
|
+
<%=h array[index] %>
|
342
|
+
<%=h $unknown->style %>
|
343
|
+
erubis: |
|
344
|
+
<%== variable %>
|
345
|
+
<%== object.property %>
|
346
|
+
<%== hash['key'] %>
|
347
|
+
<%== hash["key"] %>
|
348
|
+
<%== hash[:key] %>
|
349
|
+
<%== array[0] %>
|
350
|
+
<%== array[index] %>
|
351
|
+
<%== $unknown->style %>
|
352
|
+
pierubis: |
|
353
|
+
@{variable}@
|
354
|
+
@{object.property}@
|
355
|
+
@{hash['key']}@
|
356
|
+
@{hash["key"]}@
|
357
|
+
@{hash[:key]}@
|
358
|
+
@{array[0]}@
|
359
|
+
@{array[index]}@
|
360
|
+
@{$unknown->style}@
|
361
|
+
php: |
|
362
|
+
<?php echo htmlspecialchars($variable); ?>
|
363
|
+
<?php echo htmlspecialchars($object->property); ?>
|
364
|
+
<?php echo htmlspecialchars($hash['key']); ?>
|
365
|
+
<?php echo htmlspecialchars($hash["key"]); ?>
|
366
|
+
<?php echo htmlspecialchars($hash['key']); ?>
|
367
|
+
<?php echo htmlspecialchars($array[0]); ?>
|
368
|
+
<?php echo htmlspecialchars($array[$index]); ?>
|
369
|
+
<?php echo htmlspecialchars($unknown->style); ?>
|
370
|
+
jstl: |
|
371
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
372
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
373
|
+
${variable}
|
374
|
+
${object.property}
|
375
|
+
${hash['key']}
|
376
|
+
${hash["key"]}
|
377
|
+
${hash['key']}
|
378
|
+
${array[0]}
|
379
|
+
${array[index]}
|
380
|
+
${$unknown->style}
|
381
|
+
eperl: |
|
382
|
+
<?= encode_entities($variable) !>
|
383
|
+
<?= encode_entities($object->{property}) !>
|
384
|
+
<?= encode_entities($hash{'key'}) !>
|
385
|
+
<?= encode_entities($hash{"key"}) !>
|
386
|
+
<?= encode_entities($hash{'key'}) !>
|
387
|
+
<?= encode_entities($array[0]) !>
|
388
|
+
<?= encode_entities($array[$index]) !>
|
389
|
+
<?= encode_entities($unknown->style) !>
|
data/test/test-converter.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
###
|
2
|
-
### $Rev
|
3
|
-
### $Release: 3.
|
2
|
+
### $Rev$
|
3
|
+
### $Release: 3.2.0 $
|
4
4
|
### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
|
5
5
|
###
|
6
6
|
|
@@ -18,12 +18,8 @@ class ConverterTest < Test::Unit::TestCase
|
|
18
18
|
|
19
19
|
|
20
20
|
def _test
|
21
|
-
(@properties ||= {}).each do |key
|
22
|
-
if key.is_a?(String)
|
23
|
-
key = key.intern
|
24
|
-
@properties.delete(key)
|
25
|
-
@properties[key] = val
|
26
|
-
end
|
21
|
+
(@properties ||= {}).keys.each do |key|
|
22
|
+
@properties[key.intern] = @properties.delete(key) if key.is_a?(String)
|
27
23
|
end
|
28
24
|
parser = Kwartz::PresentationLogicParser.get_class('css').new
|
29
25
|
ruleset_list = parser.parse(@plogic.to_s)
|
data/test/test-converter.yaml
CHANGED
@@ -118,8 +118,8 @@
|
|
118
118
|
# --------------------------------------------------------------------------------
|
119
119
|
|
120
120
|
###
|
121
|
-
- name:
|
122
|
-
desc:
|
121
|
+
- name: selector1
|
122
|
+
desc: selectr - marking
|
123
123
|
pdata: |
|
124
124
|
<ul id="mark:list">
|
125
125
|
<li id="mark:item">foo</li>
|
@@ -148,7 +148,105 @@
|
|
148
148
|
|
149
149
|
|
150
150
|
###
|
151
|
-
- name:
|
151
|
+
- name: selector2
|
152
|
+
desc: selectr - class name
|
153
|
+
pdata: |
|
154
|
+
<ul class="list">
|
155
|
+
<li class="item">foo</li>
|
156
|
+
</ul>
|
157
|
+
plogic: |
|
158
|
+
.list {
|
159
|
+
logic: {
|
160
|
+
_stag;
|
161
|
+
foreach (item in list) {
|
162
|
+
_cont;
|
163
|
+
}
|
164
|
+
_etag;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
.item {
|
168
|
+
value: item;
|
169
|
+
}
|
170
|
+
expected: |
|
171
|
+
print("<ul class=\"list\">\n")
|
172
|
+
<% foreach (item in list) {%>
|
173
|
+
print(" <li class=\"item\">")
|
174
|
+
print(<%=item%>)
|
175
|
+
print("</li>\n")
|
176
|
+
<% }%>
|
177
|
+
print("</ul>\n")
|
178
|
+
|
179
|
+
|
180
|
+
###
|
181
|
+
- name: selector3
|
182
|
+
desc: selectr - tag name
|
183
|
+
pdata: |
|
184
|
+
<ul>
|
185
|
+
<html:li>foo</html:li>
|
186
|
+
</ul>
|
187
|
+
plogic: |
|
188
|
+
ul {
|
189
|
+
logic: {
|
190
|
+
_stag;
|
191
|
+
foreach (item in list) {
|
192
|
+
_cont;
|
193
|
+
}
|
194
|
+
_etag;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
html:li {
|
198
|
+
value: item;
|
199
|
+
}
|
200
|
+
expected: |
|
201
|
+
print("<ul>\n")
|
202
|
+
<% foreach (item in list) {%>
|
203
|
+
print(" <html:li>")
|
204
|
+
print(<%=item%>)
|
205
|
+
print("</html:li>\n")
|
206
|
+
<% }%>
|
207
|
+
print("</ul>\n")
|
208
|
+
|
209
|
+
|
210
|
+
###
|
211
|
+
- name: selector4
|
212
|
+
desc: selectr - combination of marking, classname, and tagname
|
213
|
+
pdata: |
|
214
|
+
<ul id="mark:list">
|
215
|
+
<ol>
|
216
|
+
<li class="item">foo</li>
|
217
|
+
</ol>
|
218
|
+
</ul>
|
219
|
+
plogic: |
|
220
|
+
#list, ol, .item {
|
221
|
+
logic: {
|
222
|
+
foreach (item in list) {
|
223
|
+
_elem
|
224
|
+
}
|
225
|
+
}
|
226
|
+
}
|
227
|
+
li {
|
228
|
+
value: item;
|
229
|
+
}
|
230
|
+
expected: |
|
231
|
+
<% foreach (item in list) {%>
|
232
|
+
print("<ul>\n")
|
233
|
+
<% foreach (item in list) {%>
|
234
|
+
print(" <ol>\n")
|
235
|
+
<% foreach (item in list) {%>
|
236
|
+
print(" <li class=\"item\">")
|
237
|
+
print(<%=item%>)
|
238
|
+
print("</li>\n")
|
239
|
+
<% }%>
|
240
|
+
print(" </ol>\n")
|
241
|
+
<% }%>
|
242
|
+
print("</ul>\n")
|
243
|
+
<% }%>
|
244
|
+
|
245
|
+
|
246
|
+
# --------------------------------------------------------------------------------
|
247
|
+
|
248
|
+
###
|
249
|
+
- name: convert11
|
152
250
|
desc: empty logic
|
153
251
|
pdata: |
|
154
252
|
<div>
|
@@ -168,6 +266,57 @@
|
|
168
266
|
print("<div>\n")
|
169
267
|
print("</div>\n")
|
170
268
|
|
269
|
+
###
|
270
|
+
- name: convert12
|
271
|
+
desc: "'#DOCUMENT' and 'logic:'"
|
272
|
+
pdata: |
|
273
|
+
<html>
|
274
|
+
<body>
|
275
|
+
<h1 id="mark:title">...title...</h1>
|
276
|
+
<p>...</p>
|
277
|
+
<div id="mark:content">
|
278
|
+
<table>
|
279
|
+
<tr id="mark:list">
|
280
|
+
<td id="mark:item"></td>
|
281
|
+
</tr>
|
282
|
+
</table>
|
283
|
+
</div>
|
284
|
+
</body>
|
285
|
+
</html>
|
286
|
+
plogic: |
|
287
|
+
#DOCUMENT {
|
288
|
+
logic: {
|
289
|
+
_element(title)
|
290
|
+
_content(content)
|
291
|
+
}
|
292
|
+
}
|
293
|
+
#title {
|
294
|
+
value: title;
|
295
|
+
}
|
296
|
+
#list {
|
297
|
+
logic: {
|
298
|
+
for item in list
|
299
|
+
_elem
|
300
|
+
end
|
301
|
+
}
|
302
|
+
}
|
303
|
+
#item {
|
304
|
+
value: item;
|
305
|
+
}
|
306
|
+
expected: |
|
307
|
+
print(" <h1>")
|
308
|
+
print(<%=title%>)
|
309
|
+
print("</h1>\n")
|
310
|
+
print(" <table>\n")
|
311
|
+
<% for item in list%>
|
312
|
+
print(" <tr>\n")
|
313
|
+
print(" <td>")
|
314
|
+
print(<%=item%>)
|
315
|
+
print("</td>\n")
|
316
|
+
print(" </tr>\n")
|
317
|
+
<% end%>
|
318
|
+
print(" </table>\n")
|
319
|
+
|
171
320
|
|
172
321
|
# --------------------------------------------------------------------------------
|
173
322
|
|
data/test/test-directives.rb
CHANGED
data/test/test-directives.yaml
CHANGED
@@ -50,6 +50,7 @@
|
|
50
50
|
{{*${expr}*}}
|
51
51
|
{{*<c:out value="${expr}" escapeXml="false"/>*}}
|
52
52
|
|
53
|
+
|
53
54
|
###
|
54
55
|
- name: stag
|
55
56
|
subject: stag, Stag, STAG
|
@@ -102,6 +103,8 @@
|
|
102
103
|
{{*${expr}*}}foo</b>
|
103
104
|
{{*<c:out value="${expr}" escapeXml="false"/>*}}foo</b>
|
104
105
|
|
106
|
+
|
107
|
+
###
|
105
108
|
- name: etag
|
106
109
|
subject: etag, Etag, ETAG
|
107
110
|
desc: |
|
@@ -153,6 +156,7 @@
|
|
153
156
|
<b>foo{{*${expr}*}}
|
154
157
|
<b>foo{{*<c:out value="${expr}" escapeXml="false"/>*}}
|
155
158
|
|
159
|
+
|
156
160
|
###
|
157
161
|
- name: cont
|
158
162
|
subject: cont, Cont, CONT
|
@@ -205,6 +209,7 @@
|
|
205
209
|
<b>{{*${expr}*}}</b>
|
206
210
|
<b>{{*<c:out value="${expr}" escapeXml="false"/>*}}</b>
|
207
211
|
|
212
|
+
|
208
213
|
###
|
209
214
|
- name: value
|
210
215
|
subject: value, Value, VALUE
|
@@ -254,6 +259,7 @@
|
|
254
259
|
<b>{{*${expr}*}}</b>
|
255
260
|
<b>{{*<c:out value="${expr}" escapeXml="false"/>*}}</b>
|
256
261
|
|
262
|
+
|
257
263
|
###
|
258
264
|
- name: foreach
|
259
265
|
subject: foreach
|
@@ -369,6 +375,7 @@
|
|
369
375
|
</tr>
|
370
376
|
{{*</c:forEach>*}}
|
371
377
|
|
378
|
+
|
372
379
|
###
|
373
380
|
- name: list
|
374
381
|
subject: list
|
@@ -462,6 +469,7 @@
|
|
462
469
|
{{*</c:forEach>*}}
|
463
470
|
</tr>
|
464
471
|
|
472
|
+
|
465
473
|
###
|
466
474
|
- name: foreach_ctr
|
467
475
|
subject: Foreach, List
|
@@ -573,6 +581,7 @@
|
|
573
581
|
{{*</c:forEach>*}}
|
574
582
|
</tr>
|
575
583
|
|
584
|
+
|
576
585
|
###
|
577
586
|
- name: foreach_tgl
|
578
587
|
subject: FOREACH, LIST
|
@@ -695,6 +704,7 @@
|
|
695
704
|
{{*</c:forEach>*}}
|
696
705
|
</tr>
|
697
706
|
|
707
|
+
|
698
708
|
###
|
699
709
|
- name: while
|
700
710
|
subject: while, loop
|
@@ -779,6 +789,7 @@
|
|
779
789
|
jstl: |
|
780
790
|
*** not supported ***
|
781
791
|
|
792
|
+
|
782
793
|
###
|
783
794
|
- name: if
|
784
795
|
subject: if-then-else
|
@@ -894,6 +905,7 @@
|
|
894
905
|
</div>
|
895
906
|
{{*</c:otherwise></c:choose>*}}
|
896
907
|
|
908
|
+
|
897
909
|
###
|
898
910
|
- name: set
|
899
911
|
subject: set
|
@@ -946,6 +958,7 @@
|
|
946
958
|
<td>${color}</td>
|
947
959
|
</tr>
|
948
960
|
|
961
|
+
|
949
962
|
###
|
950
963
|
- name: mark
|
951
964
|
subject: mark
|
@@ -998,6 +1011,7 @@
|
|
998
1011
|
<li>foo</li>
|
999
1012
|
</ul>
|
1000
1013
|
|
1014
|
+
|
1001
1015
|
###
|
1002
1016
|
- name: attr
|
1003
1017
|
subject: attr, Attr, ATTR
|
@@ -1075,6 +1089,7 @@
|
|
1075
1089
|
</tr>
|
1076
1090
|
</c:forEach>
|
1077
1091
|
|
1092
|
+
|
1078
1093
|
###
|
1079
1094
|
- name: append
|
1080
1095
|
subject: append, Append, APPEND
|
@@ -1129,6 +1144,7 @@
|
|
1129
1144
|
<input type="checkbox"{{*${flag1 ? ' checked=\'checked\'' : ''}*}}>
|
1130
1145
|
# <input type="checkbox" name="flag" value="y"${flag1 ? ' checked=\'checked\'' : ''}>
|
1131
1146
|
|
1147
|
+
|
1132
1148
|
###
|
1133
1149
|
- name: dummy
|
1134
1150
|
subject: dummy
|
@@ -1188,6 +1204,7 @@
|
|
1188
1204
|
<li>foo</li>
|
1189
1205
|
</ul>
|
1190
1206
|
|
1207
|
+
|
1191
1208
|
###
|
1192
1209
|
- name: default
|
1193
1210
|
subject: default, Default, DEFAULT
|
@@ -1225,6 +1242,7 @@
|
|
1225
1242
|
jstl: |
|
1226
1243
|
name: <em>{{*<c:out value="${user}" default="Guest"/>*}}</em>
|
1227
1244
|
|
1245
|
+
|
1228
1246
|
###
|
1229
1247
|
- name: replace
|
1230
1248
|
common: yes
|
@@ -1300,6 +1318,7 @@
|
|
1300
1318
|
|
1301
1319
|
jstl: *replace1_expected
|
1302
1320
|
|
1321
|
+
|
1303
1322
|
###
|
1304
1323
|
- name: replace2
|
1305
1324
|
hide: yes
|
@@ -1394,3 +1413,206 @@
|
|
1394
1413
|
eperl: *expected1
|
1395
1414
|
|
1396
1415
|
jstl: *expected1
|
1416
|
+
|
1417
|
+
|
1418
|
+
###
|
1419
|
+
- name: expr
|
1420
|
+
subject: Language-independent Directive
|
1421
|
+
desc: |
|
1422
|
+
Some directives can be language-independent.
|
1423
|
+
|
1424
|
+
.* 'mark' and 'replace_(element|content)_with_(element|content)' directives can be
|
1425
|
+
language-independent because their argument is element name which is
|
1426
|
+
language-independent.
|
1427
|
+
.* 'dummy' directive can be language-independent because it takes dummy argument.
|
1428
|
+
.* 'value', 'elem', 'stag', 'etag', 'cont', and 'default' directives can be
|
1429
|
+
language-independent if their expression argument is one of the following format.
|
1430
|
+
.- {{,variable,}}
|
1431
|
+
.- {{,object.property,}}
|
1432
|
+
.- {{,hash['key'],}}, {{,hash["key"],}}, {{,hash[:key],}}
|
1433
|
+
.- {{,array[123],}}, {{,array[var],}}
|
1434
|
+
|
1435
|
+
Language-independent directives are always described with id attribute.
|
1436
|
+
|
1437
|
+
pdata*:
|
1438
|
+
eruby: &expr_pdata|
|
1439
|
+
<p id="value:user">foo</p>
|
1440
|
+
<p id="value:user.name">foo</p>
|
1441
|
+
<p id="value:user['name']">foo</p>
|
1442
|
+
<p id="value:user[:name]">foo</p>
|
1443
|
+
<p id="value:user[0]">foo</p>
|
1444
|
+
<p id="value:user[index]">foo</p>
|
1445
|
+
php: *expr_pdata
|
1446
|
+
jstl: *expr_pdata
|
1447
|
+
eperl: *expr_pdata
|
1448
|
+
|
1449
|
+
expected*:
|
1450
|
+
eruby: |
|
1451
|
+
<p><%= user %></p>
|
1452
|
+
<p><%= user.name %></p>
|
1453
|
+
<p><%= user['name'] %></p>
|
1454
|
+
<p><%= user[:name] %></p>
|
1455
|
+
<p><%= user[0] %></p>
|
1456
|
+
<p><%= user[index] %></p>
|
1457
|
+
|
1458
|
+
php: |
|
1459
|
+
<p><?php echo $user; ?></p>
|
1460
|
+
<p><?php echo $user->name; ?></p>
|
1461
|
+
<p><?php echo $user['name']; ?></p>
|
1462
|
+
<p><?php echo $user['name']; ?></p>
|
1463
|
+
<p><?php echo $user[0]; ?></p>
|
1464
|
+
<p><?php echo $user[$index]; ?></p>
|
1465
|
+
|
1466
|
+
eperl: |
|
1467
|
+
<p><?= $user !></p>
|
1468
|
+
<p><?= $user->{name} !></p>
|
1469
|
+
<p><?= $user{'name'} !></p>
|
1470
|
+
<p><?= $user{'name'} !></p>
|
1471
|
+
<p><?= $user[0] !></p>
|
1472
|
+
<p><?= $user[$index] !></p>
|
1473
|
+
|
1474
|
+
jstl: |
|
1475
|
+
<p>${user}</p>
|
1476
|
+
<p>${user.name}</p>
|
1477
|
+
<p>${user['name']}</p>
|
1478
|
+
<p>${user['name']}</p>
|
1479
|
+
<p>${user[0]}</p>
|
1480
|
+
<p>${user[index]}</p>
|
1481
|
+
|
1482
|
+
|
1483
|
+
###
|
1484
|
+
- name: expr2
|
1485
|
+
hide: yes
|
1486
|
+
subject: Language-independent Directive
|
1487
|
+
desc: |
|
1488
|
+
|
1489
|
+
pdata*:
|
1490
|
+
eruby: &expr2_pdata |
|
1491
|
+
<p id="value:user.name">foo</p>
|
1492
|
+
<p id="Value:user['name']">foo</p>
|
1493
|
+
<p id="VALUE:user[:name]">foo</p>
|
1494
|
+
|
1495
|
+
<p id="elem:user.name">foo</p>
|
1496
|
+
<p id="Elem:user['name']">foo</p>
|
1497
|
+
<p id="ELEM:user[:name]">foo</p>
|
1498
|
+
|
1499
|
+
<p id="cont:user.name">foo</p>
|
1500
|
+
<p id="Cont:user['name']">foo</p>
|
1501
|
+
<p id="CONT:user[:name]">foo</p>
|
1502
|
+
|
1503
|
+
<p id="stag:user.name">foo</p>
|
1504
|
+
<p id="Stag:user['name']">foo</p>
|
1505
|
+
<p id="STAG:user[:name]">foo</p>
|
1506
|
+
|
1507
|
+
<p id="etag:user.name">foo</p>
|
1508
|
+
<p id="Etag:user['name']">foo</p>
|
1509
|
+
<p id="ETAG:user[:name]">foo</p>
|
1510
|
+
|
1511
|
+
<p id="default:user.name">foo</p>
|
1512
|
+
<p id="Default:user['name']">foo</p>
|
1513
|
+
<p id="DEFAULT:user[:name]">foo</p>
|
1514
|
+
php: *expr2_pdata
|
1515
|
+
jstl: *expr2_pdata
|
1516
|
+
eperl: *expr2_pdata
|
1517
|
+
|
1518
|
+
expected*:
|
1519
|
+
eruby: |
|
1520
|
+
<p><%= user.name %></p>
|
1521
|
+
<p><%=h user['name'] %></p>
|
1522
|
+
<p><%= user[:name] %></p>
|
1523
|
+
|
1524
|
+
<%= user.name %>
|
1525
|
+
<%=h user['name'] %>
|
1526
|
+
<%= user[:name] %>
|
1527
|
+
|
1528
|
+
<p><%= user.name %></p>
|
1529
|
+
<p><%=h user['name'] %></p>
|
1530
|
+
<p><%= user[:name] %></p>
|
1531
|
+
|
1532
|
+
<%= user.name %>foo</p>
|
1533
|
+
<%=h user['name'] %>foo</p>
|
1534
|
+
<%= user[:name] %>foo</p>
|
1535
|
+
|
1536
|
+
<p>foo<%= user.name %>
|
1537
|
+
<p>foo<%=h user['name'] %>
|
1538
|
+
<p>foo<%= user[:name] %>
|
1539
|
+
|
1540
|
+
<p><% if (user.name) && !(user.name).to_s.empty? then %><%= user.name %><% else %>foo<% end %></p>
|
1541
|
+
<p><% if (user['name']) && !(user['name']).to_s.empty? then %><%=h user['name'] %><% else %>foo<% end %></p>
|
1542
|
+
<p><% if (user[:name]) && !(user[:name]).to_s.empty? then %><%= user[:name] %><% else %>foo<% end %></p>
|
1543
|
+
|
1544
|
+
php: |
|
1545
|
+
<p><?php echo $user->name; ?></p>
|
1546
|
+
<p><?php echo htmlspecialchars($user['name']); ?></p>
|
1547
|
+
<p><?php echo $user['name']; ?></p>
|
1548
|
+
|
1549
|
+
<?php echo $user->name; ?>
|
1550
|
+
<?php echo htmlspecialchars($user['name']); ?>
|
1551
|
+
<?php echo $user['name']; ?>
|
1552
|
+
|
1553
|
+
<p><?php echo $user->name; ?></p>
|
1554
|
+
<p><?php echo htmlspecialchars($user['name']); ?></p>
|
1555
|
+
<p><?php echo $user['name']; ?></p>
|
1556
|
+
|
1557
|
+
<?php echo $user->name; ?>foo</p>
|
1558
|
+
<?php echo htmlspecialchars($user['name']); ?>foo</p>
|
1559
|
+
<?php echo $user['name']; ?>foo</p>
|
1560
|
+
|
1561
|
+
<p>foo<?php echo $user->name; ?>
|
1562
|
+
<p>foo<?php echo htmlspecialchars($user['name']); ?>
|
1563
|
+
<p>foo<?php echo $user['name']; ?>
|
1564
|
+
|
1565
|
+
<p><?php if ($user->name) { ?><?php echo $user->name; ?><?php } else { ?>foo<?php } ?></p>
|
1566
|
+
<p><?php if ($user['name']) { ?><?php echo htmlspecialchars($user['name']); ?><?php } else { ?>foo<?php } ?></p>
|
1567
|
+
<p><?php if ($user['name']) { ?><?php echo $user['name']; ?><?php } else { ?>foo<?php } ?></p>
|
1568
|
+
|
1569
|
+
eperl: |
|
1570
|
+
<p><?= $user->{name} !></p>
|
1571
|
+
<p><?= encode_entities($user{'name'}) !></p>
|
1572
|
+
<p><?= $user{'name'} !></p>
|
1573
|
+
|
1574
|
+
<?= $user->{name} !>
|
1575
|
+
<?= encode_entities($user{'name'}) !>
|
1576
|
+
<?= $user{'name'} !>
|
1577
|
+
|
1578
|
+
<p><?= $user->{name} !></p>
|
1579
|
+
<p><?= encode_entities($user{'name'}) !></p>
|
1580
|
+
<p><?= $user{'name'} !></p>
|
1581
|
+
|
1582
|
+
<?= $user->{name} !>foo</p>
|
1583
|
+
<?= encode_entities($user{'name'}) !>foo</p>
|
1584
|
+
<?= $user{'name'} !>foo</p>
|
1585
|
+
|
1586
|
+
<p>foo<?= $user->{name} !>
|
1587
|
+
<p>foo<?= encode_entities($user{'name'}) !>
|
1588
|
+
<p>foo<?= $user{'name'} !>
|
1589
|
+
|
1590
|
+
<p><? if ($user->{name}) { !><?= $user->{name} !><? } else { !>foo<? } !></p>
|
1591
|
+
<p><? if ($user{'name'}) { !><?= encode_entities($user{'name'}) !><? } else { !>foo<? } !></p>
|
1592
|
+
<p><? if ($user{'name'}) { !><?= $user{'name'} !><? } else { !>foo<? } !></p>
|
1593
|
+
|
1594
|
+
jstl: |
|
1595
|
+
<p>${user.name}</p>
|
1596
|
+
<p>${user['name']}</p>
|
1597
|
+
<p><c:out value="${user['name']}" escapeXml="false"/></p>
|
1598
|
+
|
1599
|
+
${user.name}
|
1600
|
+
${user['name']}
|
1601
|
+
<c:out value="${user['name']}" escapeXml="false"/>
|
1602
|
+
|
1603
|
+
<p>${user.name}</p>
|
1604
|
+
<p>${user['name']}</p>
|
1605
|
+
<p><c:out value="${user['name']}" escapeXml="false"/></p>
|
1606
|
+
|
1607
|
+
${user.name}foo</p>
|
1608
|
+
${user['name']}foo</p>
|
1609
|
+
<c:out value="${user['name']}" escapeXml="false"/>foo</p>
|
1610
|
+
|
1611
|
+
<p>foo${user.name}
|
1612
|
+
<p>foo${user['name']}
|
1613
|
+
<p>foo<c:out value="${user['name']}" escapeXml="false"/>
|
1614
|
+
|
1615
|
+
<p><c:out value="${user.name}" default="foo"/></p>
|
1616
|
+
<p><c:out value="${user['name']}" escapeXml="true" default="foo"/></p>
|
1617
|
+
<p><c:out value="${user['name']}" escapeXml="false" default="foo"/></p>
|
1618
|
+
|