kwartz 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. data/COPYING +340 -0
  2. data/ChangeLog +103 -0
  3. data/README.txt +37 -0
  4. data/bin/kwartz +12 -0
  5. data/doc-api/classes/Kwartz.html +218 -0
  6. data/doc-api/classes/Kwartz/Assertion.html +140 -0
  7. data/doc-api/classes/Kwartz/AssertionError.html +148 -0
  8. data/doc-api/classes/Kwartz/AttrInfo.html +320 -0
  9. data/doc-api/classes/Kwartz/BaseError.html +206 -0
  10. data/doc-api/classes/Kwartz/BaseTranslator.html +331 -0
  11. data/doc-api/classes/Kwartz/CharacterType.html +212 -0
  12. data/doc-api/classes/Kwartz/CommandOptionError.html +154 -0
  13. data/doc-api/classes/Kwartz/CommandOptions.html +374 -0
  14. data/doc-api/classes/Kwartz/Config.html +150 -0
  15. data/doc-api/classes/Kwartz/ConvertError.html +191 -0
  16. data/doc-api/classes/Kwartz/Converter.html +252 -0
  17. data/doc-api/classes/Kwartz/CssStyleParser.html +483 -0
  18. data/doc-api/classes/Kwartz/DocumentRuleset.html +369 -0
  19. data/doc-api/classes/Kwartz/ElementExpander.html +325 -0
  20. data/doc-api/classes/Kwartz/ElementInfo.html +312 -0
  21. data/doc-api/classes/Kwartz/ElementRuleset.html +582 -0
  22. data/doc-api/classes/Kwartz/EperlHandler.html +338 -0
  23. data/doc-api/classes/Kwartz/EperlTranslator.html +167 -0
  24. data/doc-api/classes/Kwartz/ErubisHandler.html +113 -0
  25. data/doc-api/classes/Kwartz/ErubisTranslator.html +168 -0
  26. data/doc-api/classes/Kwartz/ErubyHandler.html +337 -0
  27. data/doc-api/classes/Kwartz/ErubyTranslator.html +167 -0
  28. data/doc-api/classes/Kwartz/ExpandStatement.html +227 -0
  29. data/doc-api/classes/Kwartz/Expression.html +119 -0
  30. data/doc-api/classes/Kwartz/Handler.html +558 -0
  31. data/doc-api/classes/Kwartz/JstlHandler.html +657 -0
  32. data/doc-api/classes/Kwartz/JstlTranslator.html +226 -0
  33. data/doc-api/classes/Kwartz/KwartzError.html +146 -0
  34. data/doc-api/classes/Kwartz/Main.html +384 -0
  35. data/doc-api/classes/Kwartz/NativeExpression.html +236 -0
  36. data/doc-api/classes/Kwartz/NativeStatement.html +254 -0
  37. data/doc-api/classes/Kwartz/Node.html +156 -0
  38. data/doc-api/classes/Kwartz/ParseError.html +148 -0
  39. data/doc-api/classes/Kwartz/PhpHandler.html +333 -0
  40. data/doc-api/classes/Kwartz/PhpTranslator.html +194 -0
  41. data/doc-api/classes/Kwartz/PresentationLogicParser.html +830 -0
  42. data/doc-api/classes/Kwartz/PrintStatement.html +221 -0
  43. data/doc-api/classes/Kwartz/RailsHandler.html +587 -0
  44. data/doc-api/classes/Kwartz/RailsTranslator.html +167 -0
  45. data/doc-api/classes/Kwartz/RubyStyleParser.html +558 -0
  46. data/doc-api/classes/Kwartz/Ruleset.html +117 -0
  47. data/doc-api/classes/Kwartz/Statement.html +119 -0
  48. data/doc-api/classes/Kwartz/StrutsTranslator.html +190 -0
  49. data/doc-api/classes/Kwartz/TagInfo.html +314 -0
  50. data/doc-api/classes/Kwartz/TextConverter.html +270 -0
  51. data/doc-api/classes/Kwartz/Translator.html +318 -0
  52. data/doc-api/classes/Test.html +107 -0
  53. data/doc-api/classes/Test/Unit.html +101 -0
  54. data/doc-api/created.rid +1 -0
  55. data/doc-api/files/__/README_txt.html +150 -0
  56. data/doc-api/files/kwartz/assert_rb.html +114 -0
  57. data/doc-api/files/kwartz/binding/eperl_rb.html +116 -0
  58. data/doc-api/files/kwartz/binding/erubis_rb.html +116 -0
  59. data/doc-api/files/kwartz/binding/eruby_rb.html +115 -0
  60. data/doc-api/files/kwartz/binding/jstl_rb.html +116 -0
  61. data/doc-api/files/kwartz/binding/php_rb.html +116 -0
  62. data/doc-api/files/kwartz/binding/rails_rb.html +115 -0
  63. data/doc-api/files/kwartz/binding/struts_rb.html +117 -0
  64. data/doc-api/files/kwartz/config_rb.html +107 -0
  65. data/doc-api/files/kwartz/converter_rb.html +119 -0
  66. data/doc-api/files/kwartz/error_rb.html +107 -0
  67. data/doc-api/files/kwartz/main_rb.html +124 -0
  68. data/doc-api/files/kwartz/node_rb.html +114 -0
  69. data/doc-api/files/kwartz/parser_rb.html +117 -0
  70. data/doc-api/files/kwartz/translator_rb.html +115 -0
  71. data/doc-api/files/kwartz/util/assert-text-equal_rb.html +115 -0
  72. data/doc-api/files/kwartz/util/testcase-helper_rb.html +115 -0
  73. data/doc-api/files/kwartz_rb.html +120 -0
  74. data/doc-api/fr_class_index.html +75 -0
  75. data/doc-api/fr_file_index.html +45 -0
  76. data/doc-api/fr_method_index.html +216 -0
  77. data/doc-api/index.html +24 -0
  78. data/doc-api/rdoc-style.css +208 -0
  79. data/doc/docstyle.css +188 -0
  80. data/doc/p-pattern.html +1207 -0
  81. data/doc/reference.html +3396 -0
  82. data/doc/users-guide.html +1670 -0
  83. data/examples/breadcrumbs1/Makefile +15 -0
  84. data/examples/breadcrumbs1/breadcrumbs.eruby.plogic +27 -0
  85. data/examples/breadcrumbs1/breadcrumbs.html +12 -0
  86. data/examples/breadcrumbs1/breadcrumbs.jstl.plogic +28 -0
  87. data/examples/breadcrumbs1/breadcrumbs.php.plogic +26 -0
  88. data/examples/breadcrumbs1/main.php +12 -0
  89. data/examples/breadcrumbs1/main.rb +12 -0
  90. data/examples/breadcrumbs2/Makefile +15 -0
  91. data/examples/breadcrumbs2/breadcrumbs.eruby.plogic +22 -0
  92. data/examples/breadcrumbs2/breadcrumbs.html +14 -0
  93. data/examples/breadcrumbs2/breadcrumbs.jstl.plogic +24 -0
  94. data/examples/breadcrumbs2/breadcrumbs.php.plogic +23 -0
  95. data/examples/breadcrumbs2/main.php +12 -0
  96. data/examples/breadcrumbs2/main.rb +12 -0
  97. data/examples/pagelayout/Makefile +47 -0
  98. data/examples/pagelayout/content.eruby.plogic +44 -0
  99. data/examples/pagelayout/content.jstl.plogic +36 -0
  100. data/examples/pagelayout/content.php.plogic +37 -0
  101. data/examples/pagelayout/content1.html +36 -0
  102. data/examples/pagelayout/content2.html +29 -0
  103. data/examples/pagelayout/design.css +40 -0
  104. data/examples/pagelayout/layout.html +50 -0
  105. data/examples/pagelayout/main.php +55 -0
  106. data/examples/pagelayout/main.rb +77 -0
  107. data/examples/pagelayout/menu.eruby.plogic +14 -0
  108. data/examples/pagelayout/menu.html +13 -0
  109. data/examples/pagelayout/menu.jstl.plogic +14 -0
  110. data/examples/pagelayout/menu.php.plogic +14 -0
  111. data/examples/rails1/Makefile +36 -0
  112. data/examples/rails1/README +19 -0
  113. data/examples/rails1/application_helper.rb +31 -0
  114. data/examples/rails1/edit.html +28 -0
  115. data/examples/rails1/edit.plogic +10 -0
  116. data/examples/rails1/form.html +52 -0
  117. data/examples/rails1/form.plogic +33 -0
  118. data/examples/rails1/layout.plogic +15 -0
  119. data/examples/rails1/link_to.plogic +19 -0
  120. data/examples/rails1/list.html +48 -0
  121. data/examples/rails1/list.plogic +28 -0
  122. data/examples/rails1/new.html +27 -0
  123. data/examples/rails1/new.plogic +10 -0
  124. data/examples/rails1/reader.plogic +29 -0
  125. data/examples/rails1/show.html +40 -0
  126. data/examples/rails1/show.plogic +4 -0
  127. data/examples/rails1/writer.plogic +8 -0
  128. data/examples/table1/Makefile +15 -0
  129. data/examples/table1/main.php +11 -0
  130. data/examples/table1/main.rb +11 -0
  131. data/examples/table1/table1.eruby.plogic +21 -0
  132. data/examples/table1/table1.html +16 -0
  133. data/examples/table1/table1.jstl.plogic +21 -0
  134. data/examples/table1/table1.php.plogic +22 -0
  135. data/kwartz.gemspec +55 -0
  136. data/lib/kwartz.rb +13 -0
  137. data/lib/kwartz/assert.rb +31 -0
  138. data/lib/kwartz/binding/eperl.rb +166 -0
  139. data/lib/kwartz/binding/erubis.rb +61 -0
  140. data/lib/kwartz/binding/eruby.rb +164 -0
  141. data/lib/kwartz/binding/jstl.rb +334 -0
  142. data/lib/kwartz/binding/php.rb +167 -0
  143. data/lib/kwartz/binding/rails.rb +295 -0
  144. data/lib/kwartz/binding/struts.rb +109 -0
  145. data/lib/kwartz/config.rb +28 -0
  146. data/lib/kwartz/converter.rb +920 -0
  147. data/lib/kwartz/error.rb +41 -0
  148. data/lib/kwartz/main.rb +464 -0
  149. data/lib/kwartz/node.rb +454 -0
  150. data/lib/kwartz/parser.rb +903 -0
  151. data/lib/kwartz/translator.rb +153 -0
  152. data/lib/kwartz/util/assert-text-equal.rb +44 -0
  153. data/lib/kwartz/util/testcase-helper.rb +112 -0
  154. data/setup.rb +1331 -0
  155. data/test/test-compile.rb +36 -0
  156. data/test/test-compile.yaml +178 -0
  157. data/test/test-converter.rb +34 -0
  158. data/test/test-converter.yaml +127 -0
  159. data/test/test-directives.rb +32 -0
  160. data/test/test-directives.yaml +1411 -0
  161. data/test/test-main.rb +464 -0
  162. data/test/test-parser.rb +54 -0
  163. data/test/test-parser.yaml +394 -0
  164. data/test/test-rails.rb +28 -0
  165. data/test/test-rails.yaml +301 -0
  166. data/test/test-ruleset.rb +36 -0
  167. data/test/test-ruleset.yaml +804 -0
  168. data/test/test.rb +44 -0
  169. metadata +236 -0
@@ -0,0 +1,3396 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html">
5
+ <title>Kwartz-ruby 3.0 Reference Guide</title>
6
+ <meta name="generator" content="kwaser">
7
+ <meta http-equiv="Content-Style-Type" content="text/css">
8
+ <link rel="stylesheet" href="docstyle.css" type="text/css">
9
+ </head>
10
+ <body>
11
+
12
+ <blockquote>
13
+ <div class="mainbody">
14
+
15
+ <div align="left"><h1>Kwartz-ruby 3.0 Reference Guide</h1></div>
16
+ <div align="left">
17
+ last update: $Date: 2006-06-01 08:44:37 +0900 (Thu, 01 Jun 2006) $<br>
18
+ </div>
19
+
20
+ <a name="preface"></a>
21
+ <h2 class="section1">Preface</h2>
22
+ <p>This document<sup>(<a href="#fnref:1" name="fnlink:1">*1</a>)</sup> is the reference manual of Kwartz-ruby 3.0.
23
+ </p>
24
+ <p>Kwartz<sup>(<a href="#fnref:2" name="fnlink:2">*2</a>)</sup> is a template system which realized the concept 'Independence of Presentation Logic'.
25
+ It means that presentation logics are separated from both presentation data (typically HTML file) and business logic layer (typically main program).
26
+ </p>
27
+ <p>If you are new to Kwartz, see <a href="users-guide.html">Users' Guide</a> at first.
28
+ </p>
29
+ <div class="footnote">
30
+ <dl compact>
31
+ <dt>(<a name="fnref:1" href="#fnlink:1">*1</a>)</dt>
32
+ <dd>This document is generated automatically from unit-test data. Knuth had propsed integration of code and document. I propose integration of test and document :-)</dd>
33
+ <dt>(<a name="fnref:2" href="#fnlink:2">*2</a>)</dt>
34
+ <dd>Development of Kwartz had subsidized by Exploratory Software Project of <a href="http://www.ipa.go.jp/about/english/index.html">IPA (Information-Technology Promotion Agency Japan)</a>.</dd>
35
+ </dl>
36
+ </div>
37
+ <a name="toc"></a>
38
+ <h3 class="section2">Table of Contents</h3>
39
+ <ul>
40
+ <li><a href="#preface">Preface</a>
41
+ <ul>
42
+ <li><a href="#toc">Table of Contents</a>
43
+ </li>
44
+ </ul>
45
+ </li>
46
+ <li><a href="#plogic">Pesentation Logic</a>
47
+ <ul>
48
+ <li><a href="#property-elem">elem, Elem, ELEM</a>
49
+ </li>
50
+ <li><a href="#property-cont">cont, Cont, CONT</a>
51
+ </li>
52
+ <li><a href="#property-value">value, Value, VALUE</a>
53
+ </li>
54
+ <li><a href="#property-stag">stag, Stag, STAG</a>
55
+ </li>
56
+ <li><a href="#property-etag">etag, Etag, ETAG</a>
57
+ </li>
58
+ <li><a href="#property-attrs">attrs, Attrs, ATTRS</a>
59
+ </li>
60
+ <li><a href="#property-append">append, Append, APPEND</a>
61
+ </li>
62
+ <li><a href="#property-remove">remove</a>
63
+ </li>
64
+ <li><a href="#property-logic">logic</a>
65
+ </li>
66
+ <li><a href="#property-begin">begin, end</a>
67
+ </li>
68
+ </ul>
69
+ </li>
70
+ <li><a href="#directives">Directives</a>
71
+ <ul>
72
+ <li><a href="#directive-elem">elem, Elem, ELEM</a>
73
+ </li>
74
+ <li><a href="#directive-stag">stag, Stag, STAG</a>
75
+ </li>
76
+ <li><a href="#directive-etag">etag, Etag, ETAG</a>
77
+ </li>
78
+ <li><a href="#directive-cont">cont, Cont, CONT</a>
79
+ </li>
80
+ <li><a href="#directive-value">value, Value, VALUE</a>
81
+ </li>
82
+ <li><a href="#directive-foreach">foreach</a>
83
+ </li>
84
+ <li><a href="#directive-list">list</a>
85
+ </li>
86
+ <li><a href="#directive-foreach_ctr">Foreach, List</a>
87
+ </li>
88
+ <li><a href="#directive-foreach_tgl">FOREACH, LIST</a>
89
+ </li>
90
+ <li><a href="#directive-while">while, loop</a>
91
+ </li>
92
+ <li><a href="#directive-if">if-then-else</a>
93
+ </li>
94
+ <li><a href="#directive-set">set</a>
95
+ </li>
96
+ <li><a href="#directive-mark">mark</a>
97
+ </li>
98
+ <li><a href="#directive-attr">attr, Attr, ATTR</a>
99
+ </li>
100
+ <li><a href="#directive-append">append, Append, APPEND</a>
101
+ </li>
102
+ <li><a href="#directive-dummy">dummy</a>
103
+ </li>
104
+ <li><a href="#directive-default">default, Default, DEFAULT</a>
105
+ </li>
106
+ <li><a href="#directive-replace">replace_element/content_with_element/content</a>
107
+ </li>
108
+ </ul>
109
+ </li>
110
+ <li><a href="#cmdline">Command-Line Options</a>
111
+ </li>
112
+ </ul>
113
+ <br>
114
+
115
+
116
+ <br>
117
+
118
+
119
+ <a name="plogic"></a>
120
+ <h2 class="section1">Pesentation Logic</h2>
121
+ <p>Presentation logic format in Kwartz is similar to Cascading Style Sheet (CSS).
122
+ </p>
123
+ <ul type="disc">
124
+ <li>Presentation logic file is a set of ruleset.
125
+ </li>
126
+ <li>Ruleset is a pair of selector and declarations.
127
+ </li>
128
+ <li>Declaration is a pair of property and value.
129
+ </li>
130
+ </ul>
131
+ <div class="output_caption">
132
+ Pseudo-EBNF syntax of presentation logic</div>
133
+ <pre class="output">plogic ::= ruleset*
134
+ ruleset ::= selector '{' [ declaration ';' ]* '}'
135
+ selector ::= '#' name
136
+ declaration ::= property ':' value
137
+ property ::= 'elem' | 'Elem' | 'ELEM'
138
+ | 'stag' | 'Stag' | 'STAG'
139
+ | 'etag' | 'Etag' | 'ETAG'
140
+ | 'cont' | 'Cont' | 'CONT'
141
+ | 'value' | 'Value' | 'VALUE'
142
+ | 'attrs' | 'Attrs' | 'ATTRS'
143
+ | 'append' | 'Append' | 'APPEND'
144
+ | 'remove'
145
+ | 'logic'
146
+ </pre>
147
+ <p>Notice that the tail semicolon of declaration is not omittable.
148
+ </p>
149
+ <a name="property-elem"></a>
150
+ <h3 class="section2">elem, Elem, ELEM</h3>
151
+ <p><code>elem:</code>, <code>Elem:</code>, and <code>ELEM:</code> properties replaces the element
152
+ with expression value.
153
+ </p>
154
+ <p><code>Elem:</code> always escape expression value while <code>ELEM:</code> never escape it.
155
+ <code>elem:</code> escapes when command-line option '-e' is specified or
156
+ configuration option 'PROPERTY_ESCAPE' is ture.
157
+ </p>
158
+ <a name="property-elem-eruby"></a>
159
+ <h4 class="section3">Ruby</h4>
160
+ <div class="program_caption">
161
+ presentation data (ex-elem.pdata)</div>
162
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
163
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
164
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
165
+ </pre>
166
+ <div class="program_caption">
167
+ presentation logic (ex-elem.plogic)</div>
168
+ <pre class="program">#name1 {
169
+ <b>elem:</b> user[:name];
170
+ }
171
+ #name2 {
172
+ <b>Elem:</b> user[:name];
173
+ }
174
+ #name3 {
175
+ <b>ELEM:</b> user[:name];
176
+ }
177
+ </pre>
178
+ <div class="terminal_caption">
179
+ compile</div>
180
+ <pre class="terminal">$ kwartz -l eruby -p ex-elem.plogic ex-elem.pdata
181
+ <b>&lt;%= user[:name] %&gt;</b>
182
+ <b>&lt;%=h user[:name] %&gt;</b>
183
+ <b>&lt;%= user[:name] %&gt;</b>
184
+ </pre>
185
+ <br>
186
+
187
+ <a name="property-elem-php"></a>
188
+ <h4 class="section3">PHP</h4>
189
+ <div class="program_caption">
190
+ presentation data (ex-elem.pdata)</div>
191
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
192
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
193
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
194
+ </pre>
195
+ <div class="program_caption">
196
+ presentation logic (ex-elem.plogic)</div>
197
+ <pre class="program">#name1 {
198
+ <b>elem:</b> $user['name'];
199
+ }
200
+ #name2 {
201
+ <b>Elem:</b> $user['name'];
202
+ }
203
+ #name3 {
204
+ <b>ELEM:</b> $user['name'];
205
+ }
206
+ </pre>
207
+ <div class="terminal_caption">
208
+ compile</div>
209
+ <pre class="terminal">$ kwartz -l php -p ex-elem.plogic ex-elem.pdata
210
+ <b>&lt;?php echo $user['name']; ?&gt;</b>
211
+ <b>&lt;?php echo htmlspecialchars($user['name']); ?&gt;</b>
212
+ <b>&lt;?php echo $user['name']; ?&gt;</b>
213
+ </pre>
214
+ <br>
215
+
216
+ <a name="property-elem-jstl"></a>
217
+ <h4 class="section3">JSP</h4>
218
+ <div class="program_caption">
219
+ presentation data (ex-elem.pdata)</div>
220
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
221
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
222
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
223
+ </pre>
224
+ <div class="program_caption">
225
+ presentation logic (ex-elem.plogic)</div>
226
+ <pre class="program">#name1 {
227
+ <b>elem:</b> user.name;
228
+ }
229
+ #name2 {
230
+ <b>Elem:</b> user.name;
231
+ }
232
+ #name3 {
233
+ <b>ELEM:</b> user.name;
234
+ }
235
+ </pre>
236
+ <div class="terminal_caption">
237
+ compile</div>
238
+ <pre class="terminal">$ kwartz -l jstl -p ex-elem.plogic ex-elem.pdata
239
+ &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
240
+ &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
241
+ <b>${user.name}</b>
242
+ <b>${user.name}</b>
243
+ <b>&lt;c:out value="${user.name}" escapeXml="false"/&gt;</b>
244
+ </pre>
245
+ <br>
246
+
247
+ <a name="property-elem-eperl"></a>
248
+ <h4 class="section3">Perl</h4>
249
+ <div class="program_caption">
250
+ presentation data (ex-elem.pdata)</div>
251
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
252
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
253
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
254
+ </pre>
255
+ <div class="program_caption">
256
+ presentation logic (ex-elem.plogic)</div>
257
+ <pre class="program">#name1 {
258
+ <b>elem:</b> $user{'name'};
259
+ }
260
+ #name2 {
261
+ <b>Elem:</b> $user{'name'};
262
+ }
263
+ #name3 {
264
+ <b>ELEM:</b> $user{'name'};
265
+ }
266
+ </pre>
267
+ <div class="terminal_caption">
268
+ compile</div>
269
+ <pre class="terminal">$ kwartz -l eperl -p ex-elem.plogic ex-elem.pdata
270
+ <b>&lt;?= $user{'name'} !&gt;</b>
271
+ <b>&lt;?= encode_entities($user{'name'}) !&gt;</b>
272
+ <b>&lt;?= $user{'name'} !&gt;</b>
273
+ </pre>
274
+ <br>
275
+
276
+ <br>
277
+
278
+
279
+ <a name="property-cont"></a>
280
+ <h3 class="section2">cont, Cont, CONT</h3>
281
+ <p><code>cont:</code>, <code>Cont:</code>, and <code>CONT:</code> properties replaces the element
282
+ with expression value.
283
+ </p>
284
+ <p><code>Cont:</code> always escape expression value while <code>CONT:</code> never escape it.
285
+ <code>cont:</code> escapes when command-line option '-e' is specified or
286
+ configuration option 'PROPERTY_ESCAPE' is ture.
287
+ </p>
288
+ <a name="property-cont-eruby"></a>
289
+ <h4 class="section3">Ruby</h4>
290
+ <div class="program_caption">
291
+ presentation data (ex-cont.pdata)</div>
292
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
293
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
294
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
295
+ </pre>
296
+ <div class="program_caption">
297
+ presentation logic (ex-cont.plogic)</div>
298
+ <pre class="program">#name1 {
299
+ <b>cont:</b> user[:name];
300
+ }
301
+ #name2 {
302
+ <b>Cont:</b> user[:name];
303
+ }
304
+ #name3 {
305
+ <b>CONT:</b> user[:name];
306
+ }
307
+ </pre>
308
+ <div class="terminal_caption">
309
+ compile</div>
310
+ <pre class="terminal">$ kwartz -l eruby -p ex-cont.plogic ex-cont.pdata
311
+ &lt;p&gt;<b>&lt;%= user[:name] %&gt;</b>&lt;/p&gt;
312
+ &lt;p&gt;<b>&lt;%=h user[:name] %&gt;</b>&lt;/p&gt;
313
+ &lt;p&gt;<b>&lt;%= user[:name] %&gt;</b>&lt;/p&gt;
314
+ </pre>
315
+ <br>
316
+
317
+ <a name="property-cont-php"></a>
318
+ <h4 class="section3">PHP</h4>
319
+ <div class="program_caption">
320
+ presentation data (ex-cont.pdata)</div>
321
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
322
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
323
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
324
+ </pre>
325
+ <div class="program_caption">
326
+ presentation logic (ex-cont.plogic)</div>
327
+ <pre class="program">#name1 {
328
+ <b>cont:</b> $user['name'];
329
+ }
330
+ #name2 {
331
+ <b>Cont:</b> $user['name'];
332
+ }
333
+ #name3 {
334
+ <b>CONT:</b> $user['name'];
335
+ }
336
+ </pre>
337
+ <div class="terminal_caption">
338
+ compile</div>
339
+ <pre class="terminal">$ kwartz -l php -p ex-cont.plogic ex-cont.pdata
340
+ &lt;p&gt;<b>&lt;?php echo $user['name']; ?&gt;</b>&lt;/p&gt;
341
+ &lt;p&gt;<b>&lt;?php echo htmlspecialchars($user['name']); ?&gt;</b>&lt;/p&gt;
342
+ &lt;p&gt;<b>&lt;?php echo $user['name']; ?&gt;</b>&lt;/p&gt;
343
+ </pre>
344
+ <br>
345
+
346
+ <a name="property-cont-jstl"></a>
347
+ <h4 class="section3">JSP</h4>
348
+ <div class="program_caption">
349
+ presentation data (ex-cont.pdata)</div>
350
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
351
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
352
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
353
+ </pre>
354
+ <div class="program_caption">
355
+ presentation logic (ex-cont.plogic)</div>
356
+ <pre class="program">#name1 {
357
+ <b>cont:</b> user.name;
358
+ }
359
+ #name2 {
360
+ <b>Cont:</b> user.name;
361
+ }
362
+ #name3 {
363
+ <b>CONT:</b> user.name;
364
+ }
365
+ </pre>
366
+ <div class="terminal_caption">
367
+ compile</div>
368
+ <pre class="terminal">$ kwartz -l jstl -p ex-cont.plogic ex-cont.pdata
369
+ &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
370
+ &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
371
+ &lt;p&gt;<b>${user.name}</b>&lt;/p&gt;
372
+ &lt;p&gt;<b>${user.name}</b>&lt;/p&gt;
373
+ &lt;p&gt;<b>&lt;c:out value="${user.name}" escapeXml="false"/&gt;</b>&lt;/p&gt;
374
+ </pre>
375
+ <br>
376
+
377
+ <a name="property-cont-eperl"></a>
378
+ <h4 class="section3">Perl</h4>
379
+ <div class="program_caption">
380
+ presentation data (ex-cont.pdata)</div>
381
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
382
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
383
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
384
+ </pre>
385
+ <div class="program_caption">
386
+ presentation logic (ex-cont.plogic)</div>
387
+ <pre class="program">#name1 {
388
+ <b>cont:</b> $user{'name'};
389
+ }
390
+ #name2 {
391
+ <b>Cont:</b> $user{'name'};
392
+ }
393
+ #name3 {
394
+ <b>CONT:</b> $user{'name'};
395
+ }
396
+ </pre>
397
+ <div class="terminal_caption">
398
+ compile</div>
399
+ <pre class="terminal">$ kwartz -l eperl -p ex-cont.plogic ex-cont.pdata
400
+ &lt;p&gt;<b>&lt;?= $user{'name'} !&gt;</b>&lt;/p&gt;
401
+ &lt;p&gt;<b>&lt;?= encode_entities($user{'name'}) !&gt;</b>&lt;/p&gt;
402
+ &lt;p&gt;<b>&lt;?= $user{'name'} !&gt;</b>&lt;/p&gt;
403
+ </pre>
404
+ <br>
405
+
406
+ <br>
407
+
408
+
409
+ <a name="property-value"></a>
410
+ <h3 class="section2">value, Value, VALUE</h3>
411
+ <p><code>value:</code>, <code>Value:</code>, and <code>VALUE:</code> properties replaces the element
412
+ with expression value.
413
+ These are the same as <code>cont:</code>, <code>Cont:</code>, and <code>CONT:</code> properties
414
+ respectively.
415
+ </p>
416
+ <a name="property-value-eruby"></a>
417
+ <h4 class="section3">Ruby</h4>
418
+ <div class="program_caption">
419
+ presentation data (ex-value.pdata)</div>
420
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
421
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
422
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
423
+ </pre>
424
+ <div class="program_caption">
425
+ presentation logic (ex-value.plogic)</div>
426
+ <pre class="program">#name1 {
427
+ <b>value:</b> user[:name];
428
+ }
429
+ #name2 {
430
+ <b>Value:</b> user[:name];
431
+ }
432
+ #name3 {
433
+ <b>VALUE:</b> user[:name];
434
+ }
435
+ </pre>
436
+ <div class="terminal_caption">
437
+ compile</div>
438
+ <pre class="terminal">$ kwartz -l eruby -p ex-value.plogic ex-value.pdata
439
+ &lt;p&gt;<b>&lt;%= user[:name] %&gt;</b>&lt;/p&gt;
440
+ &lt;p&gt;<b>&lt;%=h user[:name] %&gt;</b>&lt;/p&gt;
441
+ &lt;p&gt;<b>&lt;%= user[:name] %&gt;</b>&lt;/p&gt;
442
+ </pre>
443
+ <br>
444
+
445
+ <a name="property-value-php"></a>
446
+ <h4 class="section3">PHP</h4>
447
+ <div class="program_caption">
448
+ presentation data (ex-value.pdata)</div>
449
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
450
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
451
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
452
+ </pre>
453
+ <div class="program_caption">
454
+ presentation logic (ex-value.plogic)</div>
455
+ <pre class="program">#name1 {
456
+ <b>value:</b> $user['name'];
457
+ }
458
+ #name2 {
459
+ <b>Value:</b> $user['name'];
460
+ }
461
+ #name3 {
462
+ <b>VALUE:</b> $user['name'];
463
+ }
464
+ </pre>
465
+ <div class="terminal_caption">
466
+ compile</div>
467
+ <pre class="terminal">$ kwartz -l php -p ex-value.plogic ex-value.pdata
468
+ &lt;p&gt;<b>&lt;?php echo $user['name']; ?&gt;</b>&lt;/p&gt;
469
+ &lt;p&gt;<b>&lt;?php echo htmlspecialchars($user['name']); ?&gt;</b>&lt;/p&gt;
470
+ &lt;p&gt;<b>&lt;?php echo $user['name']; ?&gt;</b>&lt;/p&gt;
471
+ </pre>
472
+ <br>
473
+
474
+ <a name="property-value-jstl"></a>
475
+ <h4 class="section3">JSP</h4>
476
+ <div class="program_caption">
477
+ presentation data (ex-value.pdata)</div>
478
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
479
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
480
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
481
+ </pre>
482
+ <div class="program_caption">
483
+ presentation logic (ex-value.plogic)</div>
484
+ <pre class="program">#name1 {
485
+ <b>value:</b> user.name;
486
+ }
487
+ #name2 {
488
+ <b>Value:</b> user.name;
489
+ }
490
+ #name3 {
491
+ <b>VALUE:</b> user.name;
492
+ }
493
+ </pre>
494
+ <div class="terminal_caption">
495
+ compile</div>
496
+ <pre class="terminal">$ kwartz -l jstl -p ex-value.plogic ex-value.pdata
497
+ &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
498
+ &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
499
+ &lt;p&gt;<b>${user.name}</b>&lt;/p&gt;
500
+ &lt;p&gt;<b>${user.name}</b>&lt;/p&gt;
501
+ &lt;p&gt;<b>&lt;c:out value="${user.name}" escapeXml="false"/&gt;</b>&lt;/p&gt;
502
+ </pre>
503
+ <br>
504
+
505
+ <a name="property-value-eperl"></a>
506
+ <h4 class="section3">Perl</h4>
507
+ <div class="program_caption">
508
+ presentation data (ex-value.pdata)</div>
509
+ <pre class="program">&lt;p id="mark:name1"&gt;aaa&lt;/p&gt;
510
+ &lt;p id="mark:name2"&gt;bbb&lt;/p&gt;
511
+ &lt;p id="mark:name3"&gt;ccc&lt;/p&gt;
512
+ </pre>
513
+ <div class="program_caption">
514
+ presentation logic (ex-value.plogic)</div>
515
+ <pre class="program">#name1 {
516
+ <b>value:</b> $user{'name'};
517
+ }
518
+ #name2 {
519
+ <b>Value:</b> $user{'name'};
520
+ }
521
+ #name3 {
522
+ <b>VALUE:</b> $user{'name'};
523
+ }
524
+ </pre>
525
+ <div class="terminal_caption">
526
+ compile</div>
527
+ <pre class="terminal">$ kwartz -l eperl -p ex-value.plogic ex-value.pdata
528
+ &lt;p&gt;<b>&lt;?= $user{'name'} !&gt;</b>&lt;/p&gt;
529
+ &lt;p&gt;<b>&lt;?= encode_entities($user{'name'}) !&gt;</b>&lt;/p&gt;
530
+ &lt;p&gt;<b>&lt;?= $user{'name'} !&gt;</b>&lt;/p&gt;
531
+ </pre>
532
+ <br>
533
+
534
+ <br>
535
+
536
+
537
+ <a name="property-stag"></a>
538
+ <h3 class="section2">stag, Stag, STAG</h3>
539
+ <p><code>stage:</code>, <code>Stag:</code>, and <code>STAG:</code> properties replaces the start-tag
540
+ with expression value.
541
+ </p>
542
+ <p><code>Stag:</code> always escape expression value while <code>STAG:</code> never escape it.
543
+ <code>stag:</code> escapes when command-line option '-e' is specified or
544
+ configuration option 'PROPERTY_ESCAPE' is ture.
545
+ </p>
546
+ <a name="property-stag-eruby"></a>
547
+ <h4 class="section3">Ruby</h4>
548
+ <div class="program_caption">
549
+ presentation data (ex-stag.pdata)</div>
550
+ <pre class="program">&lt;a href="#" id="mark:link1"&gt;&lt;img src="button1.png"&gt;&lt;/a&gt;
551
+ &lt;a href="#" id="mark:link2"&gt;&lt;img src="button2.png"&gt;&lt;/a&gt;
552
+ &lt;a href="#" id="mark:link3"&gt;&lt;img src="button3.png"&gt;&lt;/a&gt;
553
+ </pre>
554
+ <div class="program_caption">
555
+ presentation logic (ex-stag.plogic)</div>
556
+ <pre class="program">#link1 {
557
+ <b>stag:</b> start_link_to :action=&gt;'list';
558
+ }
559
+ #link2 {
560
+ <b>Stag:</b> start_link_to :action=&gt;'list';
561
+ }
562
+ #link3 {
563
+ <b>STAG:</b> start_link_to :action=&gt;'list';
564
+ }
565
+ </pre>
566
+ <div class="terminal_caption">
567
+ compile</div>
568
+ <pre class="terminal">$ kwartz -l eruby -p ex-stag.plogic ex-stag.pdata
569
+ <b>&lt;%= start_link_to :action=&gt;'list' %&gt;</b>&lt;img src="button1.png"&gt;&lt;/a&gt;
570
+ <b>&lt;%=h start_link_to :action=&gt;'list' %&gt;</b>&lt;img src="button2.png"&gt;&lt;/a&gt;
571
+ <b>&lt;%= start_link_to :action=&gt;'list' %&gt;</b>&lt;img src="button3.png"&gt;&lt;/a&gt;
572
+ </pre>
573
+ <br>
574
+
575
+ <a name="property-stag-php"></a>
576
+ <h4 class="section3">PHP</h4>
577
+ <div class="program_caption">
578
+ presentation data (ex-stag.pdata)</div>
579
+ <pre class="program">&lt;a href="#" id="mark:link1"&gt;&lt;img src="button1.png"&gt;&lt;/a&gt;
580
+ &lt;a href="#" id="mark:link2"&gt;&lt;img src="button2.png"&gt;&lt;/a&gt;
581
+ &lt;a href="#" id="mark:link3"&gt;&lt;img src="button3.png"&gt;&lt;/a&gt;
582
+ </pre>
583
+ <div class="program_caption">
584
+ presentation logic (ex-stag.plogic)</div>
585
+ <pre class="program">#link1 {
586
+ <b>stag:</b> start_link_to('list');
587
+ }
588
+ #link2 {
589
+ <b>Stag:</b> start_link_to('list');
590
+ }
591
+ #link3 {
592
+ <b>STAG:</b> start_link_to('list');
593
+ }
594
+ </pre>
595
+ <div class="terminal_caption">
596
+ compile</div>
597
+ <pre class="terminal">$ kwartz -l php -p ex-stag.plogic ex-stag.pdata
598
+ <b>&lt;?php echo start_link_to('list'); ?&gt;</b>&lt;img src="button1.png"&gt;&lt;/a&gt;
599
+ <b>&lt;?php echo htmlspecialchars(start_link_to('list')); ?&gt;</b>&lt;img src="button2.png"&gt;&lt;/a&gt;
600
+ <b>&lt;?php echo start_link_to('list'); ?&gt;</b>&lt;img src="button3.png"&gt;&lt;/a&gt;
601
+ </pre>
602
+ <br>
603
+
604
+ <a name="property-stag-jstl"></a>
605
+ <h4 class="section3">JSP</h4>
606
+ <div class="program_caption">
607
+ presentation data (ex-stag.pdata)</div>
608
+ <pre class="program">&lt;a href="#" id="mark:link1"&gt;&lt;img src="button1.png"&gt;&lt;/a&gt;
609
+ &lt;a href="#" id="mark:link2"&gt;&lt;img src="button2.png"&gt;&lt;/a&gt;
610
+ &lt;a href="#" id="mark:link3"&gt;&lt;img src="button3.png"&gt;&lt;/a&gt;
611
+ </pre>
612
+ <div class="program_caption">
613
+ presentation logic (ex-stag.plogic)</div>
614
+ <pre class="program">#link1 {
615
+ <b>stag:</b> fn:start_link_to('list');
616
+ }
617
+ #link2 {
618
+ <b>Stag:</b> fn:start_link_to('list');
619
+ }
620
+ #link3 {
621
+ <b>STAG:</b> fn:start_link_to('list');
622
+ }
623
+ </pre>
624
+ <div class="terminal_caption">
625
+ compile</div>
626
+ <pre class="terminal">$ kwartz -l jstl -p ex-stag.plogic ex-stag.pdata
627
+ &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
628
+ &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
629
+ <b>${fn:start_link_to('list')}</b>&lt;img src="button1.png"&gt;&lt;/a&gt;
630
+ <b>${fn:start_link_to('list')}</b>&lt;img src="button2.png"&gt;&lt;/a&gt;
631
+ <b>&lt;c:out value="${fn:start_link_to('list')}" escapeXml="false"/&gt;</b>&lt;img src="button3.png"&gt;&lt;/a&gt;
632
+ </pre>
633
+ <br>
634
+
635
+ <a name="property-stag-eperl"></a>
636
+ <h4 class="section3">Perl</h4>
637
+ <div class="program_caption">
638
+ presentation data (ex-stag.pdata)</div>
639
+ <pre class="program">&lt;a href="#" id="mark:link1"&gt;&lt;img src="button1.png"&gt;&lt;/a&gt;
640
+ &lt;a href="#" id="mark:link2"&gt;&lt;img src="button2.png"&gt;&lt;/a&gt;
641
+ &lt;a href="#" id="mark:link3"&gt;&lt;img src="button3.png"&gt;&lt;/a&gt;
642
+ </pre>
643
+ <div class="program_caption">
644
+ presentation logic (ex-stag.plogic)</div>
645
+ <pre class="program">#link1 {
646
+ <b>stag:</b> start_link_to('list');
647
+ }
648
+ #link2 {
649
+ <b>Stag:</b> start_link_to('list');
650
+ }
651
+ #link3 {
652
+ <b>STAG:</b> start_link_to('list');
653
+ }
654
+ </pre>
655
+ <div class="terminal_caption">
656
+ compile</div>
657
+ <pre class="terminal">$ kwartz -l eperl -p ex-stag.plogic ex-stag.pdata
658
+ <b>&lt;?= start_link_to('list') !&gt;</b>&lt;img src="button1.png"&gt;&lt;/a&gt;
659
+ <b>&lt;?= encode_entities(start_link_to('list')) !&gt;</b>&lt;img src="button2.png"&gt;&lt;/a&gt;
660
+ <b>&lt;?= start_link_to('list') !&gt;</b>&lt;img src="button3.png"&gt;&lt;/a&gt;
661
+ </pre>
662
+ <br>
663
+
664
+ <br>
665
+
666
+
667
+ <a name="property-etag"></a>
668
+ <h3 class="section2">etag, Etag, ETAG</h3>
669
+ <p><code>stage:</code>, <code>Etag:</code>, and <code>ETAG:</code> properties replaces the end-tag
670
+ with expression value.
671
+ </p>
672
+ <p><code>Etag:</code> always escape expression value while <code>ETAG:</code> never escape it.
673
+ <code>etag:</code> escapes when command-line option '-e' is specified or
674
+ configuration option 'PROPERTY_ESCAPE' is ture.
675
+ </p>
676
+ <a name="property-etag-eruby"></a>
677
+ <h4 class="section3">Ruby</h4>
678
+ <div class="program_caption">
679
+ presentation data (ex-etag.pdata)</div>
680
+ <pre class="program">&lt;li id="mark:item1"&gt;foo&lt;/li&gt;
681
+ &lt;li id="mark:item2"&gt;bar&lt;/li&gt;
682
+ &lt;li id="mark:item3"&gt;baz&lt;/li&gt;
683
+ </pre>
684
+ <div class="program_caption">
685
+ presentation logic (ex-etag.plogic)</div>
686
+ <pre class="program">#item1 {
687
+ <b>etag:</b> is_xml ? '&lt;/li&gt;' : '';
688
+ }
689
+ #item2 {
690
+ <b>Etag:</b> is_xml ? '&lt;/li&gt;' : '';
691
+ }
692
+ #item3 {
693
+ <b>ETAG:</b> is_xml ? '&lt;/li&gt;' : '';
694
+ }
695
+ </pre>
696
+ <div class="terminal_caption">
697
+ compile</div>
698
+ <pre class="terminal">$ kwartz -l eruby -p ex-etag.plogic ex-etag.pdata
699
+ &lt;li&gt;foo<b>&lt;%= is_xml ? '&lt;/li&gt;' : '' %&gt;</b>
700
+ &lt;li&gt;bar<b>&lt;%=h is_xml ? '&lt;/li&gt;' : '' %&gt;</b>
701
+ &lt;li&gt;baz<b>&lt;%= is_xml ? '&lt;/li&gt;' : '' %&gt;</b>
702
+ </pre>
703
+ <br>
704
+
705
+ <a name="property-etag-php"></a>
706
+ <h4 class="section3">PHP</h4>
707
+ <div class="program_caption">
708
+ presentation data (ex-etag.pdata)</div>
709
+ <pre class="program">&lt;li id="mark:item1"&gt;foo&lt;/li&gt;
710
+ &lt;li id="mark:item2"&gt;bar&lt;/li&gt;
711
+ &lt;li id="mark:item3"&gt;baz&lt;/li&gt;
712
+ </pre>
713
+ <div class="program_caption">
714
+ presentation logic (ex-etag.plogic)</div>
715
+ <pre class="program">#item1 {
716
+ <b>etag:</b> $is_xml ? '&lt;/li&gt;' : '';
717
+ }
718
+ #item2 {
719
+ <b>Etag:</b> $is_xml ? '&lt;/li&gt;' : '';
720
+ }
721
+ #item3 {
722
+ <b>ETAG:</b> $is_xml ? '&lt;/li&gt;' : '';
723
+ }
724
+ </pre>
725
+ <div class="terminal_caption">
726
+ compile</div>
727
+ <pre class="terminal">$ kwartz -l php -p ex-etag.plogic ex-etag.pdata
728
+ &lt;li&gt;foo<b>&lt;?php echo $is_xml ? '&lt;/li&gt;' : ''; ?&gt;</b>
729
+ &lt;li&gt;bar<b>&lt;?php echo htmlspecialchars($is_xml ? '&lt;/li&gt;' : ''); ?&gt;</b>
730
+ &lt;li&gt;baz<b>&lt;?php echo $is_xml ? '&lt;/li&gt;' : ''; ?&gt;</b>
731
+ </pre>
732
+ <br>
733
+
734
+ <a name="property-etag-jstl"></a>
735
+ <h4 class="section3">JSP</h4>
736
+ <div class="program_caption">
737
+ presentation data (ex-etag.pdata)</div>
738
+ <pre class="program">&lt;li id="mark:item1"&gt;foo&lt;/li&gt;
739
+ &lt;li id="mark:item2"&gt;bar&lt;/li&gt;
740
+ &lt;li id="mark:item3"&gt;baz&lt;/li&gt;
741
+ </pre>
742
+ <div class="program_caption">
743
+ presentation logic (ex-etag.plogic)</div>
744
+ <pre class="program">#item1 {
745
+ <b>etag:</b> is_xml ? '&lt;/li&gt;' : '';
746
+ }
747
+ #item2 {
748
+ <b>Etag:</b> is_xml ? '&lt;/li&gt;' : '';
749
+ }
750
+ #item3 {
751
+ <b>ETAG:</b> is_xml ? '&lt;/li&gt;' : '';
752
+ }
753
+ </pre>
754
+ <div class="terminal_caption">
755
+ compile</div>
756
+ <pre class="terminal">$ kwartz -l jstl -p ex-etag.plogic ex-etag.pdata
757
+ &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
758
+ &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
759
+ &lt;li&gt;foo<b>${is_xml ? '&lt;/li&gt;' : ''}</b>
760
+ &lt;li&gt;bar<b>${is_xml ? '&lt;/li&gt;' : ''}</b>
761
+ &lt;li&gt;baz<b>&lt;c:out value="${is_xml ? '&lt;/li&gt;' : ''}" escapeXml="false"/&gt;</b>
762
+ </pre>
763
+ <br>
764
+
765
+ <a name="property-etag-eperl"></a>
766
+ <h4 class="section3">Perl</h4>
767
+ <div class="program_caption">
768
+ presentation data (ex-etag.pdata)</div>
769
+ <pre class="program">&lt;li id="mark:item1"&gt;foo&lt;/li&gt;
770
+ &lt;li id="mark:item2"&gt;bar&lt;/li&gt;
771
+ &lt;li id="mark:item3"&gt;baz&lt;/li&gt;
772
+ </pre>
773
+ <div class="program_caption">
774
+ presentation logic (ex-etag.plogic)</div>
775
+ <pre class="program">#item1 {
776
+ <b>etag:</b> $is_xml ? '&lt;/li&gt;' : '';
777
+ }
778
+ #item2 {
779
+ <b>Etag:</b> $is_xml ? '&lt;/li&gt;' : '';
780
+ }
781
+ #item3 {
782
+ <b>ETAG:</b> $is_xml ? '&lt;/li&gt;' : '';
783
+ }
784
+ </pre>
785
+ <div class="terminal_caption">
786
+ compile</div>
787
+ <pre class="terminal">$ kwartz -l eperl -p ex-etag.plogic ex-etag.pdata
788
+ &lt;li&gt;foo<b>&lt;?= $is_xml ? '&lt;/li&gt;' : '' !&gt;</b>
789
+ &lt;li&gt;bar<b>&lt;?= encode_entities($is_xml ? '&lt;/li&gt;' : '') !&gt;</b>
790
+ &lt;li&gt;baz<b>&lt;?= $is_xml ? '&lt;/li&gt;' : '' !&gt;</b>
791
+ </pre>
792
+ <br>
793
+
794
+ <br>
795
+
796
+
797
+ <a name="property-attrs"></a>
798
+ <h3 class="section2">attrs, Attrs, ATTRS</h3>
799
+ <p><code>attrs:</code>, <code>Attrs:</code>, <code>ATTRS:</code>, property replaces or adds attributes.
800
+ </p>
801
+ <p><code>Attrs:</code> always escape expression value while <code>ATTRS:</code> never escape it.
802
+ <code>attrs:</code> escapes when command-line option '-e' is specified or
803
+ configuration option 'PROPERTY_ESCAPE' is ture.
804
+ </p>
805
+ <p>Notice that the follwing will be parse error
806
+ because Kwartz parses <code>attrs:</code> property with pattern matching.
807
+ </p>
808
+ <pre class="program">#foo {
809
+ attrs: 'class' klass, 'style' style;
810
+ }
811
+ </pre>
812
+ <a name="property-attrs-eruby"></a>
813
+ <h4 class="section3">Ruby</h4>
814
+ <div class="program_caption">
815
+ presentation data (ex-attrs.pdata)</div>
816
+ <pre class="program">&lt;p id="mark:item" class="para"&gt;
817
+ AAA
818
+ &lt;/p&gt;
819
+ </pre>
820
+ <div class="program_caption">
821
+ presentation logic (ex-attrs.plogic)</div>
822
+ <pre class="program">#item {
823
+ <b>attrs:</b> 'class' klass,
824
+ 'style' style;
825
+ }
826
+ </pre>
827
+ <div class="terminal_caption">
828
+ compile</div>
829
+ <pre class="terminal">$ kwartz -l eruby -p ex-attrs.plogic ex-attrs.pdata
830
+ &lt;p <b>class="&lt;%= klass %&gt;"</b> <b>style="&lt;%= style %&gt;"</b>&gt;
831
+ AAA
832
+ &lt;/p&gt;
833
+ </pre>
834
+ <br>
835
+
836
+ <a name="property-attrs-php"></a>
837
+ <h4 class="section3">PHP</h4>
838
+ <div class="program_caption">
839
+ presentation data (ex-attrs.pdata)</div>
840
+ <pre class="program">&lt;p id="mark:item" class="para"&gt;
841
+ AAA
842
+ &lt;/p&gt;
843
+ </pre>
844
+ <div class="program_caption">
845
+ presentation logic (ex-attrs.plogic)</div>
846
+ <pre class="program">#item {
847
+ <b>attrs:</b> 'class' $class,
848
+ 'style' $style;
849
+ }
850
+ </pre>
851
+ <div class="terminal_caption">
852
+ compile</div>
853
+ <pre class="terminal">$ kwartz -l php -p ex-attrs.plogic ex-attrs.pdata
854
+ &lt;p <b>class="&lt;?php echo $class; ?&gt;"</b> <b>style="&lt;?php echo $style; ?&gt;"</b>&gt;
855
+ AAA
856
+ &lt;/p&gt;
857
+ </pre>
858
+ <br>
859
+
860
+ <a name="property-attrs-jstl"></a>
861
+ <h4 class="section3">JSP</h4>
862
+ <div class="program_caption">
863
+ presentation data (ex-attrs.pdata)</div>
864
+ <pre class="program">&lt;p id="mark:item" class="para"&gt;
865
+ AAA
866
+ &lt;/p&gt;
867
+ </pre>
868
+ <div class="program_caption">
869
+ presentation logic (ex-attrs.plogic)</div>
870
+ <pre class="program">#item {
871
+ <b>attrs:</b> 'class' klass,
872
+ 'style' style;
873
+ }
874
+ </pre>
875
+ <div class="terminal_caption">
876
+ compile</div>
877
+ <pre class="terminal">$ kwartz -l jstl -p ex-attrs.plogic ex-attrs.pdata
878
+ &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
879
+ &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
880
+ &lt;p <b>class="${klass}"</b> <b>style="${style}"</b>&gt;
881
+ AAA
882
+ &lt;/p&gt;
883
+ </pre>
884
+ <br>
885
+
886
+ <a name="property-attrs-eperl"></a>
887
+ <h4 class="section3">Perl</h4>
888
+ <div class="program_caption">
889
+ presentation data (ex-attrs.pdata)</div>
890
+ <pre class="program">&lt;p id="mark:item" class="para"&gt;
891
+ AAA
892
+ &lt;/p&gt;
893
+ </pre>
894
+ <div class="program_caption">
895
+ presentation logic (ex-attrs.plogic)</div>
896
+ <pre class="program">#item {
897
+ <b>attrs:</b> 'class' $class,
898
+ 'style' $style;
899
+ }
900
+ </pre>
901
+ <div class="terminal_caption">
902
+ compile</div>
903
+ <pre class="terminal">$ kwartz -l eperl -p ex-attrs.plogic ex-attrs.pdata
904
+ &lt;p <b>class="&lt;?= $class !&gt;"</b> <b>style="&lt;?= $style !&gt;"</b>&gt;
905
+ AAA
906
+ &lt;/p&gt;
907
+ </pre>
908
+ <br>
909
+
910
+ <br>
911
+
912
+
913
+ <a name="property-append"></a>
914
+ <h3 class="section2">append, Append, APPEND</h3>
915
+ <p><code>append:</code>, <code>Append:</code>, <code>APPEND:</code> directive appends
916
+ expressions to the start tag.
917
+ </p>
918
+ <p><code>Append:</code> always escape expression value while <code>APPEND:</code> never escape it.
919
+ <code>append:</code> escapes when command-line option '-e' is specified or
920
+ configuration option 'PROPERTY_ESCAPE' is ture.
921
+ </p>
922
+ <p>The following is an example to append several expressions.
923
+ </p>
924
+ <pre class="program">#remember {
925
+ append: expr1,
926
+ expr2,
927
+ expr3;
928
+ }
929
+ </pre>
930
+ <p>Notice that the following will be parse error.
931
+ </p>
932
+ <pre class="program">#remember {
933
+ append: expr1, expr2, expr3;
934
+ }
935
+ </pre>
936
+ <a name="property-append-eruby"></a>
937
+ <h4 class="section3">Ruby</h4>
938
+ <div class="program_caption">
939
+ presentation data (ex-append.pdata)</div>
940
+ <pre class="program">&lt;input type="checkboxk" id="mark:remember" value="y"&gt;Remeber me
941
+ </pre>
942
+ <div class="program_caption">
943
+ presentation logic (ex-append.plogic)</div>
944
+ <pre class="program">#remember {
945
+ <b>append:</b> flag ? ' checked' : '';
946
+ }
947
+ </pre>
948
+ <div class="terminal_caption">
949
+ compile</div>
950
+ <pre class="terminal">$ kwartz -l eruby -p ex-append.plogic ex-append.pdata
951
+ &lt;input type="checkboxk" value="y"<b>&lt;%= flag ? ' checked' : '' %&gt;</b>&gt;Remeber me
952
+ </pre>
953
+ <br>
954
+
955
+ <a name="property-append-php"></a>
956
+ <h4 class="section3">PHP</h4>
957
+ <div class="program_caption">
958
+ presentation data (ex-append.pdata)</div>
959
+ <pre class="program">&lt;input type="checkboxk" id="mark:remember" value="y"&gt;Remeber me
960
+ </pre>
961
+ <div class="program_caption">
962
+ presentation logic (ex-append.plogic)</div>
963
+ <pre class="program">#remember {
964
+ <b>append:</b> $flag ? ' checked' : '';
965
+ }
966
+ </pre>
967
+ <div class="terminal_caption">
968
+ compile</div>
969
+ <pre class="terminal">$ kwartz -l php -p ex-append.plogic ex-append.pdata
970
+ &lt;input type="checkboxk" value="y"<b>&lt;?php echo $flag ? ' checked' : ''; ?&gt;</b>&gt;Remeber me
971
+ </pre>
972
+ <br>
973
+
974
+ <a name="property-append-jstl"></a>
975
+ <h4 class="section3">JSP</h4>
976
+ <div class="program_caption">
977
+ presentation data (ex-append.pdata)</div>
978
+ <pre class="program">&lt;input type="checkboxk" id="mark:remember" value="y"&gt;Remeber me
979
+ </pre>
980
+ <div class="program_caption">
981
+ presentation logic (ex-append.plogic)</div>
982
+ <pre class="program">#remember {
983
+ <b>append:</b> flag ? ' checked' : '';
984
+ }
985
+ </pre>
986
+ <div class="terminal_caption">
987
+ compile</div>
988
+ <pre class="terminal">$ kwartz -l jstl -p ex-append.plogic ex-append.pdata
989
+ &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
990
+ &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
991
+ &lt;input type="checkboxk" value="y"<b>${flag ? ' checked' : ''}</b>&gt;Remeber me
992
+ </pre>
993
+ <br>
994
+
995
+ <a name="property-append-eperl"></a>
996
+ <h4 class="section3">Perl</h4>
997
+ <div class="program_caption">
998
+ presentation data (ex-append.pdata)</div>
999
+ <pre class="program">&lt;input type="checkboxk" id="mark:remember" value="y"&gt;Remeber me
1000
+ </pre>
1001
+ <div class="program_caption">
1002
+ presentation logic (ex-append.plogic)</div>
1003
+ <pre class="program">#remember {
1004
+ <b>append:</b> $flag ? ' checked' : '';
1005
+ }
1006
+ </pre>
1007
+ <div class="terminal_caption">
1008
+ compile</div>
1009
+ <pre class="terminal">$ kwartz -l eperl -p ex-append.plogic ex-append.pdata
1010
+ &lt;input type="checkboxk" value="y"<b>&lt;?= $flag ? ' checked' : '' !&gt;</b>&gt;Remeber me
1011
+ </pre>
1012
+ <br>
1013
+
1014
+ <br>
1015
+
1016
+
1017
+ <a name="property-remove"></a>
1018
+ <h3 class="section2">remove</h3>
1019
+ <p><code>remove:</code> property removes attributes.
1020
+ </p>
1021
+ <a name="property-remove-eruby"></a>
1022
+ <h4 class="section3">Ruby</h4>
1023
+ <div class="program_caption">
1024
+ presentation data (ex-remove.pdata)</div>
1025
+ <pre class="program">&lt;p id="foo" class="paragraph" style="color: red"&gt;
1026
+ AAA
1027
+ &lt;/p&gt;
1028
+ </pre>
1029
+ <div class="program_caption">
1030
+ presentation logic (ex-remove.plogic)</div>
1031
+ <pre class="program">#foo {
1032
+ <b>remove:</b> 'id', 'style';
1033
+ }
1034
+ </pre>
1035
+ <div class="terminal_caption">
1036
+ compile</div>
1037
+ <pre class="terminal">$ kwartz -l eruby -p ex-remove.plogic ex-remove.pdata
1038
+ &lt;p class="paragraph"&gt;
1039
+ AAA
1040
+ &lt;/p&gt;
1041
+ </pre>
1042
+ <br>
1043
+
1044
+ <a name="property-remove-php"></a>
1045
+ <h4 class="section3">PHP</h4>
1046
+ <div class="program_caption">
1047
+ presentation data (ex-remove.pdata)</div>
1048
+ <pre class="program">&lt;p id="foo" class="paragraph" style="color: red"&gt;
1049
+ AAA
1050
+ &lt;/p&gt;
1051
+ </pre>
1052
+ <div class="program_caption">
1053
+ presentation logic (ex-remove.plogic)</div>
1054
+ <pre class="program">#foo {
1055
+ <b>remove:</b> 'id', 'style';
1056
+ }
1057
+ </pre>
1058
+ <div class="terminal_caption">
1059
+ compile</div>
1060
+ <pre class="terminal">$ kwartz -l php -p ex-remove.plogic ex-remove.pdata
1061
+ &lt;p class="paragraph"&gt;
1062
+ AAA
1063
+ &lt;/p&gt;
1064
+ </pre>
1065
+ <br>
1066
+
1067
+ <a name="property-remove-jstl"></a>
1068
+ <h4 class="section3">JSP</h4>
1069
+ <div class="program_caption">
1070
+ presentation data (ex-remove.pdata)</div>
1071
+ <pre class="program">&lt;p id="foo" class="paragraph" style="color: red"&gt;
1072
+ AAA
1073
+ &lt;/p&gt;
1074
+ </pre>
1075
+ <div class="program_caption">
1076
+ presentation logic (ex-remove.plogic)</div>
1077
+ <pre class="program">#foo {
1078
+ <b>remove:</b> 'id', 'style';
1079
+ }
1080
+ </pre>
1081
+ <div class="terminal_caption">
1082
+ compile</div>
1083
+ <pre class="terminal">$ kwartz -l jstl -p ex-remove.plogic ex-remove.pdata
1084
+ &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
1085
+ &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
1086
+ &lt;p class="paragraph"&gt;
1087
+ AAA
1088
+ &lt;/p&gt;
1089
+ </pre>
1090
+ <br>
1091
+
1092
+ <a name="property-remove-eperl"></a>
1093
+ <h4 class="section3">Perl</h4>
1094
+ <div class="program_caption">
1095
+ presentation data (ex-remove.pdata)</div>
1096
+ <pre class="program">&lt;p id="foo" class="paragraph" style="color: red"&gt;
1097
+ AAA
1098
+ &lt;/p&gt;
1099
+ </pre>
1100
+ <div class="program_caption">
1101
+ presentation logic (ex-remove.plogic)</div>
1102
+ <pre class="program">#foo {
1103
+ <b>remove:</b> 'id', 'style';
1104
+ }
1105
+ </pre>
1106
+ <div class="terminal_caption">
1107
+ compile</div>
1108
+ <pre class="terminal">$ kwartz -l eperl -p ex-remove.plogic ex-remove.pdata
1109
+ &lt;p class="paragraph"&gt;
1110
+ AAA
1111
+ &lt;/p&gt;
1112
+ </pre>
1113
+ <br>
1114
+
1115
+ <br>
1116
+
1117
+
1118
+ <a name="property-logic"></a>
1119
+ <h3 class="section2">logic</h3>
1120
+ <p><code>logic:</code> property represents the presentation logic body of the element.
1121
+ In the <code>logic:</code> property, the folllowings are available.
1122
+ </p>
1123
+ <dl class="dl3">
1124
+ <dt class="dt3"><b>
1125
+ <code>_elem</code> </b></dt>
1126
+ <dd class="dd3">
1127
+ represents the element
1128
+ </dd>
1129
+ <dt class="dt3"><b>
1130
+ <code>_stag</code> </b></dt>
1131
+ <dd class="dd3">
1132
+ represents start-tag of the element
1133
+ </dd>
1134
+ <dt class="dt3"><b>
1135
+ <code>_cont</code> </b></dt>
1136
+ <dd class="dd3">
1137
+ represents content of the element
1138
+ </dd>
1139
+ <dt class="dt3"><b>
1140
+ <code>_stag</code> </b></dt>
1141
+ <dd class="dd3">
1142
+ represents end-tag of the element
1143
+ </dd>
1144
+ <dt class="dt3"><b>
1145
+ <code>_element(<i>name</i>)</code> </b></dt>
1146
+ <dd class="dd3">
1147
+ represents the other element marked as <i>name</i>.
1148
+ </dd>
1149
+ <dt class="dt3"><b>
1150
+ <code>_content(<i>name</i>)</code> </b></dt>
1151
+ <dd class="dd3">
1152
+ represents the content of other element marked as <i>name</i>.
1153
+ </dd>
1154
+ </dl>
1155
+ <p>In the <code>logic:</code> property, it is able to write statements in target language
1156
+ (Ruby, PHP, Java, Perl, and so on).
1157
+ </p>
1158
+ <a name="property-logic-eruby"></a>
1159
+ <h4 class="section3">Ruby</h4>
1160
+ <div class="program_caption">
1161
+ presentation data (ex-logic.pdata)</div>
1162
+ <pre class="program">&lt;ul&gt;
1163
+ &lt;li id="mark:items"&gt;AAA&lt;/li&gt;
1164
+ &lt;/ul&gt;
1165
+ </pre>
1166
+ <div class="program_caption">
1167
+ presentation logic (ex-logic.plogic)</div>
1168
+ <pre class="program">#items {
1169
+ value: item;
1170
+ <b>logic:</b> {
1171
+ @list.each do |item|
1172
+ <b>_stag</b>
1173
+ <b>_cont</b>
1174
+ <b>_etag</b>
1175
+ end
1176
+ }
1177
+ }
1178
+ </pre>
1179
+ <div class="terminal_caption">
1180
+ compile</div>
1181
+ <pre class="terminal">$ kwartz -l eruby -p ex-logic.plogic ex-logic.pdata
1182
+ &lt;ul&gt;
1183
+ <b>&lt;% @list.each do |item| %&gt;</b>
1184
+ &lt;li&gt;&lt;%= item %&gt;&lt;/li&gt;
1185
+ <b>&lt;% end %&gt;</b>
1186
+ &lt;/ul&gt;
1187
+ </pre>
1188
+ <br>
1189
+
1190
+ <a name="property-logic-php"></a>
1191
+ <h4 class="section3">PHP</h4>
1192
+ <div class="program_caption">
1193
+ presentation data (ex-logic.pdata)</div>
1194
+ <pre class="program">&lt;ul&gt;
1195
+ &lt;li id="mark:items"&gt;AAA&lt;/li&gt;
1196
+ &lt;/ul&gt;
1197
+ </pre>
1198
+ <div class="program_caption">
1199
+ presentation logic (ex-logic.plogic)</div>
1200
+ <pre class="program">#items {
1201
+ value: $item;
1202
+ <b>logic:</b> {
1203
+ foreach ($list as $item) {
1204
+ <b>_stag();</b>
1205
+ <b>_cont();</b>
1206
+ <b>_etag();</b>
1207
+ }
1208
+ }
1209
+ }
1210
+ </pre>
1211
+ <div class="terminal_caption">
1212
+ compile</div>
1213
+ <pre class="terminal">$ kwartz -l php -p ex-logic.plogic ex-logic.pdata
1214
+ &lt;ul&gt;
1215
+ <b>&lt;?php foreach ($list as $item) { ?&gt;</b>
1216
+ &lt;li&gt;&lt;?php echo $item; ?&gt;&lt;/li&gt;
1217
+ <b>&lt;?php } ?&gt;</b>
1218
+ &lt;/ul&gt;
1219
+ </pre>
1220
+ <br>
1221
+
1222
+ <a name="property-logic-jstl"></a>
1223
+ <h4 class="section3">JSP</h4>
1224
+ <div class="program_caption">
1225
+ presentation data (ex-logic.pdata)</div>
1226
+ <pre class="program">&lt;ul&gt;
1227
+ &lt;li id="mark:items"&gt;AAA&lt;/li&gt;
1228
+ &lt;/ul&gt;
1229
+ </pre>
1230
+ <div class="program_caption">
1231
+ presentation logic (ex-logic.plogic)</div>
1232
+ <pre class="program">#items {
1233
+ value: item;
1234
+ <b>logic:</b> {
1235
+ &lt;c:forEach var="item" items="${list}"&gt;
1236
+ <b>_stag();</b>
1237
+ <b>_cont();</b>
1238
+ <b>_etag();</b>
1239
+ &lt;/c:forEach&gt;
1240
+ }
1241
+ }
1242
+ </pre>
1243
+ <div class="terminal_caption">
1244
+ compile</div>
1245
+ <pre class="terminal">$ kwartz -l jstl -p ex-logic.plogic ex-logic.pdata
1246
+ &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
1247
+ &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
1248
+ &lt;ul&gt;
1249
+ <b>&lt;c:forEach var="item" items="${list}"&gt;</b>
1250
+ &lt;li&gt;${item}&lt;/li&gt;
1251
+ <b>&lt;/c:forEach&gt;</b>
1252
+ &lt;/ul&gt;
1253
+ </pre>
1254
+ <br>
1255
+
1256
+ <a name="property-logic-eperl"></a>
1257
+ <h4 class="section3">Perl</h4>
1258
+ <div class="program_caption">
1259
+ presentation data (ex-logic.pdata)</div>
1260
+ <pre class="program">&lt;ul&gt;
1261
+ &lt;li id="mark:items"&gt;AAA&lt;/li&gt;
1262
+ &lt;/ul&gt;
1263
+ </pre>
1264
+ <div class="program_caption">
1265
+ presentation logic (ex-logic.plogic)</div>
1266
+ <pre class="program">#items {
1267
+ value: $item;
1268
+ <b>logic:</b> {
1269
+ foreach ($item in @list) {
1270
+ <b>_stag();</b>
1271
+ <b>_cont();</b>
1272
+ <b>_etag();</b>
1273
+ }
1274
+ }
1275
+ }
1276
+ </pre>
1277
+ <div class="terminal_caption">
1278
+ compile</div>
1279
+ <pre class="terminal">$ kwartz -l eperl -p ex-logic.plogic ex-logic.pdata
1280
+ &lt;ul&gt;
1281
+ <b>&lt;? foreach ($item in @list) { !&gt;</b>
1282
+ &lt;li&gt;&lt;?= $item !&gt;&lt;/li&gt;
1283
+ <b>&lt;? } !&gt;</b>
1284
+ &lt;/ul&gt;
1285
+ </pre>
1286
+ <br>
1287
+
1288
+ <br>
1289
+
1290
+
1291
+ <a name="property-begin"></a>
1292
+ <h3 class="section2">begin, end</h3>
1293
+ <p><code>begin:</code> and <code>end:</code> property represents the prework and postwork
1294
+ of document respectively.
1295
+ These properties takes target code block and are available only with
1296
+ '#DOCUMENT' selector.
1297
+ </p>
1298
+ <a name="property-begin-eruby"></a>
1299
+ <h4 class="section3">Ruby</h4>
1300
+ <div class="program_caption">
1301
+ presentation data (ex-begin.pdata)</div>
1302
+ <pre class="program">&lt;p&gt;Hello &lt;span id="mark:username"&gt;world&lt;/span&gt;!&lt;/p&gt;
1303
+ &lt;ul&gt;
1304
+ &lt;li id="mark:menu"&gt;menu item&lt;/li&gt;
1305
+ &lt;/ul&gt;
1306
+ </pre>
1307
+ <div class="program_caption">
1308
+ presentation logic (ex-begin.plogic)</div>
1309
+ <pre class="program">#DOCUMENT {
1310
+ <b>begin:</b> {
1311
+ username = @context[:username]
1312
+ menulist = @context[:menulist]
1313
+ }
1314
+ <b>end:</b> {
1315
+ print "&lt;!-- document end --&gt;\n"
1316
+
1317
+ }
1318
+ }
1319
+ #username {
1320
+ value: username;
1321
+ }
1322
+ #menu {
1323
+ value: menu;
1324
+ logic: {
1325
+ for menu in menulist
1326
+ _elem
1327
+ end
1328
+ }
1329
+ }
1330
+ </pre>
1331
+ <div class="terminal_caption">
1332
+ compile</div>
1333
+ <pre class="terminal">$ kwartz -l eruby -p ex-begin.plogic ex-begin.pdata
1334
+ <b>&lt;% username = @context[:username] %&gt;</b>
1335
+ <b>&lt;% menulist = @context[:menulist] %&gt;</b>
1336
+ &lt;p&gt;Hello &lt;span&gt;&lt;%= username %&gt;&lt;/span&gt;!&lt;/p&gt;
1337
+ &lt;ul&gt;
1338
+ &lt;% for menu in menulist %&gt;
1339
+ &lt;li&gt;&lt;%= menu %&gt;&lt;/li&gt;
1340
+ &lt;% end %&gt;
1341
+ &lt;/ul&gt;
1342
+ <b>&lt;%= "&lt;!-- document end --&gt;\n" %&gt;</b>
1343
+ </pre>
1344
+ <br>
1345
+
1346
+ <a name="property-begin-php"></a>
1347
+ <h4 class="section3">PHP</h4>
1348
+ <div class="program_caption">
1349
+ presentation data (ex-begin.pdata)</div>
1350
+ <pre class="program">&lt;p&gt;Hello &lt;span id="mark:username"&gt;world&lt;/span&gt;!&lt;/p&gt;
1351
+ &lt;ul&gt;
1352
+ &lt;li id="mark:menu"&gt;menu item&lt;/li&gt;
1353
+ &lt;/ul&gt;
1354
+ </pre>
1355
+ <div class="program_caption">
1356
+ presentation logic (ex-begin.plogic)</div>
1357
+ <pre class="program">#DOCUMENT {
1358
+ <b>begin:</b> {
1359
+ $username = $context['username'];
1360
+ $menulist = $context['menulist'];
1361
+ }
1362
+ <b>end:</b> {
1363
+ print("&lt;!-- document end --&gt;\n");
1364
+
1365
+ }
1366
+ }
1367
+ #username {
1368
+ value: $username;
1369
+ }
1370
+ #menu {
1371
+ value: $menu;
1372
+ logic: {
1373
+ foreach ($menulist as $menu) {
1374
+ _elem();
1375
+ }
1376
+ }
1377
+ }
1378
+ </pre>
1379
+ <div class="terminal_caption">
1380
+ compile</div>
1381
+ <pre class="terminal">$ kwartz -l php -p ex-begin.plogic ex-begin.pdata
1382
+ <b>&lt;?php $username = $context['username']; ?&gt;</b>
1383
+ <b>&lt;?php $menulist = $context['menulist']; ?&gt;</b>
1384
+ &lt;p&gt;Hello &lt;span&gt;&lt;?php echo $username; ?&gt;&lt;/span&gt;!&lt;/p&gt;
1385
+ &lt;ul&gt;
1386
+ &lt;?php foreach ($menulist as $menu) { ?&gt;
1387
+ &lt;li&gt;&lt;?php echo $menu; ?&gt;&lt;/li&gt;
1388
+ &lt;?php } ?&gt;
1389
+ &lt;/ul&gt;
1390
+ <b>&lt;?php echo "&lt;!-- document end --&gt;\n"; ?&gt;</b>
1391
+ </pre>
1392
+ <br>
1393
+
1394
+ <a name="property-begin-jstl"></a>
1395
+ <h4 class="section3">JSP</h4>
1396
+ <div class="program_caption">
1397
+ presentation data (ex-begin.pdata)</div>
1398
+ <pre class="program">&lt;p&gt;Hello &lt;span id="mark:username"&gt;world&lt;/span&gt;!&lt;/p&gt;
1399
+ &lt;ul&gt;
1400
+ &lt;li id="mark:menu"&gt;menu item&lt;/li&gt;
1401
+ &lt;/ul&gt;
1402
+ </pre>
1403
+ <div class="program_caption">
1404
+ presentation logic (ex-begin.plogic)</div>
1405
+ <pre class="program">#DOCUMENT {
1406
+ <b>begin:</b> {
1407
+ &lt;c:set var="username" value="${context.username}"/&gt;
1408
+ &lt;c:set var="menulist" value="${context.menulist}"/&gt;
1409
+ }
1410
+ <b>end:</b> {
1411
+ &lt;c:out value="&lt;!-- document end --&gt;\n"/&gt;
1412
+ }
1413
+ }
1414
+ #username {
1415
+ value: username;
1416
+ }
1417
+ #menu {
1418
+ value: menu;
1419
+ logic: {
1420
+ &lt;c:forEach var="menu" items="${menulist}"&gt;
1421
+ _elem();
1422
+ &lt;/c:forEach&gt;
1423
+ }
1424
+ }
1425
+ </pre>
1426
+ <div class="terminal_caption">
1427
+ compile</div>
1428
+ <pre class="terminal">$ kwartz -l jstl -p ex-begin.plogic ex-begin.pdata
1429
+ &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
1430
+ &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
1431
+ <b>&lt;c:set var="username" value="${context.username}"/&gt;</b>
1432
+ <b>&lt;c:set var="menulist" value="${context.menulist}"/&gt;</b>
1433
+ &lt;p&gt;Hello &lt;span&gt;${username}&lt;/span&gt;!&lt;/p&gt;
1434
+ &lt;ul&gt;
1435
+ &lt;c:forEach var="menu" items="${menulist}"&gt;
1436
+ &lt;li&gt;${menu}&lt;/li&gt;
1437
+ &lt;/c:forEach&gt;
1438
+ &lt;/ul&gt;
1439
+ <b>&lt;c:out value="&lt;!-- document end --&gt;\n"/&gt;</b>
1440
+ </pre>
1441
+ <br>
1442
+
1443
+ <a name="property-begin-eperl"></a>
1444
+ <h4 class="section3">Perl</h4>
1445
+ <div class="program_caption">
1446
+ presentation data (ex-begin.pdata)</div>
1447
+ <pre class="program">&lt;p&gt;Hello &lt;span id="mark:username"&gt;world&lt;/span&gt;!&lt;/p&gt;
1448
+ &lt;ul&gt;
1449
+ &lt;li id="mark:menu"&gt;menu item&lt;/li&gt;
1450
+ &lt;/ul&gt;
1451
+ </pre>
1452
+ <div class="program_caption">
1453
+ presentation logic (ex-begin.plogic)</div>
1454
+ <pre class="program">#DOCUMENT {
1455
+ <b>begin:</b> {
1456
+ $username = $context{'username'};
1457
+ @menulist = $context{'menulist'};
1458
+ }
1459
+ <b>end:</b> {
1460
+ print("&lt;!-- document end --&gt;\n");
1461
+
1462
+ }
1463
+ }
1464
+ #username {
1465
+ value: $username;
1466
+ }
1467
+ #menu {
1468
+ value: $menu;
1469
+ logic: {
1470
+ foreach ($menu in @menulist) {
1471
+ _elem();
1472
+ }
1473
+ }
1474
+ }
1475
+ </pre>
1476
+ <div class="terminal_caption">
1477
+ compile</div>
1478
+ <pre class="terminal">$ kwartz -l eperl -p ex-begin.plogic ex-begin.pdata
1479
+ <b>&lt;? $username = $context{'username'}; !&gt;</b>
1480
+ <b>&lt;? @menulist = $context{'menulist'}; !&gt;</b>
1481
+ &lt;p&gt;Hello &lt;span&gt;&lt;?= $username !&gt;&lt;/span&gt;!&lt;/p&gt;
1482
+ &lt;ul&gt;
1483
+ &lt;? foreach ($menu in @menulist) { !&gt;
1484
+ &lt;li&gt;&lt;?= $menu !&gt;&lt;/li&gt;
1485
+ &lt;? } !&gt;
1486
+ &lt;/ul&gt;
1487
+ <b>&lt;?= "&lt;!-- document end --&gt;\n" !&gt;</b>
1488
+ </pre>
1489
+ <br>
1490
+
1491
+ <br>
1492
+
1493
+
1494
+ <br>
1495
+
1496
+
1497
+ <a name="directives"></a>
1498
+ <h2 class="section1">Directives</h2>
1499
+ <p>Directives are commands to embed presentation logics into presentation data.
1500
+ For example, <code>title="for item in @list"</code> directive represents iteration of the element.
1501
+ </p>
1502
+ <p>Directives are provided for '<b>choosability</b>'.
1503
+ This is very important concept for Kwartz (and other products by kuwata-lab).
1504
+ In Kwartz, you can separate presentation logics from presentation data, or 'mix' them.
1505
+ It is the user or customer of Kwartz and not developer who determine which solution to adopt.
1506
+ All Kwartz can do is to provide the both solution to users.
1507
+ </p>
1508
+ <p>Notice that the notation of directives are different for each target language.
1509
+ For example, iteration directive is <code>title="for item in list"</code> in Ruby,
1510
+ <code>title="foreach($list as $item)"</code> in PHP.
1511
+ See the <code>directive notation table</code> for PHP, Java, and Perl user.
1512
+ </p>
1513
+ <a name="directive-elem"></a>
1514
+ <h3 class="section2">elem, Elem, ELEM</h3>
1515
+ <p>'elem', 'Elem', and 'ELEM' directive replaces element by expression.
1516
+ </p>
1517
+ <p>'Elem' directive escapes expression automatically, while 'ELEM' never escape it.
1518
+ 'elem' directive escapes expression when command-line option '-e' is specified
1519
+ or PROPERTY_ESCAPE is true in configuration file.
1520
+ </p>
1521
+ <a name="directive-elem-eruby"></a>
1522
+ <h4 class="section3">Ruby</h4>
1523
+ <div class="program_caption">
1524
+ presentation data (ex-elem.pdata)</div>
1525
+ <pre class="program">&lt;b <b>title="elem: expr"</b>&gt;foo&lt;/b&gt;
1526
+ &lt;b <b>title="Elem: expr"</b>&gt;foo&lt;/b&gt;
1527
+ &lt;b <b>title="ELEM: expr"</b>&gt;foo&lt;/b&gt;
1528
+ </pre>
1529
+ <div class="terminal_caption">
1530
+ compile</div>
1531
+ <pre class="terminal">$ kwartz -l eruby ex-elem.pdata
1532
+ <b>&lt;%= expr %&gt;</b>
1533
+ <b>&lt;%=h expr %&gt;</b>
1534
+ <b>&lt;%= expr %&gt;</b>
1535
+ </pre>
1536
+ <br>
1537
+
1538
+ <a name="directive-elem-php"></a>
1539
+ <h4 class="section3">PHP</h4>
1540
+ <div class="program_caption">
1541
+ presentation data (ex-elem.pdata)</div>
1542
+ <pre class="program">&lt;b <b>title="elem($expr)"</b>&gt;foo&lt;/b&gt;
1543
+ &lt;b <b>title="Elem($expr)"</b>&gt;foo&lt;/b&gt;
1544
+ &lt;b <b>title="ELEM($expr)"</b>&gt;foo&lt;/b&gt;
1545
+ </pre>
1546
+ <div class="terminal_caption">
1547
+ compile</div>
1548
+ <pre class="terminal">$ kwartz -l php ex-elem.pdata
1549
+ <b>&lt;?php echo $expr; ?&gt;</b>
1550
+ <b>&lt;?php echo htmlspecialchars($expr); ?&gt;</b>
1551
+ <b>&lt;?php echo $expr; ?&gt;</b>
1552
+ </pre>
1553
+ <br>
1554
+
1555
+ <a name="directive-elem-jstl"></a>
1556
+ <h4 class="section3">JSP</h4>
1557
+ <div class="program_caption">
1558
+ presentation data (ex-elem.pdata)</div>
1559
+ <pre class="program">&lt;b <b>title="elem(expr)"</b>&gt;foo&lt;/b&gt;
1560
+ &lt;b <b>title="Elem(expr)"</b>&gt;foo&lt;/b&gt;
1561
+ &lt;b <b>title="ELEM(expr)"</b>&gt;foo&lt;/b&gt;
1562
+ </pre>
1563
+ <div class="terminal_caption">
1564
+ compile</div>
1565
+ <pre class="terminal">$ kwartz -l jstl ex-elem.pdata
1566
+ <b>${expr}</b>
1567
+ <b>${expr}</b>
1568
+ <b>&lt;c:out value="${expr}" escapeXml="false"/&gt;</b>
1569
+ </pre>
1570
+ <br>
1571
+
1572
+ <a name="directive-elem-eperl"></a>
1573
+ <h4 class="section3">Perl</h4>
1574
+ <div class="program_caption">
1575
+ presentation data (ex-elem.pdata)</div>
1576
+ <pre class="program">&lt;b <b>title="elem($expr)"</b>&gt;foo&lt;/b&gt;
1577
+ &lt;b <b>title="Elem($expr)"</b>&gt;foo&lt;/b&gt;
1578
+ &lt;b <b>title="ELEM($expr)"</b>&gt;foo&lt;/b&gt;
1579
+ </pre>
1580
+ <div class="terminal_caption">
1581
+ compile</div>
1582
+ <pre class="terminal">$ kwartz -l eperl ex-elem.pdata
1583
+ <b>&lt;?= $expr !&gt;</b>
1584
+ <b>&lt;?= encode_entities($expr) !&gt;</b>
1585
+ <b>&lt;?= $expr !&gt;</b>
1586
+ </pre>
1587
+ <br>
1588
+
1589
+ <br>
1590
+
1591
+
1592
+ <a name="directive-stag"></a>
1593
+ <h3 class="section2">stag, Stag, STAG</h3>
1594
+ <p>'stag', 'Stag', and 'STAG' directive replaces start-tag by expression.
1595
+ </p>
1596
+ <p>'Stag' directive escapes expression automatically, while 'STAG' never escape it.
1597
+ 'stag' directive escapes expression when command-line option '-e' is specified
1598
+ or PROPERTY_ESCAPE is true in configuration file.
1599
+ </p>
1600
+ <a name="directive-stag-eruby"></a>
1601
+ <h4 class="section3">Ruby</h4>
1602
+ <div class="program_caption">
1603
+ presentation data (ex-stag.pdata)</div>
1604
+ <pre class="program">&lt;b <b>title="stag: expr"</b>&gt;foo&lt;/b&gt;
1605
+ &lt;b <b>title="Stag: expr"</b>&gt;foo&lt;/b&gt;
1606
+ &lt;b <b>title="STAG: expr"</b>&gt;foo&lt;/b&gt;
1607
+ </pre>
1608
+ <div class="terminal_caption">
1609
+ compile</div>
1610
+ <pre class="terminal">$ kwartz -l eruby ex-stag.pdata
1611
+ <b>&lt;%= expr %&gt;</b>foo&lt;/b&gt;
1612
+ <b>&lt;%=h expr %&gt;</b>foo&lt;/b&gt;
1613
+ <b>&lt;%= expr %&gt;</b>foo&lt;/b&gt;
1614
+ </pre>
1615
+ <br>
1616
+
1617
+ <a name="directive-stag-php"></a>
1618
+ <h4 class="section3">PHP</h4>
1619
+ <div class="program_caption">
1620
+ presentation data (ex-stag.pdata)</div>
1621
+ <pre class="program">&lt;b <b>title="stag($expr)"</b>&gt;foo&lt;/b&gt;
1622
+ &lt;b <b>title="Stag($expr)"</b>&gt;foo&lt;/b&gt;
1623
+ &lt;b <b>title="STAG($expr)"</b>&gt;foo&lt;/b&gt;
1624
+ </pre>
1625
+ <div class="terminal_caption">
1626
+ compile</div>
1627
+ <pre class="terminal">$ kwartz -l php ex-stag.pdata
1628
+ <b>&lt;?php echo $expr; ?&gt;</b>foo&lt;/b&gt;
1629
+ <b>&lt;?php echo htmlspecialchars($expr); ?&gt;</b>foo&lt;/b&gt;
1630
+ <b>&lt;?php echo $expr; ?&gt;</b>foo&lt;/b&gt;
1631
+ </pre>
1632
+ <br>
1633
+
1634
+ <a name="directive-stag-jstl"></a>
1635
+ <h4 class="section3">JSP</h4>
1636
+ <div class="program_caption">
1637
+ presentation data (ex-stag.pdata)</div>
1638
+ <pre class="program">&lt;b <b>title="stag(expr)"</b>&gt;foo&lt;/b&gt;
1639
+ &lt;b <b>title="Stag(expr)"</b>&gt;foo&lt;/b&gt;
1640
+ &lt;b <b>title="STAG(expr)"</b>&gt;foo&lt;/b&gt;
1641
+ </pre>
1642
+ <div class="terminal_caption">
1643
+ compile</div>
1644
+ <pre class="terminal">$ kwartz -l jstl ex-stag.pdata
1645
+ <b>${expr}</b>foo&lt;/b&gt;
1646
+ <b>${expr}</b>foo&lt;/b&gt;
1647
+ <b>&lt;c:out value="${expr}" escapeXml="false"/&gt;</b>foo&lt;/b&gt;
1648
+ </pre>
1649
+ <br>
1650
+
1651
+ <a name="directive-stag-eperl"></a>
1652
+ <h4 class="section3">Perl</h4>
1653
+ <div class="program_caption">
1654
+ presentation data (ex-stag.pdata)</div>
1655
+ <pre class="program">&lt;b <b>title="stag($expr)"</b>&gt;foo&lt;/b&gt;
1656
+ &lt;b <b>title="Stag($expr)"</b>&gt;foo&lt;/b&gt;
1657
+ &lt;b <b>title="STAG($expr)"</b>&gt;foo&lt;/b&gt;
1658
+ </pre>
1659
+ <div class="terminal_caption">
1660
+ compile</div>
1661
+ <pre class="terminal">$ kwartz -l eperl ex-stag.pdata
1662
+ <b>&lt;?= $expr !&gt;</b>foo&lt;/b&gt;
1663
+ <b>&lt;?= encode_entities($expr) !&gt;</b>foo&lt;/b&gt;
1664
+ <b>&lt;?= $expr !&gt;</b>foo&lt;/b&gt;
1665
+ </pre>
1666
+ <br>
1667
+
1668
+ <br>
1669
+
1670
+
1671
+ <a name="directive-etag"></a>
1672
+ <h3 class="section2">etag, Etag, ETAG</h3>
1673
+ <p>'etag', 'Etag', and 'ETAG' directive replaces start-tag by expression.
1674
+ </p>
1675
+ <p>'Etag' directive escapes expression automatically, while 'ETAG' never escape it.
1676
+ 'etag' directive escapes expression when command-line option '-e' is specified
1677
+ or PROPERTY_ESCAPE is true in configuration file.
1678
+ </p>
1679
+ <a name="directive-etag-eruby"></a>
1680
+ <h4 class="section3">Ruby</h4>
1681
+ <div class="program_caption">
1682
+ presentation data (ex-etag.pdata)</div>
1683
+ <pre class="program">&lt;b <b>title="etag: expr"</b>&gt;foo&lt;/b&gt;
1684
+ &lt;b <b>title="Etag: expr"</b>&gt;foo&lt;/b&gt;
1685
+ &lt;b <b>title="ETAG: expr"</b>&gt;foo&lt;/b&gt;
1686
+ </pre>
1687
+ <div class="terminal_caption">
1688
+ compile</div>
1689
+ <pre class="terminal">$ kwartz -l eruby ex-etag.pdata
1690
+ &lt;b&gt;foo<b>&lt;%= expr %&gt;</b>
1691
+ &lt;b&gt;foo<b>&lt;%=h expr %&gt;</b>
1692
+ &lt;b&gt;foo<b>&lt;%= expr %&gt;</b>
1693
+ </pre>
1694
+ <br>
1695
+
1696
+ <a name="directive-etag-php"></a>
1697
+ <h4 class="section3">PHP</h4>
1698
+ <div class="program_caption">
1699
+ presentation data (ex-etag.pdata)</div>
1700
+ <pre class="program">&lt;b <b>title="etag($expr)"</b>&gt;foo&lt;/b&gt;
1701
+ &lt;b <b>title="Etag($expr)"</b>&gt;foo&lt;/b&gt;
1702
+ &lt;b <b>title="ETAG($expr)"</b>&gt;foo&lt;/b&gt;
1703
+ </pre>
1704
+ <div class="terminal_caption">
1705
+ compile</div>
1706
+ <pre class="terminal">$ kwartz -l php ex-etag.pdata
1707
+ &lt;b&gt;foo<b>&lt;?php echo $expr; ?&gt;</b>
1708
+ &lt;b&gt;foo<b>&lt;?php echo htmlspecialchars($expr); ?&gt;</b>
1709
+ &lt;b&gt;foo<b>&lt;?php echo $expr; ?&gt;</b>
1710
+ </pre>
1711
+ <br>
1712
+
1713
+ <a name="directive-etag-jstl"></a>
1714
+ <h4 class="section3">JSP</h4>
1715
+ <div class="program_caption">
1716
+ presentation data (ex-etag.pdata)</div>
1717
+ <pre class="program">&lt;b <b>title="etag(expr)"</b>&gt;foo&lt;/b&gt;
1718
+ &lt;b <b>title="Etag(expr)"</b>&gt;foo&lt;/b&gt;
1719
+ &lt;b <b>title="ETAG(expr)"</b>&gt;foo&lt;/b&gt;
1720
+ </pre>
1721
+ <div class="terminal_caption">
1722
+ compile</div>
1723
+ <pre class="terminal">$ kwartz -l jstl ex-etag.pdata
1724
+ &lt;b&gt;foo<b>${expr}</b>
1725
+ &lt;b&gt;foo<b>${expr}</b>
1726
+ &lt;b&gt;foo<b>&lt;c:out value="${expr}" escapeXml="false"/&gt;</b>
1727
+ </pre>
1728
+ <br>
1729
+
1730
+ <a name="directive-etag-eperl"></a>
1731
+ <h4 class="section3">Perl</h4>
1732
+ <div class="program_caption">
1733
+ presentation data (ex-etag.pdata)</div>
1734
+ <pre class="program">&lt;b <b>title="etag($expr)"</b>&gt;foo&lt;/b&gt;
1735
+ &lt;b <b>title="Etag($expr)"</b>&gt;foo&lt;/b&gt;
1736
+ &lt;b <b>title="ETAG($expr)"</b>&gt;foo&lt;/b&gt;
1737
+ </pre>
1738
+ <div class="terminal_caption">
1739
+ compile</div>
1740
+ <pre class="terminal">$ kwartz -l eperl ex-etag.pdata
1741
+ &lt;b&gt;foo<b>&lt;?= $expr !&gt;</b>
1742
+ &lt;b&gt;foo<b>&lt;?= encode_entities($expr) !&gt;</b>
1743
+ &lt;b&gt;foo<b>&lt;?= $expr !&gt;</b>
1744
+ </pre>
1745
+ <br>
1746
+
1747
+ <br>
1748
+
1749
+
1750
+ <a name="directive-cont"></a>
1751
+ <h3 class="section2">cont, Cont, CONT</h3>
1752
+ <p>'cont', 'Cont', and 'CONT' directives replace content by expression.
1753
+ </p>
1754
+ <p>'Cont' directive escapes expression automatically, while 'CONT' never escape it.
1755
+ 'cont' directive escapes expression when command-line option '-e' is specified
1756
+ or PROPERTY_ESCAPE is true in configuration file.
1757
+ </p>
1758
+ <a name="directive-cont-eruby"></a>
1759
+ <h4 class="section3">Ruby</h4>
1760
+ <div class="program_caption">
1761
+ presentation data (ex-cont.pdata)</div>
1762
+ <pre class="program">&lt;b <b>title="cont: expr"</b>&gt;foo&lt;/b&gt;
1763
+ &lt;b <b>title="Cont: expr"</b>&gt;foo&lt;/b&gt;
1764
+ &lt;b <b>title="CONT: expr"</b>&gt;foo&lt;/b&gt;
1765
+ </pre>
1766
+ <div class="terminal_caption">
1767
+ compile</div>
1768
+ <pre class="terminal">$ kwartz -l eruby ex-cont.pdata
1769
+ &lt;b&gt;<b>&lt;%= expr %&gt;</b>&lt;/b&gt;
1770
+ &lt;b&gt;<b>&lt;%=h expr %&gt;</b>&lt;/b&gt;
1771
+ &lt;b&gt;<b>&lt;%= expr %&gt;</b>&lt;/b&gt;
1772
+ </pre>
1773
+ <br>
1774
+
1775
+ <a name="directive-cont-php"></a>
1776
+ <h4 class="section3">PHP</h4>
1777
+ <div class="program_caption">
1778
+ presentation data (ex-cont.pdata)</div>
1779
+ <pre class="program">&lt;b <b>title="cont($expr)"</b>&gt;foo&lt;/b&gt;
1780
+ &lt;b <b>title="Cont($expr)"</b>&gt;foo&lt;/b&gt;
1781
+ &lt;b <b>title="CONT($expr)"</b>&gt;foo&lt;/b&gt;
1782
+ </pre>
1783
+ <div class="terminal_caption">
1784
+ compile</div>
1785
+ <pre class="terminal">$ kwartz -l php ex-cont.pdata
1786
+ &lt;b&gt;<b>&lt;?php echo $expr; ?&gt;</b>&lt;/b&gt;
1787
+ &lt;b&gt;<b>&lt;?php echo htmlspecialchars($expr); ?&gt;</b>&lt;/b&gt;
1788
+ &lt;b&gt;<b>&lt;?php echo $expr; ?&gt;</b>&lt;/b&gt;
1789
+ </pre>
1790
+ <br>
1791
+
1792
+ <a name="directive-cont-jstl"></a>
1793
+ <h4 class="section3">JSP</h4>
1794
+ <div class="program_caption">
1795
+ presentation data (ex-cont.pdata)</div>
1796
+ <pre class="program">&lt;b <b>title="cont(expr)"</b>&gt;foo&lt;/b&gt;
1797
+ &lt;b <b>title="Cont(expr)"</b>&gt;foo&lt;/b&gt;
1798
+ &lt;b <b>title="CONT(expr)"</b>&gt;foo&lt;/b&gt;
1799
+ </pre>
1800
+ <div class="terminal_caption">
1801
+ compile</div>
1802
+ <pre class="terminal">$ kwartz -l jstl ex-cont.pdata
1803
+ &lt;b&gt;<b>${expr}</b>&lt;/b&gt;
1804
+ &lt;b&gt;<b>${expr}</b>&lt;/b&gt;
1805
+ &lt;b&gt;<b>&lt;c:out value="${expr}" escapeXml="false"/&gt;</b>&lt;/b&gt;
1806
+ </pre>
1807
+ <br>
1808
+
1809
+ <a name="directive-cont-eperl"></a>
1810
+ <h4 class="section3">Perl</h4>
1811
+ <div class="program_caption">
1812
+ presentation data (ex-cont.pdata)</div>
1813
+ <pre class="program">&lt;b <b>title="cont($expr)"</b>&gt;foo&lt;/b&gt;
1814
+ &lt;b <b>title="Cont($expr)"</b>&gt;foo&lt;/b&gt;
1815
+ &lt;b <b>title="CONT($expr)"</b>&gt;foo&lt;/b&gt;
1816
+ </pre>
1817
+ <div class="terminal_caption">
1818
+ compile</div>
1819
+ <pre class="terminal">$ kwartz -l eperl ex-cont.pdata
1820
+ &lt;b&gt;<b>&lt;?= $expr !&gt;</b>&lt;/b&gt;
1821
+ &lt;b&gt;<b>&lt;?= encode_entities($expr) !&gt;</b>&lt;/b&gt;
1822
+ &lt;b&gt;<b>&lt;?= $expr !&gt;</b>&lt;/b&gt;
1823
+ </pre>
1824
+ <br>
1825
+
1826
+ <br>
1827
+
1828
+
1829
+ <a name="directive-value"></a>
1830
+ <h3 class="section2">value, Value, VALUE</h3>
1831
+ <p>'value', 'Value', and 'VALUE' directives are equivalent to
1832
+ 'cont', 'Cont', and 'CONT' directives respectively.
1833
+ </p>
1834
+ <a name="directive-value-eruby"></a>
1835
+ <h4 class="section3">Ruby</h4>
1836
+ <div class="program_caption">
1837
+ presentation data (ex-value.pdata)</div>
1838
+ <pre class="program">&lt;b <b>title="value: expr"</b>&gt;foo&lt;/b&gt;
1839
+ &lt;b <b>title="Value: expr"</b>&gt;foo&lt;/b&gt;
1840
+ &lt;b <b>title="VALUE: expr"</b>&gt;foo&lt;/b&gt;
1841
+ </pre>
1842
+ <div class="terminal_caption">
1843
+ compile</div>
1844
+ <pre class="terminal">$ kwartz -l eruby ex-value.pdata
1845
+ &lt;b&gt;<b>&lt;%= expr %&gt;</b>&lt;/b&gt;
1846
+ &lt;b&gt;<b>&lt;%=h expr %&gt;</b>&lt;/b&gt;
1847
+ &lt;b&gt;<b>&lt;%= expr %&gt;</b>&lt;/b&gt;
1848
+ </pre>
1849
+ <br>
1850
+
1851
+ <a name="directive-value-php"></a>
1852
+ <h4 class="section3">PHP</h4>
1853
+ <div class="program_caption">
1854
+ presentation data (ex-value.pdata)</div>
1855
+ <pre class="program">&lt;b <b>title="value($expr)"</b>&gt;foo&lt;/b&gt;
1856
+ &lt;b <b>title="Value($expr)"</b>&gt;foo&lt;/b&gt;
1857
+ &lt;b <b>title="VALUE($expr)"</b>&gt;foo&lt;/b&gt;
1858
+ </pre>
1859
+ <div class="terminal_caption">
1860
+ compile</div>
1861
+ <pre class="terminal">$ kwartz -l php ex-value.pdata
1862
+ &lt;b&gt;<b>&lt;?php echo $expr; ?&gt;</b>&lt;/b&gt;
1863
+ &lt;b&gt;<b>&lt;?php echo htmlspecialchars($expr); ?&gt;</b>&lt;/b&gt;
1864
+ &lt;b&gt;<b>&lt;?php echo $expr; ?&gt;</b>&lt;/b&gt;
1865
+ </pre>
1866
+ <br>
1867
+
1868
+ <a name="directive-value-jstl"></a>
1869
+ <h4 class="section3">JSP</h4>
1870
+ <div class="program_caption">
1871
+ presentation data (ex-value.pdata)</div>
1872
+ <pre class="program">&lt;b <b>title="value(expr)"</b>&gt;foo&lt;/b&gt;
1873
+ &lt;b <b>title="Value(expr)"</b>&gt;foo&lt;/b&gt;
1874
+ &lt;b <b>title="VALUE(expr)"</b>&gt;foo&lt;/b&gt;
1875
+ </pre>
1876
+ <div class="terminal_caption">
1877
+ compile</div>
1878
+ <pre class="terminal">$ kwartz -l jstl ex-value.pdata
1879
+ &lt;b&gt;<b>${expr}</b>&lt;/b&gt;
1880
+ &lt;b&gt;<b>${expr}</b>&lt;/b&gt;
1881
+ &lt;b&gt;<b>&lt;c:out value="${expr}" escapeXml="false"/&gt;</b>&lt;/b&gt;
1882
+ </pre>
1883
+ <br>
1884
+
1885
+ <a name="directive-value-eperl"></a>
1886
+ <h4 class="section3">Perl</h4>
1887
+ <div class="program_caption">
1888
+ presentation data (ex-value.pdata)</div>
1889
+ <pre class="program">&lt;b <b>title="value($expr)"</b>&gt;foo&lt;/b&gt;
1890
+ &lt;b <b>title="Value($expr)"</b>&gt;foo&lt;/b&gt;
1891
+ &lt;b <b>title="VALUE($expr)"</b>&gt;foo&lt;/b&gt;
1892
+ </pre>
1893
+ <div class="terminal_caption">
1894
+ compile</div>
1895
+ <pre class="terminal">$ kwartz -l eperl ex-value.pdata
1896
+ &lt;b&gt;<b>&lt;?= $expr !&gt;</b>&lt;/b&gt;
1897
+ &lt;b&gt;<b>&lt;?= encode_entities($expr) !&gt;</b>&lt;/b&gt;
1898
+ &lt;b&gt;<b>&lt;?= $expr !&gt;</b>&lt;/b&gt;
1899
+ </pre>
1900
+ <br>
1901
+
1902
+ <br>
1903
+
1904
+
1905
+ <a name="directive-foreach"></a>
1906
+ <h3 class="section2">foreach</h3>
1907
+ <p>'foreach' directive interates element, while 'loop' directive iterates content.
1908
+ </p>
1909
+ <a name="directive-foreach-eruby"></a>
1910
+ <h4 class="section3">Ruby</h4>
1911
+ <div class="program_caption">
1912
+ presentation data (ex-foreach.pdata)</div>
1913
+ <pre class="program">&lt;tr <b>title="for item in list"</b>&gt;
1914
+ &lt;td title="cont item"&gt;foo&lt;/td&gt;
1915
+ &lt;/tr&gt;
1916
+
1917
+ &lt;tr <b>title="for key,value in hash"</b>&gt;
1918
+ &lt;td title="cont key"&gt;key&lt;/td&gt;
1919
+ &lt;td title="cont value"&gt;value&lt;/td&gt;
1920
+ &lt;/tr&gt;
1921
+ </pre>
1922
+ <div class="terminal_caption">
1923
+ compile</div>
1924
+ <pre class="terminal">$ kwartz -l eruby ex-foreach.pdata
1925
+ <b>&lt;% for item in list do %&gt;</b>
1926
+ &lt;tr&gt;
1927
+ &lt;td&gt;&lt;%= item %&gt;&lt;/td&gt;
1928
+ &lt;/tr&gt;
1929
+ <b>&lt;% end %&gt;</b>
1930
+
1931
+ <b>&lt;% hash.each do |key, value| %&gt;</b>
1932
+ &lt;tr&gt;
1933
+ &lt;td&gt;&lt;%= key %&gt;&lt;/td&gt;
1934
+ &lt;td&gt;&lt;%= value %&gt;&lt;/td&gt;
1935
+ &lt;/tr&gt;
1936
+ <b>&lt;% end %&gt;</b>
1937
+ </pre>
1938
+ <br>
1939
+
1940
+ <a name="directive-foreach-php"></a>
1941
+ <h4 class="section3">PHP</h4>
1942
+ <div class="program_caption">
1943
+ presentation data (ex-foreach.pdata)</div>
1944
+ <pre class="program">&lt;tr <b>title="foreach($list as $item)"</b>&gt;
1945
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
1946
+ &lt;/tr&gt;
1947
+
1948
+ &lt;tr <b>title="foreach($hash as $key=&gt;$value)"</b>&gt;
1949
+ &lt;td title="cont($key)"&gt;key&lt;/td&gt;
1950
+ &lt;td title="cont($value)"&gt;value&lt;/td&gt;
1951
+ &lt;/tr&gt;
1952
+ </pre>
1953
+ <div class="terminal_caption">
1954
+ compile</div>
1955
+ <pre class="terminal">$ kwartz -l php ex-foreach.pdata
1956
+ <b>&lt;?php foreach ($list as $item) { ?&gt;</b>
1957
+ &lt;tr&gt;
1958
+ &lt;td&gt;&lt;?php echo $item; ?&gt;&lt;/td&gt;
1959
+ &lt;/tr&gt;
1960
+ <b>&lt;?php } ?&gt;</b>
1961
+
1962
+ <b>&lt;?php foreach ($hash as $key=&gt;$value) { ?&gt;</b>
1963
+ &lt;tr&gt;
1964
+ &lt;td&gt;&lt;?php echo $key; ?&gt;&lt;/td&gt;
1965
+ &lt;td&gt;&lt;?php echo $value; ?&gt;&lt;/td&gt;
1966
+ &lt;/tr&gt;
1967
+ <b>&lt;?php } ?&gt;</b>
1968
+ </pre>
1969
+ <br>
1970
+
1971
+ <a name="directive-foreach-jstl"></a>
1972
+ <h4 class="section3">JSP</h4>
1973
+ <div class="program_caption">
1974
+ presentation data (ex-foreach.pdata)</div>
1975
+ <pre class="program">&lt;tr <b>title="for(item: list)"</b>&gt;
1976
+ &lt;td title="cont(item)"&gt;foo&lt;/td&gt;
1977
+ &lt;/tr&gt;
1978
+
1979
+ &lt;tr <b>title="forEach(:var=&gt;'v', :items=&gt;:'params.list', :varStatus=&gt;'status')"</b>&gt;
1980
+ &lt;td title="cont(status.index)"&gt;1&lt;/td&gt;
1981
+ &lt;td title="cont(v)"&gt;&lt;/td&gt;
1982
+ &lt;/tr&gt;
1983
+
1984
+ &lt;tr <b>title="forEach(:var=&gt;'n', :begin=&gt;1, :end=&gt;10, :step=&gt;2)"</b>&gt;
1985
+ &lt;td title="cont(n)"&gt;key&lt;/td&gt;
1986
+ &lt;/tr&gt;
1987
+ </pre>
1988
+ <div class="terminal_caption">
1989
+ compile</div>
1990
+ <pre class="terminal">$ kwartz -l jstl ex-foreach.pdata
1991
+ <b>&lt;c:forEach var="item" items="${list}"&gt;</b>
1992
+ &lt;tr&gt;
1993
+ &lt;td&gt;${item}&lt;/td&gt;
1994
+ &lt;/tr&gt;
1995
+ <b>&lt;/c:forEach&gt;</b>
1996
+
1997
+ <b>&lt;c:forEach var="v" items="${params.list}" varStatus="status"&gt;</b>
1998
+ &lt;tr&gt;
1999
+ &lt;td&gt;${status.index}&lt;/td&gt;
2000
+ &lt;td&gt;${v}&lt;/td&gt;
2001
+ &lt;/tr&gt;
2002
+ <b>&lt;/c:forEach&gt;</b>
2003
+
2004
+ <b>&lt;c:forEach var="n" begin="1" end="10" step="2"&gt;</b>
2005
+ &lt;tr&gt;
2006
+ &lt;td&gt;${n}&lt;/td&gt;
2007
+ &lt;/tr&gt;
2008
+ <b>&lt;/c:forEach&gt;</b>
2009
+ </pre>
2010
+ <br>
2011
+
2012
+ <a name="directive-foreach-eperl"></a>
2013
+ <h4 class="section3">Perl</h4>
2014
+ <div class="program_caption">
2015
+ presentation data (ex-foreach.pdata)</div>
2016
+ <pre class="program">&lt;tr <b>title="foreach($item in @list)"</b>&gt;
2017
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
2018
+ &lt;/tr&gt;
2019
+
2020
+ &lt;tr <b>title="foreach($key,$value in %hash)"</b>&gt;
2021
+ &lt;td title="cont($key)"&gt;key&lt;/td&gt;
2022
+ &lt;td title="cont($value)"&gt;value&lt;/td&gt;
2023
+ &lt;/tr&gt;
2024
+ </pre>
2025
+ <div class="terminal_caption">
2026
+ compile</div>
2027
+ <pre class="terminal">$ kwartz -l eperl ex-foreach.pdata
2028
+ <b>&lt;? foreach my $item (@list) { !&gt;</b>
2029
+ &lt;tr&gt;
2030
+ &lt;td&gt;&lt;?= $item !&gt;&lt;/td&gt;
2031
+ &lt;/tr&gt;
2032
+ <b>&lt;? } !&gt;</b>
2033
+
2034
+ <b>&lt;? foreach my $key (keys %hash) { !&gt;</b>
2035
+ <b>&lt;? my $value = $hash{$key}; !&gt;</b>
2036
+ &lt;tr&gt;
2037
+ &lt;td&gt;&lt;?= $key !&gt;&lt;/td&gt;
2038
+ &lt;td&gt;&lt;?= $value !&gt;&lt;/td&gt;
2039
+ &lt;/tr&gt;
2040
+ <b>&lt;? } !&gt;</b>
2041
+ </pre>
2042
+ <br>
2043
+
2044
+ <br>
2045
+
2046
+
2047
+ <a name="directive-list"></a>
2048
+ <h3 class="section2">list</h3>
2049
+ <p>'list' directive interates content, while 'foreach' directive iterates element.
2050
+ </p>
2051
+ <a name="directive-list-eruby"></a>
2052
+ <h4 class="section3">Ruby</h4>
2053
+ <div class="program_caption">
2054
+ presentation data (ex-list.pdata)</div>
2055
+ <pre class="program">&lt;tr <b>title="list item in list"</b>&gt;
2056
+ &lt;td title="cont item"&gt;foo&lt;/td&gt;
2057
+ &lt;/tr&gt;
2058
+
2059
+ &lt;tr <b>title="list key,value in hash"</b>&gt;
2060
+ &lt;td title="cont key"&gt;key&lt;/td&gt;
2061
+ &lt;td title="cont value"&gt;value&lt;/td&gt;
2062
+ &lt;/tr&gt;
2063
+ </pre>
2064
+ <div class="terminal_caption">
2065
+ compile</div>
2066
+ <pre class="terminal">$ kwartz -l eruby ex-list.pdata
2067
+ &lt;tr&gt;
2068
+ <b>&lt;% for item in list do %&gt;</b>
2069
+ &lt;td&gt;&lt;%= item %&gt;&lt;/td&gt;
2070
+ <b>&lt;% end %&gt;</b>
2071
+ &lt;/tr&gt;
2072
+
2073
+ &lt;tr&gt;
2074
+ <b>&lt;% hash.each do |key, value| %&gt;</b>
2075
+ &lt;td&gt;&lt;%= key %&gt;&lt;/td&gt;
2076
+ &lt;td&gt;&lt;%= value %&gt;&lt;/td&gt;
2077
+ <b>&lt;% end %&gt;</b>
2078
+ &lt;/tr&gt;
2079
+ </pre>
2080
+ <br>
2081
+
2082
+ <a name="directive-list-php"></a>
2083
+ <h4 class="section3">PHP</h4>
2084
+ <div class="program_caption">
2085
+ presentation data (ex-list.pdata)</div>
2086
+ <pre class="program">&lt;tr <b>title="list($list as $item)"</b>&gt;
2087
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
2088
+ &lt;/tr&gt;
2089
+
2090
+ &lt;tr <b>title="list($hash as $key=&gt;$value)"</b>&gt;
2091
+ &lt;td title="cont($key)"&gt;key&lt;/td&gt;
2092
+ &lt;td title="cont($value)"&gt;value&lt;/td&gt;
2093
+ &lt;/tr&gt;
2094
+ </pre>
2095
+ <div class="terminal_caption">
2096
+ compile</div>
2097
+ <pre class="terminal">$ kwartz -l php ex-list.pdata
2098
+ &lt;tr&gt;
2099
+ <b>&lt;?php foreach ($list as $item) { ?&gt;</b>
2100
+ &lt;td&gt;&lt;?php echo $item; ?&gt;&lt;/td&gt;
2101
+ <b>&lt;?php } ?&gt;</b>
2102
+ &lt;/tr&gt;
2103
+
2104
+ &lt;tr&gt;
2105
+ <b>&lt;?php foreach ($hash as $key=&gt;$value) { ?&gt;</b>
2106
+ &lt;td&gt;&lt;?php echo $key; ?&gt;&lt;/td&gt;
2107
+ &lt;td&gt;&lt;?php echo $value; ?&gt;&lt;/td&gt;
2108
+ <b>&lt;?php } ?&gt;</b>
2109
+ &lt;/tr&gt;
2110
+ </pre>
2111
+ <br>
2112
+
2113
+ <a name="directive-list-jstl"></a>
2114
+ <h4 class="section3">JSP</h4>
2115
+ <div class="program_caption">
2116
+ presentation data (ex-list.pdata)</div>
2117
+ <pre class="program">&lt;tr <b>title="list(item: list)"</b>&gt;
2118
+ &lt;td title="cont(item)"&gt;foo&lt;/td&gt;
2119
+ &lt;/tr&gt;
2120
+ </pre>
2121
+ <div class="terminal_caption">
2122
+ compile</div>
2123
+ <pre class="terminal">$ kwartz -l jstl ex-list.pdata
2124
+ &lt;tr&gt;
2125
+ <b>&lt;c:forEach var="item" items="${list}"&gt;</b>
2126
+ &lt;td&gt;${item}&lt;/td&gt;
2127
+ <b>&lt;/c:forEach&gt;</b>
2128
+ &lt;/tr&gt;
2129
+ </pre>
2130
+ <br>
2131
+
2132
+ <a name="directive-list-eperl"></a>
2133
+ <h4 class="section3">Perl</h4>
2134
+ <div class="program_caption">
2135
+ presentation data (ex-list.pdata)</div>
2136
+ <pre class="program">&lt;tr <b>title="list($item in @list)"</b>&gt;
2137
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
2138
+ &lt;/tr&gt;
2139
+
2140
+ &lt;tr <b>title="list($key,$value in %hash)"</b>&gt;
2141
+ &lt;td title="cont($key)"&gt;key&lt;/td&gt;
2142
+ &lt;td title="cont($value)"&gt;value&lt;/td&gt;
2143
+ &lt;/tr&gt;
2144
+ </pre>
2145
+ <div class="terminal_caption">
2146
+ compile</div>
2147
+ <pre class="terminal">$ kwartz -l eperl ex-list.pdata
2148
+ &lt;tr&gt;
2149
+ <b>&lt;? foreach my $item (@list) { !&gt;</b>
2150
+ &lt;td&gt;&lt;?= $item !&gt;&lt;/td&gt;
2151
+ <b>&lt;? } !&gt;</b>
2152
+ &lt;/tr&gt;
2153
+
2154
+ &lt;tr&gt;
2155
+ <b>&lt;? foreach my $key (keys %hash) { !&gt;</b>
2156
+ <b>&lt;? my $value = $hash{$key}; !&gt;</b>
2157
+ &lt;td&gt;&lt;?= $key !&gt;&lt;/td&gt;
2158
+ &lt;td&gt;&lt;?= $value !&gt;&lt;/td&gt;
2159
+ <b>&lt;? } !&gt;</b>
2160
+ &lt;/tr&gt;
2161
+ </pre>
2162
+ <br>
2163
+
2164
+ <br>
2165
+
2166
+
2167
+ <a name="directive-foreach_ctr"></a>
2168
+ <h3 class="section2">Foreach, List</h3>
2169
+ <p>'Foreach' and 'List' directives iterate element or content with loop counter
2170
+ (starting with 1).
2171
+ </p>
2172
+ <a name="directive-foreach_ctr-eruby"></a>
2173
+ <h4 class="section3">Ruby</h4>
2174
+ <div class="program_caption">
2175
+ presentation data (ex-foreach_ctr.pdata)</div>
2176
+ <pre class="program">&lt;tr <b>title="For item in list"</b>&gt;
2177
+ &lt;td title="cont item"&gt;foo&lt;/td&gt;
2178
+ &lt;/tr&gt;
2179
+
2180
+ &lt;tr <b>title="List item in list"</b>&gt;
2181
+ &lt;td title="cont item"&gt;foo&lt;/td&gt;
2182
+ &lt;/tr&gt;
2183
+ </pre>
2184
+ <div class="terminal_caption">
2185
+ compile</div>
2186
+ <pre class="terminal">$ kwartz -l eruby ex-foreach_ctr.pdata
2187
+ <b>&lt;% item_ctr = 0 %&gt;</b>
2188
+ <b>&lt;% for item in list do %&gt;</b>
2189
+ <b>&lt;% item_ctr += 1 %&gt;</b>
2190
+ &lt;tr&gt;
2191
+ &lt;td&gt;&lt;%= item %&gt;&lt;/td&gt;
2192
+ &lt;/tr&gt;
2193
+ <b>&lt;% end %&gt;</b>
2194
+
2195
+ &lt;tr&gt;
2196
+ <b>&lt;% item_ctr = 0 %&gt;</b>
2197
+ <b>&lt;% for item in list do %&gt;</b>
2198
+ <b>&lt;% item_ctr += 1 %&gt;</b>
2199
+ &lt;td&gt;&lt;%= item %&gt;&lt;/td&gt;
2200
+ <b>&lt;% end %&gt;</b>
2201
+ &lt;/tr&gt;
2202
+ </pre>
2203
+ <br>
2204
+
2205
+ <a name="directive-foreach_ctr-php"></a>
2206
+ <h4 class="section3">PHP</h4>
2207
+ <div class="program_caption">
2208
+ presentation data (ex-foreach_ctr.pdata)</div>
2209
+ <pre class="program">&lt;tr <b>title="Foreach($list as $item)"</b>&gt;
2210
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
2211
+ &lt;/tr&gt;
2212
+
2213
+ &lt;tr <b>title="List($list as $item)"</b>&gt;
2214
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
2215
+ &lt;/tr&gt;
2216
+ </pre>
2217
+ <div class="terminal_caption">
2218
+ compile</div>
2219
+ <pre class="terminal">$ kwartz -l php ex-foreach_ctr.pdata
2220
+ <b>&lt;?php $item_ctr = 0; ?&gt;</b>
2221
+ <b>&lt;?php foreach ($list as $item) { ?&gt;</b>
2222
+ <b>&lt;?php $item_ctr++; ?&gt;</b>
2223
+ &lt;tr&gt;
2224
+ &lt;td&gt;&lt;?php echo $item; ?&gt;&lt;/td&gt;
2225
+ &lt;/tr&gt;
2226
+ <b>&lt;?php } ?&gt;</b>
2227
+
2228
+ &lt;tr&gt;
2229
+ <b>&lt;?php $item_ctr = 0; ?&gt;</b>
2230
+ <b>&lt;?php foreach ($list as $item) { ?&gt;</b>
2231
+ <b>&lt;?php $item_ctr++; ?&gt;</b>
2232
+ &lt;td&gt;&lt;?php echo $item; ?&gt;&lt;/td&gt;
2233
+ <b>&lt;?php } ?&gt;</b>
2234
+ &lt;/tr&gt;
2235
+ </pre>
2236
+ <br>
2237
+
2238
+ <a name="directive-foreach_ctr-jstl"></a>
2239
+ <h4 class="section3">JSP</h4>
2240
+ <div class="program_caption">
2241
+ presentation data (ex-foreach_ctr.pdata)</div>
2242
+ <pre class="program">&lt;tr <b>title="For(item: list)"</b>&gt;
2243
+ &lt;td title="cont(item)"&gt;foo&lt;/td&gt;
2244
+ &lt;/tr&gt;
2245
+
2246
+ &lt;tr <b>title="List(item: list)"</b>&gt;
2247
+ &lt;td title="cont(item)"&gt;foo&lt;/td&gt;
2248
+ &lt;/tr&gt;
2249
+ </pre>
2250
+ <div class="terminal_caption">
2251
+ compile</div>
2252
+ <pre class="terminal">$ kwartz -l jstl ex-foreach_ctr.pdata
2253
+ <b>&lt;c:forEach var="item" items="${list}" varStatus="item_status"&gt;</b>
2254
+ <b>&lt;c:set var="item_ctr" value="${item_status.count}" /&gt;</b>
2255
+ &lt;tr&gt;
2256
+ &lt;td&gt;${item}&lt;/td&gt;
2257
+ &lt;/tr&gt;
2258
+ <b>&lt;/c:forEach&gt;</b>
2259
+
2260
+ &lt;tr&gt;
2261
+ <b>&lt;c:forEach var="item" items="${list}" varStatus="item_status"&gt;</b>
2262
+ <b>&lt;c:set var="item_ctr" value="${item_status.count}" /&gt;</b>
2263
+ &lt;td&gt;${item}&lt;/td&gt;
2264
+ <b>&lt;/c:forEach&gt;</b>
2265
+ &lt;/tr&gt;
2266
+ </pre>
2267
+ <br>
2268
+
2269
+ <a name="directive-foreach_ctr-eperl"></a>
2270
+ <h4 class="section3">Perl</h4>
2271
+ <div class="program_caption">
2272
+ presentation data (ex-foreach_ctr.pdata)</div>
2273
+ <pre class="program">&lt;tr <b>title="Foreach($item in @list)"</b>&gt;
2274
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
2275
+ &lt;/tr&gt;
2276
+
2277
+ &lt;tr <b>title="List($item in @list)"</b>&gt;
2278
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
2279
+ &lt;/tr&gt;
2280
+ </pre>
2281
+ <div class="terminal_caption">
2282
+ compile</div>
2283
+ <pre class="terminal">$ kwartz -l eperl ex-foreach_ctr.pdata
2284
+ <b>&lt;? my $item_ctr = 0; !&gt;</b>
2285
+ <b>&lt;? foreach my $item (@list) { !&gt;</b>
2286
+ <b>&lt;? $item_ctr++; !&gt;</b>
2287
+ &lt;tr&gt;
2288
+ &lt;td&gt;&lt;?= $item !&gt;&lt;/td&gt;
2289
+ &lt;/tr&gt;
2290
+ <b>&lt;? } !&gt;</b>
2291
+
2292
+ &lt;tr&gt;
2293
+ <b>&lt;? my $item_ctr = 0; !&gt;</b>
2294
+ <b>&lt;? foreach my $item (@list) { !&gt;</b>
2295
+ <b>&lt;? $item_ctr++; !&gt;</b>
2296
+ &lt;td&gt;&lt;?= $item !&gt;&lt;/td&gt;
2297
+ <b>&lt;? } !&gt;</b>
2298
+ &lt;/tr&gt;
2299
+ </pre>
2300
+ <br>
2301
+
2302
+ <br>
2303
+
2304
+
2305
+ <a name="directive-foreach_tgl"></a>
2306
+ <h3 class="section2">FOREACH, LIST</h3>
2307
+ <p>'FOREACH' and 'LIST' directives iterate element or content with loop counter
2308
+ and toggle variable.
2309
+ Toggle values are "'odd'" and "'even'" in default.
2310
+ You can change them by command-line option '--odd' and '--even'
2311
+ or by properties(PROPERTY_ODD, PROPERTY_EVEN) in configuration file.
2312
+ </p>
2313
+ <a name="directive-foreach_tgl-eruby"></a>
2314
+ <h4 class="section3">Ruby</h4>
2315
+ <div class="program_caption">
2316
+ presentation data (ex-foreach_tgl.pdata)</div>
2317
+ <pre class="program">&lt;tr <b>title="FOR item in list"</b>&gt;
2318
+ &lt;td title="cont item"&gt;foo&lt;/td&gt;
2319
+ &lt;/tr&gt;
2320
+
2321
+ &lt;tr <b>title="LIST item in list"</b>&gt;
2322
+ &lt;td title="cont item"&gt;foo&lt;/td&gt;
2323
+ &lt;/tr&gt;
2324
+ </pre>
2325
+ <div class="terminal_caption">
2326
+ compile</div>
2327
+ <pre class="terminal">$ kwartz -l eruby ex-foreach_tgl.pdata
2328
+ <b>&lt;% item_ctr = 0 %&gt;</b>
2329
+ <b>&lt;% for item in list do %&gt;</b>
2330
+ <b>&lt;% item_ctr += 1 %&gt;</b>
2331
+ <b>&lt;% item_tgl = item_ctr%2==0 ? 'even' : 'odd' %&gt;</b>
2332
+ &lt;tr&gt;
2333
+ &lt;td&gt;&lt;%= item %&gt;&lt;/td&gt;
2334
+ &lt;/tr&gt;
2335
+ <b>&lt;% end %&gt;</b>
2336
+
2337
+ &lt;tr&gt;
2338
+ <b>&lt;% item_ctr = 0 %&gt;</b>
2339
+ <b>&lt;% for item in list do %&gt;</b>
2340
+ <b>&lt;% item_ctr += 1 %&gt;</b>
2341
+ <b>&lt;% item_tgl = item_ctr%2==0 ? 'even' : 'odd' %&gt;</b>
2342
+ &lt;td&gt;&lt;%= item %&gt;&lt;/td&gt;
2343
+ <b>&lt;% end %&gt;</b>
2344
+ &lt;/tr&gt;
2345
+ </pre>
2346
+ <br>
2347
+
2348
+ <a name="directive-foreach_tgl-php"></a>
2349
+ <h4 class="section3">PHP</h4>
2350
+ <div class="program_caption">
2351
+ presentation data (ex-foreach_tgl.pdata)</div>
2352
+ <pre class="program">&lt;tr <b>title="FOREACH($list as $item)"</b>&gt;
2353
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
2354
+ &lt;/tr&gt;
2355
+
2356
+ &lt;tr <b>title="LIST($list as $item)"</b>&gt;
2357
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
2358
+ &lt;/tr&gt;
2359
+ </pre>
2360
+ <div class="terminal_caption">
2361
+ compile</div>
2362
+ <pre class="terminal">$ kwartz -l php ex-foreach_tgl.pdata
2363
+ <b>&lt;?php $item_ctr = 0; ?&gt;</b>
2364
+ <b>&lt;?php foreach ($list as $item) { ?&gt;</b>
2365
+ <b>&lt;?php $item_ctr++; ?&gt;</b>
2366
+ <b>&lt;?php $item_tgl = $item_ctr%2==0 ? 'even' : 'odd'; ?&gt;</b>
2367
+ &lt;tr&gt;
2368
+ &lt;td&gt;&lt;?php echo $item; ?&gt;&lt;/td&gt;
2369
+ &lt;/tr&gt;
2370
+ <b>&lt;?php } ?&gt;</b>
2371
+
2372
+ &lt;tr&gt;
2373
+ <b>&lt;?php $item_ctr = 0; ?&gt;</b>
2374
+ <b>&lt;?php foreach ($list as $item) { ?&gt;</b>
2375
+ <b>&lt;?php $item_ctr++; ?&gt;</b>
2376
+ <b>&lt;?php $item_tgl = $item_ctr%2==0 ? 'even' : 'odd'; ?&gt;</b>
2377
+ &lt;td&gt;&lt;?php echo $item; ?&gt;&lt;/td&gt;
2378
+ <b>&lt;?php } ?&gt;</b>
2379
+ &lt;/tr&gt;
2380
+ </pre>
2381
+ <br>
2382
+
2383
+ <a name="directive-foreach_tgl-jstl"></a>
2384
+ <h4 class="section3">JSP</h4>
2385
+ <div class="program_caption">
2386
+ presentation data (ex-foreach_tgl.pdata)</div>
2387
+ <pre class="program">&lt;tr <b>title="FOR(item: list)"</b>&gt;
2388
+ &lt;td title="cont(item)"&gt;foo&lt;/td&gt;
2389
+ &lt;/tr&gt;
2390
+
2391
+ &lt;tr <b>title="LIST(item: list)"</b>&gt;
2392
+ &lt;td title="cont(item)"&gt;foo&lt;/td&gt;
2393
+ &lt;/tr&gt;
2394
+ </pre>
2395
+ <div class="terminal_caption">
2396
+ compile</div>
2397
+ <pre class="terminal">$ kwartz -l jstl ex-foreach_tgl.pdata
2398
+ <b>&lt;c:forEach var="item" items="${list}" varStatus="item_status"&gt;</b>
2399
+ <b>&lt;c:set var="item_ctr" value="${item_status.count}" /&gt;</b>
2400
+ <b>&lt;c:set var="item_tgl" value="${item_status.count%2==0 ? 'even' : 'odd'}" /&gt;</b>
2401
+ &lt;tr&gt;
2402
+ &lt;td&gt;${item}&lt;/td&gt;
2403
+ &lt;/tr&gt;
2404
+ <b>&lt;/c:forEach&gt;</b>
2405
+
2406
+ &lt;tr&gt;
2407
+ <b>&lt;c:forEach var="item" items="${list}" varStatus="item_status"&gt;</b>
2408
+ <b>&lt;c:set var="item_ctr" value="${item_status.count}" /&gt;</b>
2409
+ <b>&lt;c:set var="item_tgl" value="${item_status.count%2==0 ? 'even' : 'odd'}" /&gt;</b>
2410
+ &lt;td&gt;${item}&lt;/td&gt;
2411
+ <b>&lt;/c:forEach&gt;</b>
2412
+ &lt;/tr&gt;
2413
+ </pre>
2414
+ <br>
2415
+
2416
+ <a name="directive-foreach_tgl-eperl"></a>
2417
+ <h4 class="section3">Perl</h4>
2418
+ <div class="program_caption">
2419
+ presentation data (ex-foreach_tgl.pdata)</div>
2420
+ <pre class="program">&lt;tr <b>title="FOREACH($item in @list)"</b>&gt;
2421
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
2422
+ &lt;/tr&gt;
2423
+
2424
+ &lt;tr <b>title="LIST($item in @list)"</b>&gt;
2425
+ &lt;td title="cont($item)"&gt;foo&lt;/td&gt;
2426
+ &lt;/tr&gt;
2427
+ </pre>
2428
+ <div class="terminal_caption">
2429
+ compile</div>
2430
+ <pre class="terminal">$ kwartz -l eperl ex-foreach_tgl.pdata
2431
+ <b>&lt;? my $item_ctr = 0; !&gt;</b>
2432
+ <b>&lt;? foreach my $item (@list) { !&gt;</b>
2433
+ <b>&lt;? $item_ctr++; !&gt;</b>
2434
+ <b>&lt;? my $item_tgl = $item_ctr%2==0 ? 'even' : 'odd'; !&gt;</b>
2435
+ &lt;tr&gt;
2436
+ &lt;td&gt;&lt;?= $item !&gt;&lt;/td&gt;
2437
+ &lt;/tr&gt;
2438
+ <b>&lt;? } !&gt;</b>
2439
+
2440
+ &lt;tr&gt;
2441
+ <b>&lt;? my $item_ctr = 0; !&gt;</b>
2442
+ <b>&lt;? foreach my $item (@list) { !&gt;</b>
2443
+ <b>&lt;? $item_ctr++; !&gt;</b>
2444
+ <b>&lt;? my $item_tgl = $item_ctr%2==0 ? 'even' : 'odd'; !&gt;</b>
2445
+ &lt;td&gt;&lt;?= $item !&gt;&lt;/td&gt;
2446
+ <b>&lt;? } !&gt;</b>
2447
+ &lt;/tr&gt;
2448
+ </pre>
2449
+ <br>
2450
+
2451
+ <br>
2452
+
2453
+
2454
+ <a name="directive-while"></a>
2455
+ <h3 class="section2">while, loop</h3>
2456
+ <p>'while' and 'loop' directive iterates element or content
2457
+ until conditional expression is false.
2458
+ </p>
2459
+ <p>JSTL doesn't support these directives because JSTL doesn't have
2460
+ 'while' custom tag.
2461
+ </p>
2462
+ <a name="directive-while-eruby"></a>
2463
+ <h4 class="section3">Ruby</h4>
2464
+ <div class="program_caption">
2465
+ presentation data (ex-while.pdata)</div>
2466
+ <pre class="program">&lt;tr <b>title="while (item = dbh.fetch) != nil"</b>&gt;
2467
+ &lt;td title="cont item.name"&gt;foo&lt;/td&gt;
2468
+ &lt;/tr&gt;
2469
+
2470
+ &lt;tr <b>title="loop (item = dbh.fetch) != nil"</b>&gt;
2471
+ &lt;td title="cont item.name"&gt;foo&lt;/td&gt;
2472
+ &lt;/tr&gt;
2473
+ </pre>
2474
+ <div class="terminal_caption">
2475
+ compile</div>
2476
+ <pre class="terminal">$ kwartz -l eruby ex-while.pdata
2477
+ <b>&lt;% while (item = dbh.fetch) != nil do %&gt;</b>
2478
+ &lt;tr&gt;
2479
+ &lt;td&gt;&lt;%= item.name %&gt;&lt;/td&gt;
2480
+ &lt;/tr&gt;
2481
+ <b>&lt;% end %&gt;</b>
2482
+
2483
+ &lt;tr&gt;
2484
+ <b>&lt;% while (item = dbh.fetch) != nil do %&gt;</b>
2485
+ &lt;td&gt;&lt;%= item.name %&gt;&lt;/td&gt;
2486
+ <b>&lt;% end %&gt;</b>
2487
+ &lt;/tr&gt;
2488
+ </pre>
2489
+ <br>
2490
+
2491
+ <a name="directive-while-php"></a>
2492
+ <h4 class="section3">PHP</h4>
2493
+ <div class="program_caption">
2494
+ presentation data (ex-while.pdata)</div>
2495
+ <pre class="program">&lt;tr <b>title="while(($item = $dbh-&gt;fetch()) != null)"</b>&gt;
2496
+ &lt;td title="cont($item-&gt;name)"&gt;foo&lt;/td&gt;
2497
+ &lt;/tr&gt;
2498
+
2499
+ &lt;tr <b>title="loop(($item = $dbh-&gt;fetch()) != null)"</b>&gt;
2500
+ &lt;td title="cont($item-&gt;name)"&gt;foo&lt;/td&gt;
2501
+ &lt;/tr&gt;
2502
+ </pre>
2503
+ <div class="terminal_caption">
2504
+ compile</div>
2505
+ <pre class="terminal">$ kwartz -l php ex-while.pdata
2506
+ <b>&lt;?php while (($item = $dbh-&gt;fetch()) != null) { ?&gt;</b>
2507
+ &lt;tr&gt;
2508
+ &lt;td&gt;&lt;?php echo $item-&gt;name; ?&gt;&lt;/td&gt;
2509
+ &lt;/tr&gt;
2510
+ <b>&lt;?php } ?&gt;</b>
2511
+
2512
+ &lt;tr&gt;
2513
+ <b>&lt;?php while (($item = $dbh-&gt;fetch()) != null) { ?&gt;</b>
2514
+ &lt;td&gt;&lt;?php echo $item-&gt;name; ?&gt;&lt;/td&gt;
2515
+ <b>&lt;?php } ?&gt;</b>
2516
+ &lt;/tr&gt;
2517
+ </pre>
2518
+ <br>
2519
+
2520
+ <a name="directive-while-jstl"></a>
2521
+ <h4 class="section3">JSP</h4>
2522
+ <div class="program_caption">
2523
+ presentation data (ex-while.pdata)</div>
2524
+ <pre class="program">*** not supported ***
2525
+ </pre>
2526
+ <div class="terminal_caption">
2527
+ compile</div>
2528
+ <pre class="terminal">$ kwartz -l jstl ex-while.pdata
2529
+ *** not supported ***
2530
+ </pre>
2531
+ <br>
2532
+
2533
+ <a name="directive-while-eperl"></a>
2534
+ <h4 class="section3">Perl</h4>
2535
+ <div class="program_caption">
2536
+ presentation data (ex-while.pdata)</div>
2537
+ <pre class="program">&lt;tr <b>title="while(($item = $dbh-&gt;fetch()) != null)"</b>&gt;
2538
+ &lt;td title="cont($item-&gt;name)"&gt;foo&lt;/td&gt;
2539
+ &lt;/tr&gt;
2540
+
2541
+ &lt;tr <b>title="loop(($item = $dbh-&gt;fetch()) != null)"</b>&gt;
2542
+ &lt;td title="cont($item-&gt;name)"&gt;foo&lt;/td&gt;
2543
+ &lt;/tr&gt;
2544
+ </pre>
2545
+ <div class="terminal_caption">
2546
+ compile</div>
2547
+ <pre class="terminal">$ kwartz -l eperl ex-while.pdata
2548
+ <b>&lt;? while (($item = $dbh-&gt;fetch()) != null) { !&gt;</b>
2549
+ &lt;tr&gt;
2550
+ &lt;td&gt;&lt;?= $item-&gt;name !&gt;&lt;/td&gt;
2551
+ &lt;/tr&gt;
2552
+ <b>&lt;? } !&gt;</b>
2553
+
2554
+ &lt;tr&gt;
2555
+ <b>&lt;? while (($item = $dbh-&gt;fetch()) != null) { !&gt;</b>
2556
+ &lt;td&gt;&lt;?= $item-&gt;name !&gt;&lt;/td&gt;
2557
+ <b>&lt;? } !&gt;</b>
2558
+ &lt;/tr&gt;
2559
+ </pre>
2560
+ <br>
2561
+
2562
+ <br>
2563
+
2564
+
2565
+ <a name="directive-if"></a>
2566
+ <h3 class="section2">if-then-else</h3>
2567
+ <p>'if', 'elsif'(or 'elseif'), and 'else' directives represent conditional branch.
2568
+ </p>
2569
+ <p>Don't separate with empty lines between end-tag of 'if'/'elseif' directive and
2570
+ start-tag of 'elseif'/'else' directive.
2571
+ </p>
2572
+ <a name="directive-if-eruby"></a>
2573
+ <h4 class="section3">Ruby</h4>
2574
+ <div class="program_caption">
2575
+ presentation data (ex-if.pdata)</div>
2576
+ <pre class="program">&lt;div <b>title="if status=='error'"</b>&gt;
2577
+ &lt;p class="error" title="cont mesg"&gt;error&lt;/p&gt;
2578
+ &lt;/div&gt;
2579
+ &lt;div <b>title="elsif status=='warning'"</b>&gt;
2580
+ &lt;p class="warning" title="cont mesg"&gt;waring&lt;/p&gt;
2581
+ &lt;/div&gt;
2582
+ &lt;div <b>title="else"</b>&gt;
2583
+ &lt;p title="cont mesg"&gt;mesg&lt;/p&gt;
2584
+ &lt;/div&gt;
2585
+ </pre>
2586
+ <div class="terminal_caption">
2587
+ compile</div>
2588
+ <pre class="terminal">$ kwartz -l eruby ex-if.pdata
2589
+ <b>&lt;% if status=='error' then %&gt;</b>
2590
+ &lt;div&gt;
2591
+ &lt;p class="error"&gt;&lt;%= mesg %&gt;&lt;/p&gt;
2592
+ &lt;/div&gt;
2593
+ <b>&lt;% elsif status=='warning' then %&gt;</b>
2594
+ &lt;div&gt;
2595
+ &lt;p class="warning"&gt;&lt;%= mesg %&gt;&lt;/p&gt;
2596
+ &lt;/div&gt;
2597
+ <b>&lt;% else %&gt;</b>
2598
+ &lt;div&gt;
2599
+ &lt;p&gt;&lt;%= mesg %&gt;&lt;/p&gt;
2600
+ &lt;/div&gt;
2601
+ <b>&lt;% end %&gt;</b>
2602
+ </pre>
2603
+ <br>
2604
+
2605
+ <a name="directive-if-php"></a>
2606
+ <h4 class="section3">PHP</h4>
2607
+ <div class="program_caption">
2608
+ presentation data (ex-if.pdata)</div>
2609
+ <pre class="program">&lt;div <b>title="if($status=='error')"</b>&gt;
2610
+ &lt;p class="error" title="cont($mesg)"&gt;error&lt;/p&gt;
2611
+ &lt;/div&gt;
2612
+ &lt;div <b>title="elseif($status=='warning')"</b>&gt;
2613
+ &lt;p class="warning" title="cont($mesg)"&gt;waring&lt;/p&gt;
2614
+ &lt;/div&gt;
2615
+ &lt;div <b>title="else"</b>&gt;
2616
+ &lt;p title="cont($mesg)"&gt;mesg&lt;/p&gt;
2617
+ &lt;/div&gt;
2618
+ </pre>
2619
+ <div class="terminal_caption">
2620
+ compile</div>
2621
+ <pre class="terminal">$ kwartz -l php ex-if.pdata
2622
+ <b>&lt;?php if ($status=='error') { ?&gt;</b>
2623
+ &lt;div&gt;
2624
+ &lt;p class="error"&gt;&lt;?php echo $mesg; ?&gt;&lt;/p&gt;
2625
+ &lt;/div&gt;
2626
+ <b>&lt;?php } elseif ($status=='warning') { ?&gt;</b>
2627
+ &lt;div&gt;
2628
+ &lt;p class="warning"&gt;&lt;?php echo $mesg; ?&gt;&lt;/p&gt;
2629
+ &lt;/div&gt;
2630
+ <b>&lt;?php } else { ?&gt;</b>
2631
+ &lt;div&gt;
2632
+ &lt;p&gt;&lt;?php echo $mesg; ?&gt;&lt;/p&gt;
2633
+ &lt;/div&gt;
2634
+ <b>&lt;?php } ?&gt;</b>
2635
+ </pre>
2636
+ <br>
2637
+
2638
+ <a name="directive-if-jstl"></a>
2639
+ <h4 class="section3">JSP</h4>
2640
+ <div class="program_caption">
2641
+ presentation data (ex-if.pdata)</div>
2642
+ <pre class="program">&lt;div <b>title="if(status=='error')"</b>&gt;
2643
+ &lt;p class="error" title="cont(mesg)"&gt;error&lt;/p&gt;
2644
+ &lt;/div&gt;
2645
+ &lt;div <b>title="elseif(status=='warning')"</b>&gt;
2646
+ &lt;p class="warning" title="cont(mesg)"&gt;waring&lt;/p&gt;
2647
+ &lt;/div&gt;
2648
+ &lt;div <b>title="else"</b>&gt;
2649
+ &lt;p title="cont(mesg)"&gt;mesg&lt;/p&gt;
2650
+ &lt;/div&gt;
2651
+ </pre>
2652
+ <div class="terminal_caption">
2653
+ compile</div>
2654
+ <pre class="terminal">$ kwartz -l jstl ex-if.pdata
2655
+ <b>&lt;c:choose&gt;&lt;c:when test="${status=='error'}"&gt;</b>
2656
+ &lt;div&gt;
2657
+ &lt;p class="error"&gt;${mesg}&lt;/p&gt;
2658
+ &lt;/div&gt;
2659
+ <b>&lt;/c:when&gt;&lt;c:when test="${status=='warning'}"&gt;</b>
2660
+ &lt;div&gt;
2661
+ &lt;p class="warning"&gt;${mesg}&lt;/p&gt;
2662
+ &lt;/div&gt;
2663
+ <b>&lt;/c:when&gt;&lt;c:otherwise&gt;</b>
2664
+ &lt;div&gt;
2665
+ &lt;p&gt;${mesg}&lt;/p&gt;
2666
+ &lt;/div&gt;
2667
+ <b>&lt;/c:otherwise&gt;&lt;/c:choose&gt;</b>
2668
+ </pre>
2669
+ <br>
2670
+
2671
+ <a name="directive-if-eperl"></a>
2672
+ <h4 class="section3">Perl</h4>
2673
+ <div class="program_caption">
2674
+ presentation data (ex-if.pdata)</div>
2675
+ <pre class="program">&lt;div <b>title="if($status=='error')"</b>&gt;
2676
+ &lt;p class="error" title="cont($mesg)"&gt;error&lt;/p&gt;
2677
+ &lt;/div&gt;
2678
+ &lt;div <b>title="elsif($status=='warning')"</b>&gt;
2679
+ &lt;p class="warning" title="cont($mesg)"&gt;waring&lt;/p&gt;
2680
+ &lt;/div&gt;
2681
+ &lt;div <b>title="else"</b>&gt;
2682
+ &lt;p title="cont($mesg)"&gt;mesg&lt;/p&gt;
2683
+ &lt;/div&gt;
2684
+ </pre>
2685
+ <div class="terminal_caption">
2686
+ compile</div>
2687
+ <pre class="terminal">$ kwartz -l eperl ex-if.pdata
2688
+ <b>&lt;? if ($status=='error') { !&gt;</b>
2689
+ &lt;div&gt;
2690
+ &lt;p class="error"&gt;&lt;?= $mesg !&gt;&lt;/p&gt;
2691
+ &lt;/div&gt;
2692
+ <b>&lt;? } elsif ($status=='warning') { !&gt;</b>
2693
+ &lt;div&gt;
2694
+ &lt;p class="warning"&gt;&lt;?= $mesg !&gt;&lt;/p&gt;
2695
+ &lt;/div&gt;
2696
+ <b>&lt;? } else { !&gt;</b>
2697
+ &lt;div&gt;
2698
+ &lt;p&gt;&lt;?= $mesg !&gt;&lt;/p&gt;
2699
+ &lt;/div&gt;
2700
+ <b>&lt;? } !&gt;</b>
2701
+ </pre>
2702
+ <br>
2703
+
2704
+ <br>
2705
+
2706
+
2707
+ <a name="directive-set"></a>
2708
+ <h3 class="section2">set</h3>
2709
+ <p>'set' directive executes any expression.
2710
+ </p>
2711
+ <a name="directive-set-eruby"></a>
2712
+ <h4 class="section3">Ruby</h4>
2713
+ <div class="program_caption">
2714
+ presentation data (ex-set.pdata)</div>
2715
+ <pre class="program">&lt;tr <b>title="set color=i%2==0 ? 'red' : 'blue'"</b>&gt;
2716
+ &lt;td title="cont: color"&gt;red&lt;/td&gt;
2717
+ &lt;/tr&gt;
2718
+ </pre>
2719
+ <div class="terminal_caption">
2720
+ compile</div>
2721
+ <pre class="terminal">$ kwartz -l eruby ex-set.pdata
2722
+ <b>&lt;% color=i%2==0 ? 'red' : 'blue' %&gt;</b>
2723
+ &lt;tr&gt;
2724
+ &lt;td&gt;&lt;%= color %&gt;&lt;/td&gt;
2725
+ &lt;/tr&gt;
2726
+ </pre>
2727
+ <br>
2728
+
2729
+ <a name="directive-set-php"></a>
2730
+ <h4 class="section3">PHP</h4>
2731
+ <div class="program_caption">
2732
+ presentation data (ex-set.pdata)</div>
2733
+ <pre class="program">&lt;tr <b>title="set($color=$i%2==0 ? 'red' : 'blue')"</b>&gt;
2734
+ &lt;td title="cont($color)"&gt;red&lt;/td&gt;
2735
+ &lt;/tr&gt;
2736
+ </pre>
2737
+ <div class="terminal_caption">
2738
+ compile</div>
2739
+ <pre class="terminal">$ kwartz -l php ex-set.pdata
2740
+ <b>&lt;?php $color=$i%2==0 ? 'red' : 'blue'; ?&gt;</b>
2741
+ &lt;tr&gt;
2742
+ &lt;td&gt;&lt;?php echo $color; ?&gt;&lt;/td&gt;
2743
+ &lt;/tr&gt;
2744
+ </pre>
2745
+ <br>
2746
+
2747
+ <a name="directive-set-jstl"></a>
2748
+ <h4 class="section3">JSP</h4>
2749
+ <div class="program_caption">
2750
+ presentation data (ex-set.pdata)</div>
2751
+ <pre class="program">&lt;tr <b>title="set(color=i%2==0 ? 'red' : 'blue')"</b>&gt;
2752
+ &lt;td title="cont(color)"&gt;red&lt;/td&gt;
2753
+ &lt;/tr&gt;
2754
+ </pre>
2755
+ <div class="terminal_caption">
2756
+ compile</div>
2757
+ <pre class="terminal">$ kwartz -l jstl ex-set.pdata
2758
+ <b>&lt;c:set var="color=i%2=" value="${0 ? 'red' : 'blue'}" /&gt;</b>
2759
+ &lt;tr&gt;
2760
+ &lt;td&gt;${color}&lt;/td&gt;
2761
+ &lt;/tr&gt;
2762
+ </pre>
2763
+ <br>
2764
+
2765
+ <a name="directive-set-eperl"></a>
2766
+ <h4 class="section3">Perl</h4>
2767
+ <div class="program_caption">
2768
+ presentation data (ex-set.pdata)</div>
2769
+ <pre class="program">&lt;tr <b>title="set($color=i%2==0 ? 'red' : 'blue')"</b>&gt;
2770
+ &lt;td title="cont($color)"&gt;red&lt;/td&gt;
2771
+ &lt;/tr&gt;
2772
+ </pre>
2773
+ <div class="terminal_caption">
2774
+ compile</div>
2775
+ <pre class="terminal">$ kwartz -l eperl ex-set.pdata
2776
+ <b>&lt;? $color=i%2==0 ? 'red' : 'blue'; !&gt;</b>
2777
+ &lt;tr&gt;
2778
+ &lt;td&gt;&lt;?= $color !&gt;&lt;/td&gt;
2779
+ &lt;/tr&gt;
2780
+ </pre>
2781
+ <br>
2782
+
2783
+ <br>
2784
+
2785
+
2786
+ <a name="directive-mark"></a>
2787
+ <h3 class="section2">mark</h3>
2788
+ <p>'mark' directive marks the element by name.
2789
+ Name is used as selector of ruleset in presentation logic file.
2790
+ Id attribute is equivalent to 'mark' directive if other direcitve is not specified.
2791
+ </p>
2792
+ <p>'mark' directive is language-independent when used with id attribute.
2793
+ </p>
2794
+ <a name="directive-mark-eruby"></a>
2795
+ <h4 class="section3">Ruby</h4>
2796
+ <div class="program_caption">
2797
+ presentation data (ex-mark.pdata)</div>
2798
+ <pre class="program">&lt;ul <b>id="mark:list"</b>&gt;
2799
+ &lt;li <b>title="id: item"</b>&gt;foo&lt;/li&gt;
2800
+ &lt;/ul&gt;
2801
+ </pre>
2802
+ <div class="terminal_caption">
2803
+ compile</div>
2804
+ <pre class="terminal">$ kwartz -l eruby ex-mark.pdata
2805
+ &lt;ul&gt;
2806
+ &lt;li&gt;foo&lt;/li&gt;
2807
+ &lt;/ul&gt;
2808
+ </pre>
2809
+ <br>
2810
+
2811
+ <a name="directive-mark-php"></a>
2812
+ <h4 class="section3">PHP</h4>
2813
+ <div class="program_caption">
2814
+ presentation data (ex-mark.pdata)</div>
2815
+ <pre class="program">&lt;ul <b>id="mark:list"</b>&gt;
2816
+ &lt;li <b>title="id(item)"</b>&gt;foo&lt;/li&gt;
2817
+ &lt;/ul&gt;
2818
+ </pre>
2819
+ <div class="terminal_caption">
2820
+ compile</div>
2821
+ <pre class="terminal">$ kwartz -l php ex-mark.pdata
2822
+ &lt;ul&gt;
2823
+ &lt;li&gt;foo&lt;/li&gt;
2824
+ &lt;/ul&gt;
2825
+ </pre>
2826
+ <br>
2827
+
2828
+ <a name="directive-mark-jstl"></a>
2829
+ <h4 class="section3">JSP</h4>
2830
+ <div class="program_caption">
2831
+ presentation data (ex-mark.pdata)</div>
2832
+ <pre class="program">&lt;ul <b>id="mark:list"</b>&gt;
2833
+ &lt;li <b>title="id(item)"</b>&gt;foo&lt;/li&gt;
2834
+ &lt;/ul&gt;
2835
+ </pre>
2836
+ <div class="terminal_caption">
2837
+ compile</div>
2838
+ <pre class="terminal">$ kwartz -l jstl ex-mark.pdata
2839
+ &lt;ul&gt;
2840
+ &lt;li&gt;foo&lt;/li&gt;
2841
+ &lt;/ul&gt;
2842
+ </pre>
2843
+ <br>
2844
+
2845
+ <a name="directive-mark-eperl"></a>
2846
+ <h4 class="section3">Perl</h4>
2847
+ <div class="program_caption">
2848
+ presentation data (ex-mark.pdata)</div>
2849
+ <pre class="program">&lt;ul <b>id="mark:list"</b>&gt;
2850
+ &lt;li <b>title="id(item)"</b>&gt;foo&lt;/li&gt;
2851
+ &lt;/ul&gt;
2852
+ </pre>
2853
+ <div class="terminal_caption">
2854
+ compile</div>
2855
+ <pre class="terminal">$ kwartz -l eperl ex-mark.pdata
2856
+ &lt;ul&gt;
2857
+ &lt;li&gt;foo&lt;/li&gt;
2858
+ &lt;/ul&gt;
2859
+ </pre>
2860
+ <br>
2861
+
2862
+ <br>
2863
+
2864
+
2865
+ <a name="directive-attr"></a>
2866
+ <h3 class="section2">attr, Attr, ATTR</h3>
2867
+ <p>'attr', 'Attr', and 'ATTR' directives replace attribute value with expression.
2868
+ 'Attr' directive escapes expression automatically, while 'ATTR' never escape it.
2869
+ 'attr' directive escapes expression when command-line option '-e' is specified
2870
+ or PROPERTY_ESCAPE is true in configuration file.
2871
+ </p>
2872
+ <p>More than one directives are available in an element with separating by ';',
2873
+ and available with other directive.
2874
+ </p>
2875
+ <a name="directive-attr-eruby"></a>
2876
+ <h4 class="section3">Ruby</h4>
2877
+ <div class="program_caption">
2878
+ presentation data (ex-attr.pdata)</div>
2879
+ <pre class="program">&lt;tr class="odd"
2880
+ title="FOR v in list; <b>attr: 'class' v_tgl; attr: 'style' style</b>"&gt;
2881
+ &lt;td title="cont v.name"&gt;foo&lt;/td&gt;
2882
+ &lt;/tr&gt;
2883
+ </pre>
2884
+ <div class="terminal_caption">
2885
+ compile</div>
2886
+ <pre class="terminal">$ kwartz -l eruby ex-attr.pdata
2887
+ &lt;% v_ctr = 0 %&gt;
2888
+ &lt;% for v in list do %&gt;
2889
+ &lt;% v_ctr += 1 %&gt;
2890
+ &lt;% v_tgl = v_ctr%2==0 ? 'even' : 'odd' %&gt;
2891
+ &lt;tr <b>class="&lt;%= v_tgl %&gt;"</b> <b>style="&lt;%= style %&gt;"&gt;</b>
2892
+ &lt;td&gt;&lt;%= v.name %&gt;&lt;/td&gt;
2893
+ &lt;/tr&gt;
2894
+ &lt;% end %&gt;
2895
+ </pre>
2896
+ <br>
2897
+
2898
+ <a name="directive-attr-php"></a>
2899
+ <h4 class="section3">PHP</h4>
2900
+ <div class="program_caption">
2901
+ presentation data (ex-attr.pdata)</div>
2902
+ <pre class="program">&lt;tr class="odd"
2903
+ title="FOREACH($list as $v); <b>attr('class',$v_tgl); attr('style',$style)</b>"&gt;
2904
+ &lt;td title="cont($v-&gt;name)"&gt;foo&lt;/td&gt;
2905
+ &lt;/tr&gt;
2906
+ </pre>
2907
+ <div class="terminal_caption">
2908
+ compile</div>
2909
+ <pre class="terminal">$ kwartz -l php ex-attr.pdata
2910
+ &lt;?php $v_ctr = 0; ?&gt;
2911
+ &lt;?php foreach ($list as $v) { ?&gt;
2912
+ &lt;?php $v_ctr++; ?&gt;
2913
+ &lt;?php $v_tgl = $v_ctr%2==0 ? 'even' : 'odd'; ?&gt;
2914
+ &lt;tr <b>class="&lt;?php echo $v_tgl; ?&gt;"</b> <b>style="&lt;?php echo $style; ?&gt;"</b>&gt;
2915
+ &lt;td&gt;&lt;?php echo $v-&gt;name; ?&gt;&lt;/td&gt;
2916
+ &lt;/tr&gt;
2917
+ &lt;?php } ?&gt;
2918
+ </pre>
2919
+ <br>
2920
+
2921
+ <a name="directive-attr-jstl"></a>
2922
+ <h4 class="section3">JSP</h4>
2923
+ <div class="program_caption">
2924
+ presentation data (ex-attr.pdata)</div>
2925
+ <pre class="program">&lt;tr class="odd"
2926
+ title="FOR(v: list); <b>attr('class',v_tgl); attr('style',style)</b>"&gt;
2927
+ &lt;td title="cont(v.name)"&gt;foo&lt;/td&gt;
2928
+ &lt;/tr&gt;
2929
+ </pre>
2930
+ <div class="terminal_caption">
2931
+ compile</div>
2932
+ <pre class="terminal">$ kwartz -l jstl ex-attr.pdata
2933
+ &lt;c:forEach var="v" items="${list}" varStatus="v_status"&gt;
2934
+ &lt;c:set var="v_ctr" value="${v_status.count}" /&gt;
2935
+ &lt;c:set var="v_tgl" value="${v_status.count%2==0 ? 'even' : 'odd'}" /&gt;
2936
+ &lt;tr <b>class="${v_tgl}"</b> <b>style="${style}"</b>&gt;
2937
+ &lt;td&gt;${v.name}&lt;/td&gt;
2938
+ &lt;/tr&gt;
2939
+ &lt;/c:forEach&gt;
2940
+ </pre>
2941
+ <br>
2942
+
2943
+ <a name="directive-attr-eperl"></a>
2944
+ <h4 class="section3">Perl</h4>
2945
+ <div class="program_caption">
2946
+ presentation data (ex-attr.pdata)</div>
2947
+ <pre class="program">&lt;tr class="odd"
2948
+ title="FOREACH($v in @list); <b>attr('class',$v_tgl); attr('style',$style)</b>"&gt;
2949
+ &lt;td title="cont($v-&gt;name)"&gt;foo&lt;/td&gt;
2950
+ &lt;/tr&gt;
2951
+ </pre>
2952
+ <div class="terminal_caption">
2953
+ compile</div>
2954
+ <pre class="terminal">$ kwartz -l eperl ex-attr.pdata
2955
+ &lt;? my $v_ctr = 0; !&gt;
2956
+ &lt;? foreach my $v (@list) { !&gt;
2957
+ &lt;? $v_ctr++; !&gt;
2958
+ &lt;? my $v_tgl = $v_ctr%2==0 ? 'even' : 'odd'; !&gt;
2959
+ &lt;tr <b>class="&lt;?= $v_tgl !&gt;"</b> <b>style="&lt;?= $style !&gt;"</b>&gt;
2960
+ &lt;td&gt;&lt;?= $v-&gt;name !&gt;&lt;/td&gt;
2961
+ &lt;/tr&gt;
2962
+ &lt;? } !&gt;
2963
+ </pre>
2964
+ <br>
2965
+
2966
+ <br>
2967
+
2968
+
2969
+ <a name="directive-append"></a>
2970
+ <h3 class="section2">append, Append, APPEND</h3>
2971
+ <p>'append', 'Append', and 'APPEND' directives append expression at the end of start-tag.
2972
+ 'Append' directive escapes expression automatically, while 'APPEND' never escape it.
2973
+ 'append' directive escapes expression when command-line option '-e' is specified
2974
+ or PROPERTY_ESCAPE is true in configuration file.
2975
+ </p>
2976
+ <p>More than one directives are available in an element with separating by ';',
2977
+ and available with other directive.
2978
+ </p>
2979
+ <a name="directive-append-eruby"></a>
2980
+ <h4 class="section3">Ruby</h4>
2981
+ <div class="program_caption">
2982
+ presentation data (ex-append.pdata)</div>
2983
+ <pre class="program">&lt;input type="checkbox"
2984
+ <b>title="append: flag1 ? ' checked=\'checked\'' : ''"</b>&gt;
2985
+ </pre>
2986
+ <div class="terminal_caption">
2987
+ compile</div>
2988
+ <pre class="terminal">$ kwartz -l eruby ex-append.pdata
2989
+ &lt;input type="checkbox"<b>&lt;%= flag1 ? ' checked=\'checked\'' : '' %&gt;</b>&gt;
2990
+ </pre>
2991
+ <br>
2992
+
2993
+ <a name="directive-append-php"></a>
2994
+ <h4 class="section3">PHP</h4>
2995
+ <div class="program_caption">
2996
+ presentation data (ex-append.pdata)</div>
2997
+ <pre class="program">&lt;input type="checkbox"
2998
+ <b>title="append($flag1 ? ' checked=\'checked\'' : '')"</b>&gt;
2999
+ </pre>
3000
+ <div class="terminal_caption">
3001
+ compile</div>
3002
+ <pre class="terminal">$ kwartz -l php ex-append.pdata
3003
+ &lt;input type="checkbox"<b>&lt;?php echo $flag1 ? ' checked=\'checked\'' : ''; ?&gt;</b>&gt;
3004
+ </pre>
3005
+ <br>
3006
+
3007
+ <a name="directive-append-jstl"></a>
3008
+ <h4 class="section3">JSP</h4>
3009
+ <div class="program_caption">
3010
+ presentation data (ex-append.pdata)</div>
3011
+ <pre class="program">&lt;input type="checkbox"
3012
+ <b>title="append(flag1 ? ' checked=\'checked\'' : '')"</b>&gt;
3013
+ </pre>
3014
+ <div class="terminal_caption">
3015
+ compile</div>
3016
+ <pre class="terminal">$ kwartz -l jstl ex-append.pdata
3017
+ &lt;input type="checkbox"<b>${flag1 ? ' checked=\'checked\'' : ''}</b>&gt;
3018
+ </pre>
3019
+ <br>
3020
+
3021
+ <a name="directive-append-eperl"></a>
3022
+ <h4 class="section3">Perl</h4>
3023
+ <div class="program_caption">
3024
+ presentation data (ex-append.pdata)</div>
3025
+ <pre class="program">&lt;input type="checkbox"
3026
+ <b>title="append($flag1 ? ' checked=\'checked\'' : '')"</b>&gt;
3027
+ </pre>
3028
+ <div class="terminal_caption">
3029
+ compile</div>
3030
+ <pre class="terminal">$ kwartz -l eperl ex-append.pdata
3031
+ &lt;input type="checkbox"<b>&lt;?= $flag1 ? ' checked=\'checked\'' : '' !&gt;</b>&gt;
3032
+ </pre>
3033
+ <br>
3034
+
3035
+ <br>
3036
+
3037
+
3038
+ <a name="directive-dummy"></a>
3039
+ <h3 class="section2">dummy</h3>
3040
+ <p>'dummy' directive removes the element.
3041
+ It is very useful when preview the HTML design in browser.
3042
+ </p>
3043
+ <p>'dummy' directive is language-independent when used with id attribute.
3044
+ </p>
3045
+ <a name="directive-dummy-eruby"></a>
3046
+ <h4 class="section3">Ruby</h4>
3047
+ <div class="program_caption">
3048
+ presentation data (ex-dummy.pdata)</div>
3049
+ <pre class="program">&lt;ul&gt;
3050
+ &lt;li&gt;foo&lt;/li&gt;
3051
+ &lt;li <b>id="dummy:d1"</b>&gt;bar&lt;/li&gt;
3052
+ &lt;li <b>title="dummy:"</b>&gt;baz&lt;/li&gt;
3053
+ &lt;/ul&gt;
3054
+ </pre>
3055
+ <div class="terminal_caption">
3056
+ compile</div>
3057
+ <pre class="terminal">$ kwartz -l eruby ex-dummy.pdata
3058
+ &lt;ul&gt;
3059
+ &lt;li&gt;foo&lt;/li&gt;
3060
+ &lt;/ul&gt;
3061
+ </pre>
3062
+ <br>
3063
+
3064
+ <a name="directive-dummy-php"></a>
3065
+ <h4 class="section3">PHP</h4>
3066
+ <div class="program_caption">
3067
+ presentation data (ex-dummy.pdata)</div>
3068
+ <pre class="program">&lt;ul&gt;
3069
+ &lt;li&gt;foo&lt;/li&gt;
3070
+ &lt;li <b>id="dummy:d1"</b>&gt;bar&lt;/li&gt;
3071
+ &lt;li <b>title="dummy()"</b>&gt;baz&lt;/li&gt;
3072
+ &lt;/ul&gt;
3073
+ </pre>
3074
+ <div class="terminal_caption">
3075
+ compile</div>
3076
+ <pre class="terminal">$ kwartz -l php ex-dummy.pdata
3077
+ &lt;ul&gt;
3078
+ &lt;li&gt;foo&lt;/li&gt;
3079
+ &lt;/ul&gt;
3080
+ </pre>
3081
+ <br>
3082
+
3083
+ <a name="directive-dummy-jstl"></a>
3084
+ <h4 class="section3">JSP</h4>
3085
+ <div class="program_caption">
3086
+ presentation data (ex-dummy.pdata)</div>
3087
+ <pre class="program">&lt;ul&gt;
3088
+ &lt;li&gt;foo&lt;/li&gt;
3089
+ &lt;li <b>id="dummy:d1"</b>&gt;bar&lt;/li&gt;
3090
+ &lt;li <b>title="dummy()"</b>&gt;baz&lt;/li&gt;
3091
+ &lt;/ul&gt;
3092
+ </pre>
3093
+ <div class="terminal_caption">
3094
+ compile</div>
3095
+ <pre class="terminal">$ kwartz -l jstl ex-dummy.pdata
3096
+ &lt;ul&gt;
3097
+ &lt;li&gt;foo&lt;/li&gt;
3098
+ &lt;/ul&gt;
3099
+ </pre>
3100
+ <br>
3101
+
3102
+ <a name="directive-dummy-eperl"></a>
3103
+ <h4 class="section3">Perl</h4>
3104
+ <div class="program_caption">
3105
+ presentation data (ex-dummy.pdata)</div>
3106
+ <pre class="program">&lt;ul&gt;
3107
+ &lt;li&gt;foo&lt;/li&gt;
3108
+ &lt;li <b>id="dummy:d1"</b>&gt;bar&lt;/li&gt;
3109
+ &lt;li <b>title="dummy()"</b>&gt;baz&lt;/li&gt;
3110
+ &lt;/ul&gt;
3111
+ </pre>
3112
+ <div class="terminal_caption">
3113
+ compile</div>
3114
+ <pre class="terminal">$ kwartz -l eperl ex-dummy.pdata
3115
+ &lt;ul&gt;
3116
+ &lt;li&gt;foo&lt;/li&gt;
3117
+ &lt;/ul&gt;
3118
+ </pre>
3119
+ <br>
3120
+
3121
+ <br>
3122
+
3123
+
3124
+ <a name="directive-default"></a>
3125
+ <h3 class="section2">default, Default, DEFAULT</h3>
3126
+ <p>'default', 'Default', and 'DEFAULT' directive replaces content by expression
3127
+ only if expression is not nil, false, nor empty string.
3128
+ </p>
3129
+ <p>'Default' directive escapes expression automatically, while 'DEFAULT' never escape it.
3130
+ 'default' directive escapes expression when command-line option '-e' is specified
3131
+ or PROPERTY_ESCAPE is true in configuration file.
3132
+ </p>
3133
+ <a name="directive-default-eruby"></a>
3134
+ <h4 class="section3">Ruby</h4>
3135
+ <div class="program_caption">
3136
+ presentation data (ex-default.pdata)</div>
3137
+ <pre class="program">name: &lt;em <b>title="default: user"</b>&gt;Guest&lt;/em&gt;
3138
+ </pre>
3139
+ <div class="terminal_caption">
3140
+ compile</div>
3141
+ <pre class="terminal">$ kwartz -l eruby ex-default.pdata
3142
+ name: &lt;em&gt;<b>&lt;% if (user) &amp;&amp; !(user).to_s.empty? then %&gt;&lt;%= user %&gt;&lt;% else %&gt;Guest&lt;% end %&gt;</b>&lt;/em&gt;
3143
+ </pre>
3144
+ <br>
3145
+
3146
+ <a name="directive-default-php"></a>
3147
+ <h4 class="section3">PHP</h4>
3148
+ <div class="program_caption">
3149
+ presentation data (ex-default.pdata)</div>
3150
+ <pre class="program">name: &lt;em <b>title="default($user)"</b>&gt;Guest&lt;/em&gt;
3151
+ </pre>
3152
+ <div class="terminal_caption">
3153
+ compile</div>
3154
+ <pre class="terminal">$ kwartz -l php ex-default.pdata
3155
+ name: &lt;em&gt;<b>&lt;?php if ($user) { ?&gt;&lt;?php echo $user; ?&gt;&lt;?php } else { ?&gt;Guest&lt;?php } ?&gt;</b>&lt;/em&gt;
3156
+ </pre>
3157
+ <br>
3158
+
3159
+ <a name="directive-default-jstl"></a>
3160
+ <h4 class="section3">JSP</h4>
3161
+ <div class="program_caption">
3162
+ presentation data (ex-default.pdata)</div>
3163
+ <pre class="program">name: &lt;em <b>title="default(user)"</b>&gt;Guest&lt;/em&gt;
3164
+ </pre>
3165
+ <div class="terminal_caption">
3166
+ compile</div>
3167
+ <pre class="terminal">$ kwartz -l jstl ex-default.pdata
3168
+ name: &lt;em&gt;<b>&lt;c:out value="${user}" default="Guest" /&gt;</b>&lt;/em&gt;
3169
+ </pre>
3170
+ <br>
3171
+
3172
+ <a name="directive-default-eperl"></a>
3173
+ <h4 class="section3">Perl</h4>
3174
+ <div class="program_caption">
3175
+ presentation data (ex-default.pdata)</div>
3176
+ <pre class="program">name: &lt;em <b>title="default($user)"</b>&gt;Guest&lt;/em&gt;
3177
+ </pre>
3178
+ <div class="terminal_caption">
3179
+ compile</div>
3180
+ <pre class="terminal">$ kwartz -l eperl ex-default.pdata
3181
+ name: &lt;em&gt;<b>&lt;? if ($user) { !&gt;&lt;?= $user !&gt;&lt;? } else { !&gt;Guest&lt;? } !&gt;</b>&lt;/em&gt;
3182
+ </pre>
3183
+ <br>
3184
+
3185
+ <br>
3186
+
3187
+
3188
+ <a name="directive-replace"></a>
3189
+ <h3 class="section2">replace_element/content_with_element/content</h3>
3190
+ <p>'replace_element_with_element', 'replace_element_with_content',
3191
+ 'replace_content_with_element', and 'replace_content_with_content'
3192
+ directives replace element or content with other element or content.
3193
+ </p>
3194
+ <p>These directives are language-independent when used with id attribute.
3195
+ </p>
3196
+ <a name="directive-replace-eruby"></a>
3197
+ <h4 class="section3">Ruby, PHP, JSP, Perl</h4>
3198
+ <div class="program_caption">
3199
+ presentation data (ex-replace.pdata)</div>
3200
+ <pre class="program">&lt;div <b>id="mark:link"</b>&gt;
3201
+ back to &lt;a href="/"&gt;home&lt;/a&gt;.
3202
+ &lt;/div&gt;
3203
+
3204
+ &lt;!-- replace element with other element --&gt;
3205
+ &lt;p <b>id="replace_element_with_element:link"</b>&gt;
3206
+ back to home
3207
+ &lt;/p&gt;
3208
+
3209
+ &lt;!-- replace element with other content--&gt;
3210
+ &lt;p <b>id="replace_element_with_content:link"</b>&gt;
3211
+ back to home
3212
+ &lt;/p&gt;
3213
+
3214
+ &lt;!-- replace content with other element --&gt;
3215
+ &lt;p <b>id="replace_content_with_element:link"</b>&gt;
3216
+ back to home
3217
+ &lt;/p&gt;
3218
+
3219
+ &lt;!-- replace content with other content --&gt;
3220
+ &lt;p <b>id="replace_content_with_content:link"</b>&gt;
3221
+ back to home
3222
+ &lt;/p&gt;
3223
+ </pre>
3224
+ <div class="terminal_caption">
3225
+ compile</div>
3226
+ <pre class="terminal">$ kwartz -l eruby ex-replace.pdata
3227
+ &lt;div&gt;
3228
+ back to &lt;a href="/"&gt;home&lt;/a&gt;.
3229
+ &lt;/div&gt;
3230
+
3231
+ &lt;!-- replace element with other element --&gt;
3232
+ &lt;div&gt;
3233
+ back to &lt;a href="/"&gt;home&lt;/a&gt;.
3234
+ &lt;/div&gt;
3235
+
3236
+ &lt;!-- replace element with other content--&gt;
3237
+ back to &lt;a href="/"&gt;home&lt;/a&gt;.
3238
+
3239
+ &lt;!-- replace content with other element --&gt;
3240
+ &lt;p&gt;
3241
+ &lt;div&gt;
3242
+ back to &lt;a href="/"&gt;home&lt;/a&gt;.
3243
+ &lt;/div&gt;
3244
+ &lt;/p&gt;
3245
+
3246
+ &lt;!-- replace content with other content --&gt;
3247
+ &lt;p&gt;
3248
+ back to &lt;a href="/"&gt;home&lt;/a&gt;.
3249
+ &lt;/p&gt;
3250
+ </pre>
3251
+ <br>
3252
+
3253
+ <br>
3254
+
3255
+
3256
+ <br>
3257
+
3258
+
3259
+ <a name="cmdline"></a>
3260
+ <h2 class="section1">Command-Line Options</h2>
3261
+ <p>Usage: kwartz [..options..] [-p file.plogic] file.html &gt; file.rhtml
3262
+ </p>
3263
+ <p>Command-line options:
3264
+ </p>
3265
+ <dl class="dl3" compact>
3266
+ <dt class="dt3"><b>
3267
+ -h </b></dt>
3268
+ <dd class="dd3">
3269
+ Show help.
3270
+ </dd>
3271
+ <dt class="dt3"><b>
3272
+ -v </b></dt>
3273
+ <dd class="dd3">
3274
+ Show version.
3275
+ </dd>
3276
+ <dt class="dt3"><b>
3277
+ -e </b></dt>
3278
+ <dd class="dd3">
3279
+ Escape (sanitize) expression value.
3280
+ This is an alias of '<code>--escape=true</code>'
3281
+ </dd>
3282
+ <dt class="dt3"><b>
3283
+ -l lang </b></dt>
3284
+ <dd class="dd3">
3285
+ Target language ('eruby, 'php', 'eperl', 'rails', or 'jstl').
3286
+ Default is 'eruby'.
3287
+ </dd>
3288
+ <dt class="dt3"><b>
3289
+ -k kanji </b></dt>
3290
+ <dd class="dd3">
3291
+ Kanji code (euc/sjis/utf8). Default is null.
3292
+ </dd>
3293
+ <dt class="dt3"><b>
3294
+ -r library,... </b></dt>
3295
+ <dd class="dd3">
3296
+ Require libraries.
3297
+ </dd>
3298
+ <dt class="dt3"><b>
3299
+ -p plogic,... </b></dt>
3300
+ <dd class="dd3">
3301
+ Presentation logic files. Suffix '.plogic' is omittable.
3302
+ </dd>
3303
+ <dt class="dt3"><b>
3304
+ -i pdata,... </b></dt>
3305
+ <dd class="dd3">
3306
+ Import presentation data files.
3307
+ </dd>
3308
+ <dt class="dt3"><b>
3309
+ -L layoutfile </b></dt>
3310
+ <dd class="dd3">
3311
+ Layout file. '-L f1 f2' is equivalent to '-i f2 f1'.
3312
+ </dd>
3313
+ <dt class="dt3"><b>
3314
+ -x elem-id </b></dt>
3315
+ <dd class="dd3">
3316
+ Extract content of element marked by elem-id.
3317
+ </dd>
3318
+ <dt class="dt3"><b>
3319
+ -X elem-id </b></dt>
3320
+ <dd class="dd3">
3321
+ Extract element marked by elem-id.
3322
+ </dd>
3323
+ <dt class="dt3"><b>
3324
+ -f yamlfile </b></dt>
3325
+ <dd class="dd3">
3326
+ YAML file for context values.
3327
+ </dd>
3328
+ <dt class="dt3"><b>
3329
+ -t </b></dt>
3330
+ <dd class="dd3">
3331
+ Expand tab character in YAML file.
3332
+ </dd>
3333
+ <dt class="dt3"><b>
3334
+ -S </b></dt>
3335
+ <dd class="dd3">
3336
+ Convert mapping key from string to symbol in YAML file.
3337
+ </dd>
3338
+ </dl>
3339
+ <p>Command-line properties:
3340
+ </p>
3341
+ <dl class="dl3" compact>
3342
+ <dt class="dt3"><b>
3343
+ --dattr=str </b></dt>
3344
+ <dd class="dd3">
3345
+ Directive attribute name.
3346
+ </dd>
3347
+ <dt class="dt3"><b>
3348
+ --odd=value </b></dt>
3349
+ <dd class="dd3">
3350
+ Odd value for FOREACH/LOOP directive (default "'odd'").
3351
+ </dd>
3352
+ <dt class="dt3"><b>
3353
+ --even=value </b></dt>
3354
+ <dd class="dd3">
3355
+ Even value for FOREACH/LOOP directive (default "'even'").
3356
+ </dd>
3357
+ <dt class="dt3"><b>
3358
+ --header=str </b></dt>
3359
+ <dd class="dd3">
3360
+ Header text.
3361
+ </dd>
3362
+ <dt class="dt3"><b>
3363
+ --footer=str </b></dt>
3364
+ <dd class="dd3">
3365
+ Footer text.
3366
+ </dd>
3367
+ <dt class="dt3"><b>
3368
+ --delspan={true|false} </b></dt>
3369
+ <dd class="dd3">
3370
+ Delete dummy span tag (default false).
3371
+ </dd>
3372
+ <dt class="dt3"><b>
3373
+ --escape={true|false} </b></dt>
3374
+ <dd class="dd3">
3375
+ Escape (sanitize) (default false).
3376
+ </dd>
3377
+ <dt class="dt3"><b>
3378
+ --jstl={1.2|1.1} </b></dt>
3379
+ <dd class="dd3">
3380
+ JSTL version (default 1.2).
3381
+ </dd>
3382
+ <dt class="dt3"><b>
3383
+ --charset=charset </b></dt>
3384
+ <dd class="dd3">
3385
+ Character-set for JSTL (default none).
3386
+ </dd>
3387
+ </dl>
3388
+ <br>
3389
+
3390
+
3391
+
3392
+ </div>
3393
+ </blockquote>
3394
+
3395
+ </body>
3396
+ </html>