kwartz 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +340 -0
- data/ChangeLog +103 -0
- data/README.txt +37 -0
- data/bin/kwartz +12 -0
- data/doc-api/classes/Kwartz.html +218 -0
- data/doc-api/classes/Kwartz/Assertion.html +140 -0
- data/doc-api/classes/Kwartz/AssertionError.html +148 -0
- data/doc-api/classes/Kwartz/AttrInfo.html +320 -0
- data/doc-api/classes/Kwartz/BaseError.html +206 -0
- data/doc-api/classes/Kwartz/BaseTranslator.html +331 -0
- data/doc-api/classes/Kwartz/CharacterType.html +212 -0
- data/doc-api/classes/Kwartz/CommandOptionError.html +154 -0
- data/doc-api/classes/Kwartz/CommandOptions.html +374 -0
- data/doc-api/classes/Kwartz/Config.html +150 -0
- data/doc-api/classes/Kwartz/ConvertError.html +191 -0
- data/doc-api/classes/Kwartz/Converter.html +252 -0
- data/doc-api/classes/Kwartz/CssStyleParser.html +483 -0
- data/doc-api/classes/Kwartz/DocumentRuleset.html +369 -0
- data/doc-api/classes/Kwartz/ElementExpander.html +325 -0
- data/doc-api/classes/Kwartz/ElementInfo.html +312 -0
- data/doc-api/classes/Kwartz/ElementRuleset.html +582 -0
- data/doc-api/classes/Kwartz/EperlHandler.html +338 -0
- data/doc-api/classes/Kwartz/EperlTranslator.html +167 -0
- data/doc-api/classes/Kwartz/ErubisHandler.html +113 -0
- data/doc-api/classes/Kwartz/ErubisTranslator.html +168 -0
- data/doc-api/classes/Kwartz/ErubyHandler.html +337 -0
- data/doc-api/classes/Kwartz/ErubyTranslator.html +167 -0
- data/doc-api/classes/Kwartz/ExpandStatement.html +227 -0
- data/doc-api/classes/Kwartz/Expression.html +119 -0
- data/doc-api/classes/Kwartz/Handler.html +558 -0
- data/doc-api/classes/Kwartz/JstlHandler.html +657 -0
- data/doc-api/classes/Kwartz/JstlTranslator.html +226 -0
- data/doc-api/classes/Kwartz/KwartzError.html +146 -0
- data/doc-api/classes/Kwartz/Main.html +384 -0
- data/doc-api/classes/Kwartz/NativeExpression.html +236 -0
- data/doc-api/classes/Kwartz/NativeStatement.html +254 -0
- data/doc-api/classes/Kwartz/Node.html +156 -0
- data/doc-api/classes/Kwartz/ParseError.html +148 -0
- data/doc-api/classes/Kwartz/PhpHandler.html +333 -0
- data/doc-api/classes/Kwartz/PhpTranslator.html +194 -0
- data/doc-api/classes/Kwartz/PresentationLogicParser.html +830 -0
- data/doc-api/classes/Kwartz/PrintStatement.html +221 -0
- data/doc-api/classes/Kwartz/RailsHandler.html +587 -0
- data/doc-api/classes/Kwartz/RailsTranslator.html +167 -0
- data/doc-api/classes/Kwartz/RubyStyleParser.html +558 -0
- data/doc-api/classes/Kwartz/Ruleset.html +117 -0
- data/doc-api/classes/Kwartz/Statement.html +119 -0
- data/doc-api/classes/Kwartz/StrutsTranslator.html +190 -0
- data/doc-api/classes/Kwartz/TagInfo.html +314 -0
- data/doc-api/classes/Kwartz/TextConverter.html +270 -0
- data/doc-api/classes/Kwartz/Translator.html +318 -0
- data/doc-api/classes/Test.html +107 -0
- data/doc-api/classes/Test/Unit.html +101 -0
- data/doc-api/created.rid +1 -0
- data/doc-api/files/__/README_txt.html +150 -0
- data/doc-api/files/kwartz/assert_rb.html +114 -0
- data/doc-api/files/kwartz/binding/eperl_rb.html +116 -0
- data/doc-api/files/kwartz/binding/erubis_rb.html +116 -0
- data/doc-api/files/kwartz/binding/eruby_rb.html +115 -0
- data/doc-api/files/kwartz/binding/jstl_rb.html +116 -0
- data/doc-api/files/kwartz/binding/php_rb.html +116 -0
- data/doc-api/files/kwartz/binding/rails_rb.html +115 -0
- data/doc-api/files/kwartz/binding/struts_rb.html +117 -0
- data/doc-api/files/kwartz/config_rb.html +107 -0
- data/doc-api/files/kwartz/converter_rb.html +119 -0
- data/doc-api/files/kwartz/error_rb.html +107 -0
- data/doc-api/files/kwartz/main_rb.html +124 -0
- data/doc-api/files/kwartz/node_rb.html +114 -0
- data/doc-api/files/kwartz/parser_rb.html +117 -0
- data/doc-api/files/kwartz/translator_rb.html +115 -0
- data/doc-api/files/kwartz/util/assert-text-equal_rb.html +115 -0
- data/doc-api/files/kwartz/util/testcase-helper_rb.html +115 -0
- data/doc-api/files/kwartz_rb.html +120 -0
- data/doc-api/fr_class_index.html +75 -0
- data/doc-api/fr_file_index.html +45 -0
- data/doc-api/fr_method_index.html +216 -0
- data/doc-api/index.html +24 -0
- data/doc-api/rdoc-style.css +208 -0
- data/doc/docstyle.css +188 -0
- data/doc/p-pattern.html +1207 -0
- data/doc/reference.html +3396 -0
- data/doc/users-guide.html +1670 -0
- data/examples/breadcrumbs1/Makefile +15 -0
- data/examples/breadcrumbs1/breadcrumbs.eruby.plogic +27 -0
- data/examples/breadcrumbs1/breadcrumbs.html +12 -0
- data/examples/breadcrumbs1/breadcrumbs.jstl.plogic +28 -0
- data/examples/breadcrumbs1/breadcrumbs.php.plogic +26 -0
- data/examples/breadcrumbs1/main.php +12 -0
- data/examples/breadcrumbs1/main.rb +12 -0
- data/examples/breadcrumbs2/Makefile +15 -0
- data/examples/breadcrumbs2/breadcrumbs.eruby.plogic +22 -0
- data/examples/breadcrumbs2/breadcrumbs.html +14 -0
- data/examples/breadcrumbs2/breadcrumbs.jstl.plogic +24 -0
- data/examples/breadcrumbs2/breadcrumbs.php.plogic +23 -0
- data/examples/breadcrumbs2/main.php +12 -0
- data/examples/breadcrumbs2/main.rb +12 -0
- data/examples/pagelayout/Makefile +47 -0
- data/examples/pagelayout/content.eruby.plogic +44 -0
- data/examples/pagelayout/content.jstl.plogic +36 -0
- data/examples/pagelayout/content.php.plogic +37 -0
- data/examples/pagelayout/content1.html +36 -0
- data/examples/pagelayout/content2.html +29 -0
- data/examples/pagelayout/design.css +40 -0
- data/examples/pagelayout/layout.html +50 -0
- data/examples/pagelayout/main.php +55 -0
- data/examples/pagelayout/main.rb +77 -0
- data/examples/pagelayout/menu.eruby.plogic +14 -0
- data/examples/pagelayout/menu.html +13 -0
- data/examples/pagelayout/menu.jstl.plogic +14 -0
- data/examples/pagelayout/menu.php.plogic +14 -0
- data/examples/rails1/Makefile +36 -0
- data/examples/rails1/README +19 -0
- data/examples/rails1/application_helper.rb +31 -0
- data/examples/rails1/edit.html +28 -0
- data/examples/rails1/edit.plogic +10 -0
- data/examples/rails1/form.html +52 -0
- data/examples/rails1/form.plogic +33 -0
- data/examples/rails1/layout.plogic +15 -0
- data/examples/rails1/link_to.plogic +19 -0
- data/examples/rails1/list.html +48 -0
- data/examples/rails1/list.plogic +28 -0
- data/examples/rails1/new.html +27 -0
- data/examples/rails1/new.plogic +10 -0
- data/examples/rails1/reader.plogic +29 -0
- data/examples/rails1/show.html +40 -0
- data/examples/rails1/show.plogic +4 -0
- data/examples/rails1/writer.plogic +8 -0
- data/examples/table1/Makefile +15 -0
- data/examples/table1/main.php +11 -0
- data/examples/table1/main.rb +11 -0
- data/examples/table1/table1.eruby.plogic +21 -0
- data/examples/table1/table1.html +16 -0
- data/examples/table1/table1.jstl.plogic +21 -0
- data/examples/table1/table1.php.plogic +22 -0
- data/kwartz.gemspec +55 -0
- data/lib/kwartz.rb +13 -0
- data/lib/kwartz/assert.rb +31 -0
- data/lib/kwartz/binding/eperl.rb +166 -0
- data/lib/kwartz/binding/erubis.rb +61 -0
- data/lib/kwartz/binding/eruby.rb +164 -0
- data/lib/kwartz/binding/jstl.rb +334 -0
- data/lib/kwartz/binding/php.rb +167 -0
- data/lib/kwartz/binding/rails.rb +295 -0
- data/lib/kwartz/binding/struts.rb +109 -0
- data/lib/kwartz/config.rb +28 -0
- data/lib/kwartz/converter.rb +920 -0
- data/lib/kwartz/error.rb +41 -0
- data/lib/kwartz/main.rb +464 -0
- data/lib/kwartz/node.rb +454 -0
- data/lib/kwartz/parser.rb +903 -0
- data/lib/kwartz/translator.rb +153 -0
- data/lib/kwartz/util/assert-text-equal.rb +44 -0
- data/lib/kwartz/util/testcase-helper.rb +112 -0
- data/setup.rb +1331 -0
- data/test/test-compile.rb +36 -0
- data/test/test-compile.yaml +178 -0
- data/test/test-converter.rb +34 -0
- data/test/test-converter.yaml +127 -0
- data/test/test-directives.rb +32 -0
- data/test/test-directives.yaml +1411 -0
- data/test/test-main.rb +464 -0
- data/test/test-parser.rb +54 -0
- data/test/test-parser.yaml +394 -0
- data/test/test-rails.rb +28 -0
- data/test/test-rails.yaml +301 -0
- data/test/test-ruleset.rb +36 -0
- data/test/test-ruleset.yaml +804 -0
- data/test/test.rb +44 -0
- metadata +236 -0
data/doc/reference.html
ADDED
@@ -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"><p id="mark:name1">aaa</p>
|
163
|
+
<p id="mark:name2">bbb</p>
|
164
|
+
<p id="mark:name3">ccc</p>
|
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><%= user[:name] %></b>
|
182
|
+
<b><%=h user[:name] %></b>
|
183
|
+
<b><%= user[:name] %></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"><p id="mark:name1">aaa</p>
|
192
|
+
<p id="mark:name2">bbb</p>
|
193
|
+
<p id="mark:name3">ccc</p>
|
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><?php echo $user['name']; ?></b>
|
211
|
+
<b><?php echo htmlspecialchars($user['name']); ?></b>
|
212
|
+
<b><?php echo $user['name']; ?></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"><p id="mark:name1">aaa</p>
|
221
|
+
<p id="mark:name2">bbb</p>
|
222
|
+
<p id="mark:name3">ccc</p>
|
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
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
240
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
241
|
+
<b>${user.name}</b>
|
242
|
+
<b>${user.name}</b>
|
243
|
+
<b><c:out value="${user.name}" escapeXml="false"/></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"><p id="mark:name1">aaa</p>
|
252
|
+
<p id="mark:name2">bbb</p>
|
253
|
+
<p id="mark:name3">ccc</p>
|
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><?= $user{'name'} !></b>
|
271
|
+
<b><?= encode_entities($user{'name'}) !></b>
|
272
|
+
<b><?= $user{'name'} !></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"><p id="mark:name1">aaa</p>
|
293
|
+
<p id="mark:name2">bbb</p>
|
294
|
+
<p id="mark:name3">ccc</p>
|
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
|
+
<p><b><%= user[:name] %></b></p>
|
312
|
+
<p><b><%=h user[:name] %></b></p>
|
313
|
+
<p><b><%= user[:name] %></b></p>
|
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"><p id="mark:name1">aaa</p>
|
322
|
+
<p id="mark:name2">bbb</p>
|
323
|
+
<p id="mark:name3">ccc</p>
|
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
|
+
<p><b><?php echo $user['name']; ?></b></p>
|
341
|
+
<p><b><?php echo htmlspecialchars($user['name']); ?></b></p>
|
342
|
+
<p><b><?php echo $user['name']; ?></b></p>
|
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"><p id="mark:name1">aaa</p>
|
351
|
+
<p id="mark:name2">bbb</p>
|
352
|
+
<p id="mark:name3">ccc</p>
|
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
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
370
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
371
|
+
<p><b>${user.name}</b></p>
|
372
|
+
<p><b>${user.name}</b></p>
|
373
|
+
<p><b><c:out value="${user.name}" escapeXml="false"/></b></p>
|
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"><p id="mark:name1">aaa</p>
|
382
|
+
<p id="mark:name2">bbb</p>
|
383
|
+
<p id="mark:name3">ccc</p>
|
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
|
+
<p><b><?= $user{'name'} !></b></p>
|
401
|
+
<p><b><?= encode_entities($user{'name'}) !></b></p>
|
402
|
+
<p><b><?= $user{'name'} !></b></p>
|
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"><p id="mark:name1">aaa</p>
|
421
|
+
<p id="mark:name2">bbb</p>
|
422
|
+
<p id="mark:name3">ccc</p>
|
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
|
+
<p><b><%= user[:name] %></b></p>
|
440
|
+
<p><b><%=h user[:name] %></b></p>
|
441
|
+
<p><b><%= user[:name] %></b></p>
|
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"><p id="mark:name1">aaa</p>
|
450
|
+
<p id="mark:name2">bbb</p>
|
451
|
+
<p id="mark:name3">ccc</p>
|
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
|
+
<p><b><?php echo $user['name']; ?></b></p>
|
469
|
+
<p><b><?php echo htmlspecialchars($user['name']); ?></b></p>
|
470
|
+
<p><b><?php echo $user['name']; ?></b></p>
|
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"><p id="mark:name1">aaa</p>
|
479
|
+
<p id="mark:name2">bbb</p>
|
480
|
+
<p id="mark:name3">ccc</p>
|
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
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
498
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
499
|
+
<p><b>${user.name}</b></p>
|
500
|
+
<p><b>${user.name}</b></p>
|
501
|
+
<p><b><c:out value="${user.name}" escapeXml="false"/></b></p>
|
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"><p id="mark:name1">aaa</p>
|
510
|
+
<p id="mark:name2">bbb</p>
|
511
|
+
<p id="mark:name3">ccc</p>
|
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
|
+
<p><b><?= $user{'name'} !></b></p>
|
529
|
+
<p><b><?= encode_entities($user{'name'}) !></b></p>
|
530
|
+
<p><b><?= $user{'name'} !></b></p>
|
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"><a href="#" id="mark:link1"><img src="button1.png"></a>
|
551
|
+
<a href="#" id="mark:link2"><img src="button2.png"></a>
|
552
|
+
<a href="#" id="mark:link3"><img src="button3.png"></a>
|
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=>'list';
|
558
|
+
}
|
559
|
+
#link2 {
|
560
|
+
<b>Stag:</b> start_link_to :action=>'list';
|
561
|
+
}
|
562
|
+
#link3 {
|
563
|
+
<b>STAG:</b> start_link_to :action=>'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><%= start_link_to :action=>'list' %></b><img src="button1.png"></a>
|
570
|
+
<b><%=h start_link_to :action=>'list' %></b><img src="button2.png"></a>
|
571
|
+
<b><%= start_link_to :action=>'list' %></b><img src="button3.png"></a>
|
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"><a href="#" id="mark:link1"><img src="button1.png"></a>
|
580
|
+
<a href="#" id="mark:link2"><img src="button2.png"></a>
|
581
|
+
<a href="#" id="mark:link3"><img src="button3.png"></a>
|
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><?php echo start_link_to('list'); ?></b><img src="button1.png"></a>
|
599
|
+
<b><?php echo htmlspecialchars(start_link_to('list')); ?></b><img src="button2.png"></a>
|
600
|
+
<b><?php echo start_link_to('list'); ?></b><img src="button3.png"></a>
|
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"><a href="#" id="mark:link1"><img src="button1.png"></a>
|
609
|
+
<a href="#" id="mark:link2"><img src="button2.png"></a>
|
610
|
+
<a href="#" id="mark:link3"><img src="button3.png"></a>
|
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
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
628
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
629
|
+
<b>${fn:start_link_to('list')}</b><img src="button1.png"></a>
|
630
|
+
<b>${fn:start_link_to('list')}</b><img src="button2.png"></a>
|
631
|
+
<b><c:out value="${fn:start_link_to('list')}" escapeXml="false"/></b><img src="button3.png"></a>
|
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"><a href="#" id="mark:link1"><img src="button1.png"></a>
|
640
|
+
<a href="#" id="mark:link2"><img src="button2.png"></a>
|
641
|
+
<a href="#" id="mark:link3"><img src="button3.png"></a>
|
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><?= start_link_to('list') !></b><img src="button1.png"></a>
|
659
|
+
<b><?= encode_entities(start_link_to('list')) !></b><img src="button2.png"></a>
|
660
|
+
<b><?= start_link_to('list') !></b><img src="button3.png"></a>
|
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"><li id="mark:item1">foo</li>
|
681
|
+
<li id="mark:item2">bar</li>
|
682
|
+
<li id="mark:item3">baz</li>
|
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 ? '</li>' : '';
|
688
|
+
}
|
689
|
+
#item2 {
|
690
|
+
<b>Etag:</b> is_xml ? '</li>' : '';
|
691
|
+
}
|
692
|
+
#item3 {
|
693
|
+
<b>ETAG:</b> is_xml ? '</li>' : '';
|
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
|
+
<li>foo<b><%= is_xml ? '</li>' : '' %></b>
|
700
|
+
<li>bar<b><%=h is_xml ? '</li>' : '' %></b>
|
701
|
+
<li>baz<b><%= is_xml ? '</li>' : '' %></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"><li id="mark:item1">foo</li>
|
710
|
+
<li id="mark:item2">bar</li>
|
711
|
+
<li id="mark:item3">baz</li>
|
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 ? '</li>' : '';
|
717
|
+
}
|
718
|
+
#item2 {
|
719
|
+
<b>Etag:</b> $is_xml ? '</li>' : '';
|
720
|
+
}
|
721
|
+
#item3 {
|
722
|
+
<b>ETAG:</b> $is_xml ? '</li>' : '';
|
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
|
+
<li>foo<b><?php echo $is_xml ? '</li>' : ''; ?></b>
|
729
|
+
<li>bar<b><?php echo htmlspecialchars($is_xml ? '</li>' : ''); ?></b>
|
730
|
+
<li>baz<b><?php echo $is_xml ? '</li>' : ''; ?></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"><li id="mark:item1">foo</li>
|
739
|
+
<li id="mark:item2">bar</li>
|
740
|
+
<li id="mark:item3">baz</li>
|
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 ? '</li>' : '';
|
746
|
+
}
|
747
|
+
#item2 {
|
748
|
+
<b>Etag:</b> is_xml ? '</li>' : '';
|
749
|
+
}
|
750
|
+
#item3 {
|
751
|
+
<b>ETAG:</b> is_xml ? '</li>' : '';
|
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
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
758
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
759
|
+
<li>foo<b>${is_xml ? '</li>' : ''}</b>
|
760
|
+
<li>bar<b>${is_xml ? '</li>' : ''}</b>
|
761
|
+
<li>baz<b><c:out value="${is_xml ? '</li>' : ''}" escapeXml="false"/></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"><li id="mark:item1">foo</li>
|
770
|
+
<li id="mark:item2">bar</li>
|
771
|
+
<li id="mark:item3">baz</li>
|
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 ? '</li>' : '';
|
777
|
+
}
|
778
|
+
#item2 {
|
779
|
+
<b>Etag:</b> $is_xml ? '</li>' : '';
|
780
|
+
}
|
781
|
+
#item3 {
|
782
|
+
<b>ETAG:</b> $is_xml ? '</li>' : '';
|
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
|
+
<li>foo<b><?= $is_xml ? '</li>' : '' !></b>
|
789
|
+
<li>bar<b><?= encode_entities($is_xml ? '</li>' : '') !></b>
|
790
|
+
<li>baz<b><?= $is_xml ? '</li>' : '' !></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"><p id="mark:item" class="para">
|
817
|
+
AAA
|
818
|
+
</p>
|
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
|
+
<p <b>class="<%= klass %>"</b> <b>style="<%= style %>"</b>>
|
831
|
+
AAA
|
832
|
+
</p>
|
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"><p id="mark:item" class="para">
|
841
|
+
AAA
|
842
|
+
</p>
|
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
|
+
<p <b>class="<?php echo $class; ?>"</b> <b>style="<?php echo $style; ?>"</b>>
|
855
|
+
AAA
|
856
|
+
</p>
|
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"><p id="mark:item" class="para">
|
865
|
+
AAA
|
866
|
+
</p>
|
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
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
879
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
880
|
+
<p <b>class="${klass}"</b> <b>style="${style}"</b>>
|
881
|
+
AAA
|
882
|
+
</p>
|
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"><p id="mark:item" class="para">
|
891
|
+
AAA
|
892
|
+
</p>
|
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
|
+
<p <b>class="<?= $class !>"</b> <b>style="<?= $style !>"</b>>
|
905
|
+
AAA
|
906
|
+
</p>
|
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"><input type="checkboxk" id="mark:remember" value="y">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
|
+
<input type="checkboxk" value="y"<b><%= flag ? ' checked' : '' %></b>>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"><input type="checkboxk" id="mark:remember" value="y">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
|
+
<input type="checkboxk" value="y"<b><?php echo $flag ? ' checked' : ''; ?></b>>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"><input type="checkboxk" id="mark:remember" value="y">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
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
990
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
991
|
+
<input type="checkboxk" value="y"<b>${flag ? ' checked' : ''}</b>>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"><input type="checkboxk" id="mark:remember" value="y">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
|
+
<input type="checkboxk" value="y"<b><?= $flag ? ' checked' : '' !></b>>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"><p id="foo" class="paragraph" style="color: red">
|
1026
|
+
AAA
|
1027
|
+
</p>
|
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
|
+
<p class="paragraph">
|
1039
|
+
AAA
|
1040
|
+
</p>
|
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"><p id="foo" class="paragraph" style="color: red">
|
1049
|
+
AAA
|
1050
|
+
</p>
|
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
|
+
<p class="paragraph">
|
1062
|
+
AAA
|
1063
|
+
</p>
|
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"><p id="foo" class="paragraph" style="color: red">
|
1072
|
+
AAA
|
1073
|
+
</p>
|
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
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
1085
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
1086
|
+
<p class="paragraph">
|
1087
|
+
AAA
|
1088
|
+
</p>
|
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"><p id="foo" class="paragraph" style="color: red">
|
1097
|
+
AAA
|
1098
|
+
</p>
|
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
|
+
<p class="paragraph">
|
1110
|
+
AAA
|
1111
|
+
</p>
|
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"><ul>
|
1163
|
+
<li id="mark:items">AAA</li>
|
1164
|
+
</ul>
|
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
|
+
<ul>
|
1183
|
+
<b><% @list.each do |item| %></b>
|
1184
|
+
<li><%= item %></li>
|
1185
|
+
<b><% end %></b>
|
1186
|
+
</ul>
|
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"><ul>
|
1195
|
+
<li id="mark:items">AAA</li>
|
1196
|
+
</ul>
|
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
|
+
<ul>
|
1215
|
+
<b><?php foreach ($list as $item) { ?></b>
|
1216
|
+
<li><?php echo $item; ?></li>
|
1217
|
+
<b><?php } ?></b>
|
1218
|
+
</ul>
|
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"><ul>
|
1227
|
+
<li id="mark:items">AAA</li>
|
1228
|
+
</ul>
|
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
|
+
<c:forEach var="item" items="${list}">
|
1236
|
+
<b>_stag();</b>
|
1237
|
+
<b>_cont();</b>
|
1238
|
+
<b>_etag();</b>
|
1239
|
+
</c:forEach>
|
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
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
1247
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
1248
|
+
<ul>
|
1249
|
+
<b><c:forEach var="item" items="${list}"></b>
|
1250
|
+
<li>${item}</li>
|
1251
|
+
<b></c:forEach></b>
|
1252
|
+
</ul>
|
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"><ul>
|
1261
|
+
<li id="mark:items">AAA</li>
|
1262
|
+
</ul>
|
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
|
+
<ul>
|
1281
|
+
<b><? foreach ($item in @list) { !></b>
|
1282
|
+
<li><?= $item !></li>
|
1283
|
+
<b><? } !></b>
|
1284
|
+
</ul>
|
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"><p>Hello <span id="mark:username">world</span>!</p>
|
1303
|
+
<ul>
|
1304
|
+
<li id="mark:menu">menu item</li>
|
1305
|
+
</ul>
|
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 "<!-- document end -->\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><% username = @context[:username] %></b>
|
1335
|
+
<b><% menulist = @context[:menulist] %></b>
|
1336
|
+
<p>Hello <span><%= username %></span>!</p>
|
1337
|
+
<ul>
|
1338
|
+
<% for menu in menulist %>
|
1339
|
+
<li><%= menu %></li>
|
1340
|
+
<% end %>
|
1341
|
+
</ul>
|
1342
|
+
<b><%= "<!-- document end -->\n" %></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"><p>Hello <span id="mark:username">world</span>!</p>
|
1351
|
+
<ul>
|
1352
|
+
<li id="mark:menu">menu item</li>
|
1353
|
+
</ul>
|
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("<!-- document end -->\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><?php $username = $context['username']; ?></b>
|
1383
|
+
<b><?php $menulist = $context['menulist']; ?></b>
|
1384
|
+
<p>Hello <span><?php echo $username; ?></span>!</p>
|
1385
|
+
<ul>
|
1386
|
+
<?php foreach ($menulist as $menu) { ?>
|
1387
|
+
<li><?php echo $menu; ?></li>
|
1388
|
+
<?php } ?>
|
1389
|
+
</ul>
|
1390
|
+
<b><?php echo "<!-- document end -->\n"; ?></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"><p>Hello <span id="mark:username">world</span>!</p>
|
1399
|
+
<ul>
|
1400
|
+
<li id="mark:menu">menu item</li>
|
1401
|
+
</ul>
|
1402
|
+
</pre>
|
1403
|
+
<div class="program_caption">
|
1404
|
+
presentation logic (ex-begin.plogic)</div>
|
1405
|
+
<pre class="program">#DOCUMENT {
|
1406
|
+
<b>begin:</b> {
|
1407
|
+
<c:set var="username" value="${context.username}"/>
|
1408
|
+
<c:set var="menulist" value="${context.menulist}"/>
|
1409
|
+
}
|
1410
|
+
<b>end:</b> {
|
1411
|
+
<c:out value="<!-- document end -->\n"/>
|
1412
|
+
}
|
1413
|
+
}
|
1414
|
+
#username {
|
1415
|
+
value: username;
|
1416
|
+
}
|
1417
|
+
#menu {
|
1418
|
+
value: menu;
|
1419
|
+
logic: {
|
1420
|
+
<c:forEach var="menu" items="${menulist}">
|
1421
|
+
_elem();
|
1422
|
+
</c:forEach>
|
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
|
+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
1430
|
+
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
1431
|
+
<b><c:set var="username" value="${context.username}"/></b>
|
1432
|
+
<b><c:set var="menulist" value="${context.menulist}"/></b>
|
1433
|
+
<p>Hello <span>${username}</span>!</p>
|
1434
|
+
<ul>
|
1435
|
+
<c:forEach var="menu" items="${menulist}">
|
1436
|
+
<li>${menu}</li>
|
1437
|
+
</c:forEach>
|
1438
|
+
</ul>
|
1439
|
+
<b><c:out value="<!-- document end -->\n"/></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"><p>Hello <span id="mark:username">world</span>!</p>
|
1448
|
+
<ul>
|
1449
|
+
<li id="mark:menu">menu item</li>
|
1450
|
+
</ul>
|
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("<!-- document end -->\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><? $username = $context{'username'}; !></b>
|
1480
|
+
<b><? @menulist = $context{'menulist'}; !></b>
|
1481
|
+
<p>Hello <span><?= $username !></span>!</p>
|
1482
|
+
<ul>
|
1483
|
+
<? foreach ($menu in @menulist) { !>
|
1484
|
+
<li><?= $menu !></li>
|
1485
|
+
<? } !>
|
1486
|
+
</ul>
|
1487
|
+
<b><?= "<!-- document end -->\n" !></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"><b <b>title="elem: expr"</b>>foo</b>
|
1526
|
+
<b <b>title="Elem: expr"</b>>foo</b>
|
1527
|
+
<b <b>title="ELEM: expr"</b>>foo</b>
|
1528
|
+
</pre>
|
1529
|
+
<div class="terminal_caption">
|
1530
|
+
compile</div>
|
1531
|
+
<pre class="terminal">$ kwartz -l eruby ex-elem.pdata
|
1532
|
+
<b><%= expr %></b>
|
1533
|
+
<b><%=h expr %></b>
|
1534
|
+
<b><%= expr %></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"><b <b>title="elem($expr)"</b>>foo</b>
|
1543
|
+
<b <b>title="Elem($expr)"</b>>foo</b>
|
1544
|
+
<b <b>title="ELEM($expr)"</b>>foo</b>
|
1545
|
+
</pre>
|
1546
|
+
<div class="terminal_caption">
|
1547
|
+
compile</div>
|
1548
|
+
<pre class="terminal">$ kwartz -l php ex-elem.pdata
|
1549
|
+
<b><?php echo $expr; ?></b>
|
1550
|
+
<b><?php echo htmlspecialchars($expr); ?></b>
|
1551
|
+
<b><?php echo $expr; ?></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"><b <b>title="elem(expr)"</b>>foo</b>
|
1560
|
+
<b <b>title="Elem(expr)"</b>>foo</b>
|
1561
|
+
<b <b>title="ELEM(expr)"</b>>foo</b>
|
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><c:out value="${expr}" escapeXml="false"/></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"><b <b>title="elem($expr)"</b>>foo</b>
|
1577
|
+
<b <b>title="Elem($expr)"</b>>foo</b>
|
1578
|
+
<b <b>title="ELEM($expr)"</b>>foo</b>
|
1579
|
+
</pre>
|
1580
|
+
<div class="terminal_caption">
|
1581
|
+
compile</div>
|
1582
|
+
<pre class="terminal">$ kwartz -l eperl ex-elem.pdata
|
1583
|
+
<b><?= $expr !></b>
|
1584
|
+
<b><?= encode_entities($expr) !></b>
|
1585
|
+
<b><?= $expr !></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"><b <b>title="stag: expr"</b>>foo</b>
|
1605
|
+
<b <b>title="Stag: expr"</b>>foo</b>
|
1606
|
+
<b <b>title="STAG: expr"</b>>foo</b>
|
1607
|
+
</pre>
|
1608
|
+
<div class="terminal_caption">
|
1609
|
+
compile</div>
|
1610
|
+
<pre class="terminal">$ kwartz -l eruby ex-stag.pdata
|
1611
|
+
<b><%= expr %></b>foo</b>
|
1612
|
+
<b><%=h expr %></b>foo</b>
|
1613
|
+
<b><%= expr %></b>foo</b>
|
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"><b <b>title="stag($expr)"</b>>foo</b>
|
1622
|
+
<b <b>title="Stag($expr)"</b>>foo</b>
|
1623
|
+
<b <b>title="STAG($expr)"</b>>foo</b>
|
1624
|
+
</pre>
|
1625
|
+
<div class="terminal_caption">
|
1626
|
+
compile</div>
|
1627
|
+
<pre class="terminal">$ kwartz -l php ex-stag.pdata
|
1628
|
+
<b><?php echo $expr; ?></b>foo</b>
|
1629
|
+
<b><?php echo htmlspecialchars($expr); ?></b>foo</b>
|
1630
|
+
<b><?php echo $expr; ?></b>foo</b>
|
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"><b <b>title="stag(expr)"</b>>foo</b>
|
1639
|
+
<b <b>title="Stag(expr)"</b>>foo</b>
|
1640
|
+
<b <b>title="STAG(expr)"</b>>foo</b>
|
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</b>
|
1646
|
+
<b>${expr}</b>foo</b>
|
1647
|
+
<b><c:out value="${expr}" escapeXml="false"/></b>foo</b>
|
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"><b <b>title="stag($expr)"</b>>foo</b>
|
1656
|
+
<b <b>title="Stag($expr)"</b>>foo</b>
|
1657
|
+
<b <b>title="STAG($expr)"</b>>foo</b>
|
1658
|
+
</pre>
|
1659
|
+
<div class="terminal_caption">
|
1660
|
+
compile</div>
|
1661
|
+
<pre class="terminal">$ kwartz -l eperl ex-stag.pdata
|
1662
|
+
<b><?= $expr !></b>foo</b>
|
1663
|
+
<b><?= encode_entities($expr) !></b>foo</b>
|
1664
|
+
<b><?= $expr !></b>foo</b>
|
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"><b <b>title="etag: expr"</b>>foo</b>
|
1684
|
+
<b <b>title="Etag: expr"</b>>foo</b>
|
1685
|
+
<b <b>title="ETAG: expr"</b>>foo</b>
|
1686
|
+
</pre>
|
1687
|
+
<div class="terminal_caption">
|
1688
|
+
compile</div>
|
1689
|
+
<pre class="terminal">$ kwartz -l eruby ex-etag.pdata
|
1690
|
+
<b>foo<b><%= expr %></b>
|
1691
|
+
<b>foo<b><%=h expr %></b>
|
1692
|
+
<b>foo<b><%= expr %></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"><b <b>title="etag($expr)"</b>>foo</b>
|
1701
|
+
<b <b>title="Etag($expr)"</b>>foo</b>
|
1702
|
+
<b <b>title="ETAG($expr)"</b>>foo</b>
|
1703
|
+
</pre>
|
1704
|
+
<div class="terminal_caption">
|
1705
|
+
compile</div>
|
1706
|
+
<pre class="terminal">$ kwartz -l php ex-etag.pdata
|
1707
|
+
<b>foo<b><?php echo $expr; ?></b>
|
1708
|
+
<b>foo<b><?php echo htmlspecialchars($expr); ?></b>
|
1709
|
+
<b>foo<b><?php echo $expr; ?></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"><b <b>title="etag(expr)"</b>>foo</b>
|
1718
|
+
<b <b>title="Etag(expr)"</b>>foo</b>
|
1719
|
+
<b <b>title="ETAG(expr)"</b>>foo</b>
|
1720
|
+
</pre>
|
1721
|
+
<div class="terminal_caption">
|
1722
|
+
compile</div>
|
1723
|
+
<pre class="terminal">$ kwartz -l jstl ex-etag.pdata
|
1724
|
+
<b>foo<b>${expr}</b>
|
1725
|
+
<b>foo<b>${expr}</b>
|
1726
|
+
<b>foo<b><c:out value="${expr}" escapeXml="false"/></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"><b <b>title="etag($expr)"</b>>foo</b>
|
1735
|
+
<b <b>title="Etag($expr)"</b>>foo</b>
|
1736
|
+
<b <b>title="ETAG($expr)"</b>>foo</b>
|
1737
|
+
</pre>
|
1738
|
+
<div class="terminal_caption">
|
1739
|
+
compile</div>
|
1740
|
+
<pre class="terminal">$ kwartz -l eperl ex-etag.pdata
|
1741
|
+
<b>foo<b><?= $expr !></b>
|
1742
|
+
<b>foo<b><?= encode_entities($expr) !></b>
|
1743
|
+
<b>foo<b><?= $expr !></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"><b <b>title="cont: expr"</b>>foo</b>
|
1763
|
+
<b <b>title="Cont: expr"</b>>foo</b>
|
1764
|
+
<b <b>title="CONT: expr"</b>>foo</b>
|
1765
|
+
</pre>
|
1766
|
+
<div class="terminal_caption">
|
1767
|
+
compile</div>
|
1768
|
+
<pre class="terminal">$ kwartz -l eruby ex-cont.pdata
|
1769
|
+
<b><b><%= expr %></b></b>
|
1770
|
+
<b><b><%=h expr %></b></b>
|
1771
|
+
<b><b><%= expr %></b></b>
|
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"><b <b>title="cont($expr)"</b>>foo</b>
|
1780
|
+
<b <b>title="Cont($expr)"</b>>foo</b>
|
1781
|
+
<b <b>title="CONT($expr)"</b>>foo</b>
|
1782
|
+
</pre>
|
1783
|
+
<div class="terminal_caption">
|
1784
|
+
compile</div>
|
1785
|
+
<pre class="terminal">$ kwartz -l php ex-cont.pdata
|
1786
|
+
<b><b><?php echo $expr; ?></b></b>
|
1787
|
+
<b><b><?php echo htmlspecialchars($expr); ?></b></b>
|
1788
|
+
<b><b><?php echo $expr; ?></b></b>
|
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"><b <b>title="cont(expr)"</b>>foo</b>
|
1797
|
+
<b <b>title="Cont(expr)"</b>>foo</b>
|
1798
|
+
<b <b>title="CONT(expr)"</b>>foo</b>
|
1799
|
+
</pre>
|
1800
|
+
<div class="terminal_caption">
|
1801
|
+
compile</div>
|
1802
|
+
<pre class="terminal">$ kwartz -l jstl ex-cont.pdata
|
1803
|
+
<b><b>${expr}</b></b>
|
1804
|
+
<b><b>${expr}</b></b>
|
1805
|
+
<b><b><c:out value="${expr}" escapeXml="false"/></b></b>
|
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"><b <b>title="cont($expr)"</b>>foo</b>
|
1814
|
+
<b <b>title="Cont($expr)"</b>>foo</b>
|
1815
|
+
<b <b>title="CONT($expr)"</b>>foo</b>
|
1816
|
+
</pre>
|
1817
|
+
<div class="terminal_caption">
|
1818
|
+
compile</div>
|
1819
|
+
<pre class="terminal">$ kwartz -l eperl ex-cont.pdata
|
1820
|
+
<b><b><?= $expr !></b></b>
|
1821
|
+
<b><b><?= encode_entities($expr) !></b></b>
|
1822
|
+
<b><b><?= $expr !></b></b>
|
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"><b <b>title="value: expr"</b>>foo</b>
|
1839
|
+
<b <b>title="Value: expr"</b>>foo</b>
|
1840
|
+
<b <b>title="VALUE: expr"</b>>foo</b>
|
1841
|
+
</pre>
|
1842
|
+
<div class="terminal_caption">
|
1843
|
+
compile</div>
|
1844
|
+
<pre class="terminal">$ kwartz -l eruby ex-value.pdata
|
1845
|
+
<b><b><%= expr %></b></b>
|
1846
|
+
<b><b><%=h expr %></b></b>
|
1847
|
+
<b><b><%= expr %></b></b>
|
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"><b <b>title="value($expr)"</b>>foo</b>
|
1856
|
+
<b <b>title="Value($expr)"</b>>foo</b>
|
1857
|
+
<b <b>title="VALUE($expr)"</b>>foo</b>
|
1858
|
+
</pre>
|
1859
|
+
<div class="terminal_caption">
|
1860
|
+
compile</div>
|
1861
|
+
<pre class="terminal">$ kwartz -l php ex-value.pdata
|
1862
|
+
<b><b><?php echo $expr; ?></b></b>
|
1863
|
+
<b><b><?php echo htmlspecialchars($expr); ?></b></b>
|
1864
|
+
<b><b><?php echo $expr; ?></b></b>
|
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"><b <b>title="value(expr)"</b>>foo</b>
|
1873
|
+
<b <b>title="Value(expr)"</b>>foo</b>
|
1874
|
+
<b <b>title="VALUE(expr)"</b>>foo</b>
|
1875
|
+
</pre>
|
1876
|
+
<div class="terminal_caption">
|
1877
|
+
compile</div>
|
1878
|
+
<pre class="terminal">$ kwartz -l jstl ex-value.pdata
|
1879
|
+
<b><b>${expr}</b></b>
|
1880
|
+
<b><b>${expr}</b></b>
|
1881
|
+
<b><b><c:out value="${expr}" escapeXml="false"/></b></b>
|
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"><b <b>title="value($expr)"</b>>foo</b>
|
1890
|
+
<b <b>title="Value($expr)"</b>>foo</b>
|
1891
|
+
<b <b>title="VALUE($expr)"</b>>foo</b>
|
1892
|
+
</pre>
|
1893
|
+
<div class="terminal_caption">
|
1894
|
+
compile</div>
|
1895
|
+
<pre class="terminal">$ kwartz -l eperl ex-value.pdata
|
1896
|
+
<b><b><?= $expr !></b></b>
|
1897
|
+
<b><b><?= encode_entities($expr) !></b></b>
|
1898
|
+
<b><b><?= $expr !></b></b>
|
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"><tr <b>title="for item in list"</b>>
|
1914
|
+
<td title="cont item">foo</td>
|
1915
|
+
</tr>
|
1916
|
+
|
1917
|
+
<tr <b>title="for key,value in hash"</b>>
|
1918
|
+
<td title="cont key">key</td>
|
1919
|
+
<td title="cont value">value</td>
|
1920
|
+
</tr>
|
1921
|
+
</pre>
|
1922
|
+
<div class="terminal_caption">
|
1923
|
+
compile</div>
|
1924
|
+
<pre class="terminal">$ kwartz -l eruby ex-foreach.pdata
|
1925
|
+
<b><% for item in list do %></b>
|
1926
|
+
<tr>
|
1927
|
+
<td><%= item %></td>
|
1928
|
+
</tr>
|
1929
|
+
<b><% end %></b>
|
1930
|
+
|
1931
|
+
<b><% hash.each do |key, value| %></b>
|
1932
|
+
<tr>
|
1933
|
+
<td><%= key %></td>
|
1934
|
+
<td><%= value %></td>
|
1935
|
+
</tr>
|
1936
|
+
<b><% end %></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"><tr <b>title="foreach($list as $item)"</b>>
|
1945
|
+
<td title="cont($item)">foo</td>
|
1946
|
+
</tr>
|
1947
|
+
|
1948
|
+
<tr <b>title="foreach($hash as $key=>$value)"</b>>
|
1949
|
+
<td title="cont($key)">key</td>
|
1950
|
+
<td title="cont($value)">value</td>
|
1951
|
+
</tr>
|
1952
|
+
</pre>
|
1953
|
+
<div class="terminal_caption">
|
1954
|
+
compile</div>
|
1955
|
+
<pre class="terminal">$ kwartz -l php ex-foreach.pdata
|
1956
|
+
<b><?php foreach ($list as $item) { ?></b>
|
1957
|
+
<tr>
|
1958
|
+
<td><?php echo $item; ?></td>
|
1959
|
+
</tr>
|
1960
|
+
<b><?php } ?></b>
|
1961
|
+
|
1962
|
+
<b><?php foreach ($hash as $key=>$value) { ?></b>
|
1963
|
+
<tr>
|
1964
|
+
<td><?php echo $key; ?></td>
|
1965
|
+
<td><?php echo $value; ?></td>
|
1966
|
+
</tr>
|
1967
|
+
<b><?php } ?></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"><tr <b>title="for(item: list)"</b>>
|
1976
|
+
<td title="cont(item)">foo</td>
|
1977
|
+
</tr>
|
1978
|
+
|
1979
|
+
<tr <b>title="forEach(:var=>'v', :items=>:'params.list', :varStatus=>'status')"</b>>
|
1980
|
+
<td title="cont(status.index)">1</td>
|
1981
|
+
<td title="cont(v)"></td>
|
1982
|
+
</tr>
|
1983
|
+
|
1984
|
+
<tr <b>title="forEach(:var=>'n', :begin=>1, :end=>10, :step=>2)"</b>>
|
1985
|
+
<td title="cont(n)">key</td>
|
1986
|
+
</tr>
|
1987
|
+
</pre>
|
1988
|
+
<div class="terminal_caption">
|
1989
|
+
compile</div>
|
1990
|
+
<pre class="terminal">$ kwartz -l jstl ex-foreach.pdata
|
1991
|
+
<b><c:forEach var="item" items="${list}"></b>
|
1992
|
+
<tr>
|
1993
|
+
<td>${item}</td>
|
1994
|
+
</tr>
|
1995
|
+
<b></c:forEach></b>
|
1996
|
+
|
1997
|
+
<b><c:forEach var="v" items="${params.list}" varStatus="status"></b>
|
1998
|
+
<tr>
|
1999
|
+
<td>${status.index}</td>
|
2000
|
+
<td>${v}</td>
|
2001
|
+
</tr>
|
2002
|
+
<b></c:forEach></b>
|
2003
|
+
|
2004
|
+
<b><c:forEach var="n" begin="1" end="10" step="2"></b>
|
2005
|
+
<tr>
|
2006
|
+
<td>${n}</td>
|
2007
|
+
</tr>
|
2008
|
+
<b></c:forEach></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"><tr <b>title="foreach($item in @list)"</b>>
|
2017
|
+
<td title="cont($item)">foo</td>
|
2018
|
+
</tr>
|
2019
|
+
|
2020
|
+
<tr <b>title="foreach($key,$value in %hash)"</b>>
|
2021
|
+
<td title="cont($key)">key</td>
|
2022
|
+
<td title="cont($value)">value</td>
|
2023
|
+
</tr>
|
2024
|
+
</pre>
|
2025
|
+
<div class="terminal_caption">
|
2026
|
+
compile</div>
|
2027
|
+
<pre class="terminal">$ kwartz -l eperl ex-foreach.pdata
|
2028
|
+
<b><? foreach my $item (@list) { !></b>
|
2029
|
+
<tr>
|
2030
|
+
<td><?= $item !></td>
|
2031
|
+
</tr>
|
2032
|
+
<b><? } !></b>
|
2033
|
+
|
2034
|
+
<b><? foreach my $key (keys %hash) { !></b>
|
2035
|
+
<b><? my $value = $hash{$key}; !></b>
|
2036
|
+
<tr>
|
2037
|
+
<td><?= $key !></td>
|
2038
|
+
<td><?= $value !></td>
|
2039
|
+
</tr>
|
2040
|
+
<b><? } !></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"><tr <b>title="list item in list"</b>>
|
2056
|
+
<td title="cont item">foo</td>
|
2057
|
+
</tr>
|
2058
|
+
|
2059
|
+
<tr <b>title="list key,value in hash"</b>>
|
2060
|
+
<td title="cont key">key</td>
|
2061
|
+
<td title="cont value">value</td>
|
2062
|
+
</tr>
|
2063
|
+
</pre>
|
2064
|
+
<div class="terminal_caption">
|
2065
|
+
compile</div>
|
2066
|
+
<pre class="terminal">$ kwartz -l eruby ex-list.pdata
|
2067
|
+
<tr>
|
2068
|
+
<b><% for item in list do %></b>
|
2069
|
+
<td><%= item %></td>
|
2070
|
+
<b><% end %></b>
|
2071
|
+
</tr>
|
2072
|
+
|
2073
|
+
<tr>
|
2074
|
+
<b><% hash.each do |key, value| %></b>
|
2075
|
+
<td><%= key %></td>
|
2076
|
+
<td><%= value %></td>
|
2077
|
+
<b><% end %></b>
|
2078
|
+
</tr>
|
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"><tr <b>title="list($list as $item)"</b>>
|
2087
|
+
<td title="cont($item)">foo</td>
|
2088
|
+
</tr>
|
2089
|
+
|
2090
|
+
<tr <b>title="list($hash as $key=>$value)"</b>>
|
2091
|
+
<td title="cont($key)">key</td>
|
2092
|
+
<td title="cont($value)">value</td>
|
2093
|
+
</tr>
|
2094
|
+
</pre>
|
2095
|
+
<div class="terminal_caption">
|
2096
|
+
compile</div>
|
2097
|
+
<pre class="terminal">$ kwartz -l php ex-list.pdata
|
2098
|
+
<tr>
|
2099
|
+
<b><?php foreach ($list as $item) { ?></b>
|
2100
|
+
<td><?php echo $item; ?></td>
|
2101
|
+
<b><?php } ?></b>
|
2102
|
+
</tr>
|
2103
|
+
|
2104
|
+
<tr>
|
2105
|
+
<b><?php foreach ($hash as $key=>$value) { ?></b>
|
2106
|
+
<td><?php echo $key; ?></td>
|
2107
|
+
<td><?php echo $value; ?></td>
|
2108
|
+
<b><?php } ?></b>
|
2109
|
+
</tr>
|
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"><tr <b>title="list(item: list)"</b>>
|
2118
|
+
<td title="cont(item)">foo</td>
|
2119
|
+
</tr>
|
2120
|
+
</pre>
|
2121
|
+
<div class="terminal_caption">
|
2122
|
+
compile</div>
|
2123
|
+
<pre class="terminal">$ kwartz -l jstl ex-list.pdata
|
2124
|
+
<tr>
|
2125
|
+
<b><c:forEach var="item" items="${list}"></b>
|
2126
|
+
<td>${item}</td>
|
2127
|
+
<b></c:forEach></b>
|
2128
|
+
</tr>
|
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"><tr <b>title="list($item in @list)"</b>>
|
2137
|
+
<td title="cont($item)">foo</td>
|
2138
|
+
</tr>
|
2139
|
+
|
2140
|
+
<tr <b>title="list($key,$value in %hash)"</b>>
|
2141
|
+
<td title="cont($key)">key</td>
|
2142
|
+
<td title="cont($value)">value</td>
|
2143
|
+
</tr>
|
2144
|
+
</pre>
|
2145
|
+
<div class="terminal_caption">
|
2146
|
+
compile</div>
|
2147
|
+
<pre class="terminal">$ kwartz -l eperl ex-list.pdata
|
2148
|
+
<tr>
|
2149
|
+
<b><? foreach my $item (@list) { !></b>
|
2150
|
+
<td><?= $item !></td>
|
2151
|
+
<b><? } !></b>
|
2152
|
+
</tr>
|
2153
|
+
|
2154
|
+
<tr>
|
2155
|
+
<b><? foreach my $key (keys %hash) { !></b>
|
2156
|
+
<b><? my $value = $hash{$key}; !></b>
|
2157
|
+
<td><?= $key !></td>
|
2158
|
+
<td><?= $value !></td>
|
2159
|
+
<b><? } !></b>
|
2160
|
+
</tr>
|
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"><tr <b>title="For item in list"</b>>
|
2177
|
+
<td title="cont item">foo</td>
|
2178
|
+
</tr>
|
2179
|
+
|
2180
|
+
<tr <b>title="List item in list"</b>>
|
2181
|
+
<td title="cont item">foo</td>
|
2182
|
+
</tr>
|
2183
|
+
</pre>
|
2184
|
+
<div class="terminal_caption">
|
2185
|
+
compile</div>
|
2186
|
+
<pre class="terminal">$ kwartz -l eruby ex-foreach_ctr.pdata
|
2187
|
+
<b><% item_ctr = 0 %></b>
|
2188
|
+
<b><% for item in list do %></b>
|
2189
|
+
<b><% item_ctr += 1 %></b>
|
2190
|
+
<tr>
|
2191
|
+
<td><%= item %></td>
|
2192
|
+
</tr>
|
2193
|
+
<b><% end %></b>
|
2194
|
+
|
2195
|
+
<tr>
|
2196
|
+
<b><% item_ctr = 0 %></b>
|
2197
|
+
<b><% for item in list do %></b>
|
2198
|
+
<b><% item_ctr += 1 %></b>
|
2199
|
+
<td><%= item %></td>
|
2200
|
+
<b><% end %></b>
|
2201
|
+
</tr>
|
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"><tr <b>title="Foreach($list as $item)"</b>>
|
2210
|
+
<td title="cont($item)">foo</td>
|
2211
|
+
</tr>
|
2212
|
+
|
2213
|
+
<tr <b>title="List($list as $item)"</b>>
|
2214
|
+
<td title="cont($item)">foo</td>
|
2215
|
+
</tr>
|
2216
|
+
</pre>
|
2217
|
+
<div class="terminal_caption">
|
2218
|
+
compile</div>
|
2219
|
+
<pre class="terminal">$ kwartz -l php ex-foreach_ctr.pdata
|
2220
|
+
<b><?php $item_ctr = 0; ?></b>
|
2221
|
+
<b><?php foreach ($list as $item) { ?></b>
|
2222
|
+
<b><?php $item_ctr++; ?></b>
|
2223
|
+
<tr>
|
2224
|
+
<td><?php echo $item; ?></td>
|
2225
|
+
</tr>
|
2226
|
+
<b><?php } ?></b>
|
2227
|
+
|
2228
|
+
<tr>
|
2229
|
+
<b><?php $item_ctr = 0; ?></b>
|
2230
|
+
<b><?php foreach ($list as $item) { ?></b>
|
2231
|
+
<b><?php $item_ctr++; ?></b>
|
2232
|
+
<td><?php echo $item; ?></td>
|
2233
|
+
<b><?php } ?></b>
|
2234
|
+
</tr>
|
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"><tr <b>title="For(item: list)"</b>>
|
2243
|
+
<td title="cont(item)">foo</td>
|
2244
|
+
</tr>
|
2245
|
+
|
2246
|
+
<tr <b>title="List(item: list)"</b>>
|
2247
|
+
<td title="cont(item)">foo</td>
|
2248
|
+
</tr>
|
2249
|
+
</pre>
|
2250
|
+
<div class="terminal_caption">
|
2251
|
+
compile</div>
|
2252
|
+
<pre class="terminal">$ kwartz -l jstl ex-foreach_ctr.pdata
|
2253
|
+
<b><c:forEach var="item" items="${list}" varStatus="item_status"></b>
|
2254
|
+
<b><c:set var="item_ctr" value="${item_status.count}" /></b>
|
2255
|
+
<tr>
|
2256
|
+
<td>${item}</td>
|
2257
|
+
</tr>
|
2258
|
+
<b></c:forEach></b>
|
2259
|
+
|
2260
|
+
<tr>
|
2261
|
+
<b><c:forEach var="item" items="${list}" varStatus="item_status"></b>
|
2262
|
+
<b><c:set var="item_ctr" value="${item_status.count}" /></b>
|
2263
|
+
<td>${item}</td>
|
2264
|
+
<b></c:forEach></b>
|
2265
|
+
</tr>
|
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"><tr <b>title="Foreach($item in @list)"</b>>
|
2274
|
+
<td title="cont($item)">foo</td>
|
2275
|
+
</tr>
|
2276
|
+
|
2277
|
+
<tr <b>title="List($item in @list)"</b>>
|
2278
|
+
<td title="cont($item)">foo</td>
|
2279
|
+
</tr>
|
2280
|
+
</pre>
|
2281
|
+
<div class="terminal_caption">
|
2282
|
+
compile</div>
|
2283
|
+
<pre class="terminal">$ kwartz -l eperl ex-foreach_ctr.pdata
|
2284
|
+
<b><? my $item_ctr = 0; !></b>
|
2285
|
+
<b><? foreach my $item (@list) { !></b>
|
2286
|
+
<b><? $item_ctr++; !></b>
|
2287
|
+
<tr>
|
2288
|
+
<td><?= $item !></td>
|
2289
|
+
</tr>
|
2290
|
+
<b><? } !></b>
|
2291
|
+
|
2292
|
+
<tr>
|
2293
|
+
<b><? my $item_ctr = 0; !></b>
|
2294
|
+
<b><? foreach my $item (@list) { !></b>
|
2295
|
+
<b><? $item_ctr++; !></b>
|
2296
|
+
<td><?= $item !></td>
|
2297
|
+
<b><? } !></b>
|
2298
|
+
</tr>
|
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"><tr <b>title="FOR item in list"</b>>
|
2318
|
+
<td title="cont item">foo</td>
|
2319
|
+
</tr>
|
2320
|
+
|
2321
|
+
<tr <b>title="LIST item in list"</b>>
|
2322
|
+
<td title="cont item">foo</td>
|
2323
|
+
</tr>
|
2324
|
+
</pre>
|
2325
|
+
<div class="terminal_caption">
|
2326
|
+
compile</div>
|
2327
|
+
<pre class="terminal">$ kwartz -l eruby ex-foreach_tgl.pdata
|
2328
|
+
<b><% item_ctr = 0 %></b>
|
2329
|
+
<b><% for item in list do %></b>
|
2330
|
+
<b><% item_ctr += 1 %></b>
|
2331
|
+
<b><% item_tgl = item_ctr%2==0 ? 'even' : 'odd' %></b>
|
2332
|
+
<tr>
|
2333
|
+
<td><%= item %></td>
|
2334
|
+
</tr>
|
2335
|
+
<b><% end %></b>
|
2336
|
+
|
2337
|
+
<tr>
|
2338
|
+
<b><% item_ctr = 0 %></b>
|
2339
|
+
<b><% for item in list do %></b>
|
2340
|
+
<b><% item_ctr += 1 %></b>
|
2341
|
+
<b><% item_tgl = item_ctr%2==0 ? 'even' : 'odd' %></b>
|
2342
|
+
<td><%= item %></td>
|
2343
|
+
<b><% end %></b>
|
2344
|
+
</tr>
|
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"><tr <b>title="FOREACH($list as $item)"</b>>
|
2353
|
+
<td title="cont($item)">foo</td>
|
2354
|
+
</tr>
|
2355
|
+
|
2356
|
+
<tr <b>title="LIST($list as $item)"</b>>
|
2357
|
+
<td title="cont($item)">foo</td>
|
2358
|
+
</tr>
|
2359
|
+
</pre>
|
2360
|
+
<div class="terminal_caption">
|
2361
|
+
compile</div>
|
2362
|
+
<pre class="terminal">$ kwartz -l php ex-foreach_tgl.pdata
|
2363
|
+
<b><?php $item_ctr = 0; ?></b>
|
2364
|
+
<b><?php foreach ($list as $item) { ?></b>
|
2365
|
+
<b><?php $item_ctr++; ?></b>
|
2366
|
+
<b><?php $item_tgl = $item_ctr%2==0 ? 'even' : 'odd'; ?></b>
|
2367
|
+
<tr>
|
2368
|
+
<td><?php echo $item; ?></td>
|
2369
|
+
</tr>
|
2370
|
+
<b><?php } ?></b>
|
2371
|
+
|
2372
|
+
<tr>
|
2373
|
+
<b><?php $item_ctr = 0; ?></b>
|
2374
|
+
<b><?php foreach ($list as $item) { ?></b>
|
2375
|
+
<b><?php $item_ctr++; ?></b>
|
2376
|
+
<b><?php $item_tgl = $item_ctr%2==0 ? 'even' : 'odd'; ?></b>
|
2377
|
+
<td><?php echo $item; ?></td>
|
2378
|
+
<b><?php } ?></b>
|
2379
|
+
</tr>
|
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"><tr <b>title="FOR(item: list)"</b>>
|
2388
|
+
<td title="cont(item)">foo</td>
|
2389
|
+
</tr>
|
2390
|
+
|
2391
|
+
<tr <b>title="LIST(item: list)"</b>>
|
2392
|
+
<td title="cont(item)">foo</td>
|
2393
|
+
</tr>
|
2394
|
+
</pre>
|
2395
|
+
<div class="terminal_caption">
|
2396
|
+
compile</div>
|
2397
|
+
<pre class="terminal">$ kwartz -l jstl ex-foreach_tgl.pdata
|
2398
|
+
<b><c:forEach var="item" items="${list}" varStatus="item_status"></b>
|
2399
|
+
<b><c:set var="item_ctr" value="${item_status.count}" /></b>
|
2400
|
+
<b><c:set var="item_tgl" value="${item_status.count%2==0 ? 'even' : 'odd'}" /></b>
|
2401
|
+
<tr>
|
2402
|
+
<td>${item}</td>
|
2403
|
+
</tr>
|
2404
|
+
<b></c:forEach></b>
|
2405
|
+
|
2406
|
+
<tr>
|
2407
|
+
<b><c:forEach var="item" items="${list}" varStatus="item_status"></b>
|
2408
|
+
<b><c:set var="item_ctr" value="${item_status.count}" /></b>
|
2409
|
+
<b><c:set var="item_tgl" value="${item_status.count%2==0 ? 'even' : 'odd'}" /></b>
|
2410
|
+
<td>${item}</td>
|
2411
|
+
<b></c:forEach></b>
|
2412
|
+
</tr>
|
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"><tr <b>title="FOREACH($item in @list)"</b>>
|
2421
|
+
<td title="cont($item)">foo</td>
|
2422
|
+
</tr>
|
2423
|
+
|
2424
|
+
<tr <b>title="LIST($item in @list)"</b>>
|
2425
|
+
<td title="cont($item)">foo</td>
|
2426
|
+
</tr>
|
2427
|
+
</pre>
|
2428
|
+
<div class="terminal_caption">
|
2429
|
+
compile</div>
|
2430
|
+
<pre class="terminal">$ kwartz -l eperl ex-foreach_tgl.pdata
|
2431
|
+
<b><? my $item_ctr = 0; !></b>
|
2432
|
+
<b><? foreach my $item (@list) { !></b>
|
2433
|
+
<b><? $item_ctr++; !></b>
|
2434
|
+
<b><? my $item_tgl = $item_ctr%2==0 ? 'even' : 'odd'; !></b>
|
2435
|
+
<tr>
|
2436
|
+
<td><?= $item !></td>
|
2437
|
+
</tr>
|
2438
|
+
<b><? } !></b>
|
2439
|
+
|
2440
|
+
<tr>
|
2441
|
+
<b><? my $item_ctr = 0; !></b>
|
2442
|
+
<b><? foreach my $item (@list) { !></b>
|
2443
|
+
<b><? $item_ctr++; !></b>
|
2444
|
+
<b><? my $item_tgl = $item_ctr%2==0 ? 'even' : 'odd'; !></b>
|
2445
|
+
<td><?= $item !></td>
|
2446
|
+
<b><? } !></b>
|
2447
|
+
</tr>
|
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"><tr <b>title="while (item = dbh.fetch) != nil"</b>>
|
2467
|
+
<td title="cont item.name">foo</td>
|
2468
|
+
</tr>
|
2469
|
+
|
2470
|
+
<tr <b>title="loop (item = dbh.fetch) != nil"</b>>
|
2471
|
+
<td title="cont item.name">foo</td>
|
2472
|
+
</tr>
|
2473
|
+
</pre>
|
2474
|
+
<div class="terminal_caption">
|
2475
|
+
compile</div>
|
2476
|
+
<pre class="terminal">$ kwartz -l eruby ex-while.pdata
|
2477
|
+
<b><% while (item = dbh.fetch) != nil do %></b>
|
2478
|
+
<tr>
|
2479
|
+
<td><%= item.name %></td>
|
2480
|
+
</tr>
|
2481
|
+
<b><% end %></b>
|
2482
|
+
|
2483
|
+
<tr>
|
2484
|
+
<b><% while (item = dbh.fetch) != nil do %></b>
|
2485
|
+
<td><%= item.name %></td>
|
2486
|
+
<b><% end %></b>
|
2487
|
+
</tr>
|
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"><tr <b>title="while(($item = $dbh->fetch()) != null)"</b>>
|
2496
|
+
<td title="cont($item->name)">foo</td>
|
2497
|
+
</tr>
|
2498
|
+
|
2499
|
+
<tr <b>title="loop(($item = $dbh->fetch()) != null)"</b>>
|
2500
|
+
<td title="cont($item->name)">foo</td>
|
2501
|
+
</tr>
|
2502
|
+
</pre>
|
2503
|
+
<div class="terminal_caption">
|
2504
|
+
compile</div>
|
2505
|
+
<pre class="terminal">$ kwartz -l php ex-while.pdata
|
2506
|
+
<b><?php while (($item = $dbh->fetch()) != null) { ?></b>
|
2507
|
+
<tr>
|
2508
|
+
<td><?php echo $item->name; ?></td>
|
2509
|
+
</tr>
|
2510
|
+
<b><?php } ?></b>
|
2511
|
+
|
2512
|
+
<tr>
|
2513
|
+
<b><?php while (($item = $dbh->fetch()) != null) { ?></b>
|
2514
|
+
<td><?php echo $item->name; ?></td>
|
2515
|
+
<b><?php } ?></b>
|
2516
|
+
</tr>
|
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"><tr <b>title="while(($item = $dbh->fetch()) != null)"</b>>
|
2538
|
+
<td title="cont($item->name)">foo</td>
|
2539
|
+
</tr>
|
2540
|
+
|
2541
|
+
<tr <b>title="loop(($item = $dbh->fetch()) != null)"</b>>
|
2542
|
+
<td title="cont($item->name)">foo</td>
|
2543
|
+
</tr>
|
2544
|
+
</pre>
|
2545
|
+
<div class="terminal_caption">
|
2546
|
+
compile</div>
|
2547
|
+
<pre class="terminal">$ kwartz -l eperl ex-while.pdata
|
2548
|
+
<b><? while (($item = $dbh->fetch()) != null) { !></b>
|
2549
|
+
<tr>
|
2550
|
+
<td><?= $item->name !></td>
|
2551
|
+
</tr>
|
2552
|
+
<b><? } !></b>
|
2553
|
+
|
2554
|
+
<tr>
|
2555
|
+
<b><? while (($item = $dbh->fetch()) != null) { !></b>
|
2556
|
+
<td><?= $item->name !></td>
|
2557
|
+
<b><? } !></b>
|
2558
|
+
</tr>
|
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"><div <b>title="if status=='error'"</b>>
|
2577
|
+
<p class="error" title="cont mesg">error</p>
|
2578
|
+
</div>
|
2579
|
+
<div <b>title="elsif status=='warning'"</b>>
|
2580
|
+
<p class="warning" title="cont mesg">waring</p>
|
2581
|
+
</div>
|
2582
|
+
<div <b>title="else"</b>>
|
2583
|
+
<p title="cont mesg">mesg</p>
|
2584
|
+
</div>
|
2585
|
+
</pre>
|
2586
|
+
<div class="terminal_caption">
|
2587
|
+
compile</div>
|
2588
|
+
<pre class="terminal">$ kwartz -l eruby ex-if.pdata
|
2589
|
+
<b><% if status=='error' then %></b>
|
2590
|
+
<div>
|
2591
|
+
<p class="error"><%= mesg %></p>
|
2592
|
+
</div>
|
2593
|
+
<b><% elsif status=='warning' then %></b>
|
2594
|
+
<div>
|
2595
|
+
<p class="warning"><%= mesg %></p>
|
2596
|
+
</div>
|
2597
|
+
<b><% else %></b>
|
2598
|
+
<div>
|
2599
|
+
<p><%= mesg %></p>
|
2600
|
+
</div>
|
2601
|
+
<b><% end %></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"><div <b>title="if($status=='error')"</b>>
|
2610
|
+
<p class="error" title="cont($mesg)">error</p>
|
2611
|
+
</div>
|
2612
|
+
<div <b>title="elseif($status=='warning')"</b>>
|
2613
|
+
<p class="warning" title="cont($mesg)">waring</p>
|
2614
|
+
</div>
|
2615
|
+
<div <b>title="else"</b>>
|
2616
|
+
<p title="cont($mesg)">mesg</p>
|
2617
|
+
</div>
|
2618
|
+
</pre>
|
2619
|
+
<div class="terminal_caption">
|
2620
|
+
compile</div>
|
2621
|
+
<pre class="terminal">$ kwartz -l php ex-if.pdata
|
2622
|
+
<b><?php if ($status=='error') { ?></b>
|
2623
|
+
<div>
|
2624
|
+
<p class="error"><?php echo $mesg; ?></p>
|
2625
|
+
</div>
|
2626
|
+
<b><?php } elseif ($status=='warning') { ?></b>
|
2627
|
+
<div>
|
2628
|
+
<p class="warning"><?php echo $mesg; ?></p>
|
2629
|
+
</div>
|
2630
|
+
<b><?php } else { ?></b>
|
2631
|
+
<div>
|
2632
|
+
<p><?php echo $mesg; ?></p>
|
2633
|
+
</div>
|
2634
|
+
<b><?php } ?></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"><div <b>title="if(status=='error')"</b>>
|
2643
|
+
<p class="error" title="cont(mesg)">error</p>
|
2644
|
+
</div>
|
2645
|
+
<div <b>title="elseif(status=='warning')"</b>>
|
2646
|
+
<p class="warning" title="cont(mesg)">waring</p>
|
2647
|
+
</div>
|
2648
|
+
<div <b>title="else"</b>>
|
2649
|
+
<p title="cont(mesg)">mesg</p>
|
2650
|
+
</div>
|
2651
|
+
</pre>
|
2652
|
+
<div class="terminal_caption">
|
2653
|
+
compile</div>
|
2654
|
+
<pre class="terminal">$ kwartz -l jstl ex-if.pdata
|
2655
|
+
<b><c:choose><c:when test="${status=='error'}"></b>
|
2656
|
+
<div>
|
2657
|
+
<p class="error">${mesg}</p>
|
2658
|
+
</div>
|
2659
|
+
<b></c:when><c:when test="${status=='warning'}"></b>
|
2660
|
+
<div>
|
2661
|
+
<p class="warning">${mesg}</p>
|
2662
|
+
</div>
|
2663
|
+
<b></c:when><c:otherwise></b>
|
2664
|
+
<div>
|
2665
|
+
<p>${mesg}</p>
|
2666
|
+
</div>
|
2667
|
+
<b></c:otherwise></c:choose></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"><div <b>title="if($status=='error')"</b>>
|
2676
|
+
<p class="error" title="cont($mesg)">error</p>
|
2677
|
+
</div>
|
2678
|
+
<div <b>title="elsif($status=='warning')"</b>>
|
2679
|
+
<p class="warning" title="cont($mesg)">waring</p>
|
2680
|
+
</div>
|
2681
|
+
<div <b>title="else"</b>>
|
2682
|
+
<p title="cont($mesg)">mesg</p>
|
2683
|
+
</div>
|
2684
|
+
</pre>
|
2685
|
+
<div class="terminal_caption">
|
2686
|
+
compile</div>
|
2687
|
+
<pre class="terminal">$ kwartz -l eperl ex-if.pdata
|
2688
|
+
<b><? if ($status=='error') { !></b>
|
2689
|
+
<div>
|
2690
|
+
<p class="error"><?= $mesg !></p>
|
2691
|
+
</div>
|
2692
|
+
<b><? } elsif ($status=='warning') { !></b>
|
2693
|
+
<div>
|
2694
|
+
<p class="warning"><?= $mesg !></p>
|
2695
|
+
</div>
|
2696
|
+
<b><? } else { !></b>
|
2697
|
+
<div>
|
2698
|
+
<p><?= $mesg !></p>
|
2699
|
+
</div>
|
2700
|
+
<b><? } !></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"><tr <b>title="set color=i%2==0 ? 'red' : 'blue'"</b>>
|
2716
|
+
<td title="cont: color">red</td>
|
2717
|
+
</tr>
|
2718
|
+
</pre>
|
2719
|
+
<div class="terminal_caption">
|
2720
|
+
compile</div>
|
2721
|
+
<pre class="terminal">$ kwartz -l eruby ex-set.pdata
|
2722
|
+
<b><% color=i%2==0 ? 'red' : 'blue' %></b>
|
2723
|
+
<tr>
|
2724
|
+
<td><%= color %></td>
|
2725
|
+
</tr>
|
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"><tr <b>title="set($color=$i%2==0 ? 'red' : 'blue')"</b>>
|
2734
|
+
<td title="cont($color)">red</td>
|
2735
|
+
</tr>
|
2736
|
+
</pre>
|
2737
|
+
<div class="terminal_caption">
|
2738
|
+
compile</div>
|
2739
|
+
<pre class="terminal">$ kwartz -l php ex-set.pdata
|
2740
|
+
<b><?php $color=$i%2==0 ? 'red' : 'blue'; ?></b>
|
2741
|
+
<tr>
|
2742
|
+
<td><?php echo $color; ?></td>
|
2743
|
+
</tr>
|
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"><tr <b>title="set(color=i%2==0 ? 'red' : 'blue')"</b>>
|
2752
|
+
<td title="cont(color)">red</td>
|
2753
|
+
</tr>
|
2754
|
+
</pre>
|
2755
|
+
<div class="terminal_caption">
|
2756
|
+
compile</div>
|
2757
|
+
<pre class="terminal">$ kwartz -l jstl ex-set.pdata
|
2758
|
+
<b><c:set var="color=i%2=" value="${0 ? 'red' : 'blue'}" /></b>
|
2759
|
+
<tr>
|
2760
|
+
<td>${color}</td>
|
2761
|
+
</tr>
|
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"><tr <b>title="set($color=i%2==0 ? 'red' : 'blue')"</b>>
|
2770
|
+
<td title="cont($color)">red</td>
|
2771
|
+
</tr>
|
2772
|
+
</pre>
|
2773
|
+
<div class="terminal_caption">
|
2774
|
+
compile</div>
|
2775
|
+
<pre class="terminal">$ kwartz -l eperl ex-set.pdata
|
2776
|
+
<b><? $color=i%2==0 ? 'red' : 'blue'; !></b>
|
2777
|
+
<tr>
|
2778
|
+
<td><?= $color !></td>
|
2779
|
+
</tr>
|
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"><ul <b>id="mark:list"</b>>
|
2799
|
+
<li <b>title="id: item"</b>>foo</li>
|
2800
|
+
</ul>
|
2801
|
+
</pre>
|
2802
|
+
<div class="terminal_caption">
|
2803
|
+
compile</div>
|
2804
|
+
<pre class="terminal">$ kwartz -l eruby ex-mark.pdata
|
2805
|
+
<ul>
|
2806
|
+
<li>foo</li>
|
2807
|
+
</ul>
|
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"><ul <b>id="mark:list"</b>>
|
2816
|
+
<li <b>title="id(item)"</b>>foo</li>
|
2817
|
+
</ul>
|
2818
|
+
</pre>
|
2819
|
+
<div class="terminal_caption">
|
2820
|
+
compile</div>
|
2821
|
+
<pre class="terminal">$ kwartz -l php ex-mark.pdata
|
2822
|
+
<ul>
|
2823
|
+
<li>foo</li>
|
2824
|
+
</ul>
|
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"><ul <b>id="mark:list"</b>>
|
2833
|
+
<li <b>title="id(item)"</b>>foo</li>
|
2834
|
+
</ul>
|
2835
|
+
</pre>
|
2836
|
+
<div class="terminal_caption">
|
2837
|
+
compile</div>
|
2838
|
+
<pre class="terminal">$ kwartz -l jstl ex-mark.pdata
|
2839
|
+
<ul>
|
2840
|
+
<li>foo</li>
|
2841
|
+
</ul>
|
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"><ul <b>id="mark:list"</b>>
|
2850
|
+
<li <b>title="id(item)"</b>>foo</li>
|
2851
|
+
</ul>
|
2852
|
+
</pre>
|
2853
|
+
<div class="terminal_caption">
|
2854
|
+
compile</div>
|
2855
|
+
<pre class="terminal">$ kwartz -l eperl ex-mark.pdata
|
2856
|
+
<ul>
|
2857
|
+
<li>foo</li>
|
2858
|
+
</ul>
|
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"><tr class="odd"
|
2880
|
+
title="FOR v in list; <b>attr: 'class' v_tgl; attr: 'style' style</b>">
|
2881
|
+
<td title="cont v.name">foo</td>
|
2882
|
+
</tr>
|
2883
|
+
</pre>
|
2884
|
+
<div class="terminal_caption">
|
2885
|
+
compile</div>
|
2886
|
+
<pre class="terminal">$ kwartz -l eruby ex-attr.pdata
|
2887
|
+
<% v_ctr = 0 %>
|
2888
|
+
<% for v in list do %>
|
2889
|
+
<% v_ctr += 1 %>
|
2890
|
+
<% v_tgl = v_ctr%2==0 ? 'even' : 'odd' %>
|
2891
|
+
<tr <b>class="<%= v_tgl %>"</b> <b>style="<%= style %>"></b>
|
2892
|
+
<td><%= v.name %></td>
|
2893
|
+
</tr>
|
2894
|
+
<% end %>
|
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"><tr class="odd"
|
2903
|
+
title="FOREACH($list as $v); <b>attr('class',$v_tgl); attr('style',$style)</b>">
|
2904
|
+
<td title="cont($v->name)">foo</td>
|
2905
|
+
</tr>
|
2906
|
+
</pre>
|
2907
|
+
<div class="terminal_caption">
|
2908
|
+
compile</div>
|
2909
|
+
<pre class="terminal">$ kwartz -l php ex-attr.pdata
|
2910
|
+
<?php $v_ctr = 0; ?>
|
2911
|
+
<?php foreach ($list as $v) { ?>
|
2912
|
+
<?php $v_ctr++; ?>
|
2913
|
+
<?php $v_tgl = $v_ctr%2==0 ? 'even' : 'odd'; ?>
|
2914
|
+
<tr <b>class="<?php echo $v_tgl; ?>"</b> <b>style="<?php echo $style; ?>"</b>>
|
2915
|
+
<td><?php echo $v->name; ?></td>
|
2916
|
+
</tr>
|
2917
|
+
<?php } ?>
|
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"><tr class="odd"
|
2926
|
+
title="FOR(v: list); <b>attr('class',v_tgl); attr('style',style)</b>">
|
2927
|
+
<td title="cont(v.name)">foo</td>
|
2928
|
+
</tr>
|
2929
|
+
</pre>
|
2930
|
+
<div class="terminal_caption">
|
2931
|
+
compile</div>
|
2932
|
+
<pre class="terminal">$ kwartz -l jstl ex-attr.pdata
|
2933
|
+
<c:forEach var="v" items="${list}" varStatus="v_status">
|
2934
|
+
<c:set var="v_ctr" value="${v_status.count}" />
|
2935
|
+
<c:set var="v_tgl" value="${v_status.count%2==0 ? 'even' : 'odd'}" />
|
2936
|
+
<tr <b>class="${v_tgl}"</b> <b>style="${style}"</b>>
|
2937
|
+
<td>${v.name}</td>
|
2938
|
+
</tr>
|
2939
|
+
</c:forEach>
|
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"><tr class="odd"
|
2948
|
+
title="FOREACH($v in @list); <b>attr('class',$v_tgl); attr('style',$style)</b>">
|
2949
|
+
<td title="cont($v->name)">foo</td>
|
2950
|
+
</tr>
|
2951
|
+
</pre>
|
2952
|
+
<div class="terminal_caption">
|
2953
|
+
compile</div>
|
2954
|
+
<pre class="terminal">$ kwartz -l eperl ex-attr.pdata
|
2955
|
+
<? my $v_ctr = 0; !>
|
2956
|
+
<? foreach my $v (@list) { !>
|
2957
|
+
<? $v_ctr++; !>
|
2958
|
+
<? my $v_tgl = $v_ctr%2==0 ? 'even' : 'odd'; !>
|
2959
|
+
<tr <b>class="<?= $v_tgl !>"</b> <b>style="<?= $style !>"</b>>
|
2960
|
+
<td><?= $v->name !></td>
|
2961
|
+
</tr>
|
2962
|
+
<? } !>
|
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"><input type="checkbox"
|
2984
|
+
<b>title="append: flag1 ? ' checked=\'checked\'' : ''"</b>>
|
2985
|
+
</pre>
|
2986
|
+
<div class="terminal_caption">
|
2987
|
+
compile</div>
|
2988
|
+
<pre class="terminal">$ kwartz -l eruby ex-append.pdata
|
2989
|
+
<input type="checkbox"<b><%= flag1 ? ' checked=\'checked\'' : '' %></b>>
|
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"><input type="checkbox"
|
2998
|
+
<b>title="append($flag1 ? ' checked=\'checked\'' : '')"</b>>
|
2999
|
+
</pre>
|
3000
|
+
<div class="terminal_caption">
|
3001
|
+
compile</div>
|
3002
|
+
<pre class="terminal">$ kwartz -l php ex-append.pdata
|
3003
|
+
<input type="checkbox"<b><?php echo $flag1 ? ' checked=\'checked\'' : ''; ?></b>>
|
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"><input type="checkbox"
|
3012
|
+
<b>title="append(flag1 ? ' checked=\'checked\'' : '')"</b>>
|
3013
|
+
</pre>
|
3014
|
+
<div class="terminal_caption">
|
3015
|
+
compile</div>
|
3016
|
+
<pre class="terminal">$ kwartz -l jstl ex-append.pdata
|
3017
|
+
<input type="checkbox"<b>${flag1 ? ' checked=\'checked\'' : ''}</b>>
|
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"><input type="checkbox"
|
3026
|
+
<b>title="append($flag1 ? ' checked=\'checked\'' : '')"</b>>
|
3027
|
+
</pre>
|
3028
|
+
<div class="terminal_caption">
|
3029
|
+
compile</div>
|
3030
|
+
<pre class="terminal">$ kwartz -l eperl ex-append.pdata
|
3031
|
+
<input type="checkbox"<b><?= $flag1 ? ' checked=\'checked\'' : '' !></b>>
|
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"><ul>
|
3050
|
+
<li>foo</li>
|
3051
|
+
<li <b>id="dummy:d1"</b>>bar</li>
|
3052
|
+
<li <b>title="dummy:"</b>>baz</li>
|
3053
|
+
</ul>
|
3054
|
+
</pre>
|
3055
|
+
<div class="terminal_caption">
|
3056
|
+
compile</div>
|
3057
|
+
<pre class="terminal">$ kwartz -l eruby ex-dummy.pdata
|
3058
|
+
<ul>
|
3059
|
+
<li>foo</li>
|
3060
|
+
</ul>
|
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"><ul>
|
3069
|
+
<li>foo</li>
|
3070
|
+
<li <b>id="dummy:d1"</b>>bar</li>
|
3071
|
+
<li <b>title="dummy()"</b>>baz</li>
|
3072
|
+
</ul>
|
3073
|
+
</pre>
|
3074
|
+
<div class="terminal_caption">
|
3075
|
+
compile</div>
|
3076
|
+
<pre class="terminal">$ kwartz -l php ex-dummy.pdata
|
3077
|
+
<ul>
|
3078
|
+
<li>foo</li>
|
3079
|
+
</ul>
|
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"><ul>
|
3088
|
+
<li>foo</li>
|
3089
|
+
<li <b>id="dummy:d1"</b>>bar</li>
|
3090
|
+
<li <b>title="dummy()"</b>>baz</li>
|
3091
|
+
</ul>
|
3092
|
+
</pre>
|
3093
|
+
<div class="terminal_caption">
|
3094
|
+
compile</div>
|
3095
|
+
<pre class="terminal">$ kwartz -l jstl ex-dummy.pdata
|
3096
|
+
<ul>
|
3097
|
+
<li>foo</li>
|
3098
|
+
</ul>
|
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"><ul>
|
3107
|
+
<li>foo</li>
|
3108
|
+
<li <b>id="dummy:d1"</b>>bar</li>
|
3109
|
+
<li <b>title="dummy()"</b>>baz</li>
|
3110
|
+
</ul>
|
3111
|
+
</pre>
|
3112
|
+
<div class="terminal_caption">
|
3113
|
+
compile</div>
|
3114
|
+
<pre class="terminal">$ kwartz -l eperl ex-dummy.pdata
|
3115
|
+
<ul>
|
3116
|
+
<li>foo</li>
|
3117
|
+
</ul>
|
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: <em <b>title="default: user"</b>>Guest</em>
|
3138
|
+
</pre>
|
3139
|
+
<div class="terminal_caption">
|
3140
|
+
compile</div>
|
3141
|
+
<pre class="terminal">$ kwartz -l eruby ex-default.pdata
|
3142
|
+
name: <em><b><% if (user) && !(user).to_s.empty? then %><%= user %><% else %>Guest<% end %></b></em>
|
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: <em <b>title="default($user)"</b>>Guest</em>
|
3151
|
+
</pre>
|
3152
|
+
<div class="terminal_caption">
|
3153
|
+
compile</div>
|
3154
|
+
<pre class="terminal">$ kwartz -l php ex-default.pdata
|
3155
|
+
name: <em><b><?php if ($user) { ?><?php echo $user; ?><?php } else { ?>Guest<?php } ?></b></em>
|
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: <em <b>title="default(user)"</b>>Guest</em>
|
3164
|
+
</pre>
|
3165
|
+
<div class="terminal_caption">
|
3166
|
+
compile</div>
|
3167
|
+
<pre class="terminal">$ kwartz -l jstl ex-default.pdata
|
3168
|
+
name: <em><b><c:out value="${user}" default="Guest" /></b></em>
|
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: <em <b>title="default($user)"</b>>Guest</em>
|
3177
|
+
</pre>
|
3178
|
+
<div class="terminal_caption">
|
3179
|
+
compile</div>
|
3180
|
+
<pre class="terminal">$ kwartz -l eperl ex-default.pdata
|
3181
|
+
name: <em><b><? if ($user) { !><?= $user !><? } else { !>Guest<? } !></b></em>
|
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"><div <b>id="mark:link"</b>>
|
3201
|
+
back to <a href="/">home</a>.
|
3202
|
+
</div>
|
3203
|
+
|
3204
|
+
<!-- replace element with other element -->
|
3205
|
+
<p <b>id="replace_element_with_element:link"</b>>
|
3206
|
+
back to home
|
3207
|
+
</p>
|
3208
|
+
|
3209
|
+
<!-- replace element with other content-->
|
3210
|
+
<p <b>id="replace_element_with_content:link"</b>>
|
3211
|
+
back to home
|
3212
|
+
</p>
|
3213
|
+
|
3214
|
+
<!-- replace content with other element -->
|
3215
|
+
<p <b>id="replace_content_with_element:link"</b>>
|
3216
|
+
back to home
|
3217
|
+
</p>
|
3218
|
+
|
3219
|
+
<!-- replace content with other content -->
|
3220
|
+
<p <b>id="replace_content_with_content:link"</b>>
|
3221
|
+
back to home
|
3222
|
+
</p>
|
3223
|
+
</pre>
|
3224
|
+
<div class="terminal_caption">
|
3225
|
+
compile</div>
|
3226
|
+
<pre class="terminal">$ kwartz -l eruby ex-replace.pdata
|
3227
|
+
<div>
|
3228
|
+
back to <a href="/">home</a>.
|
3229
|
+
</div>
|
3230
|
+
|
3231
|
+
<!-- replace element with other element -->
|
3232
|
+
<div>
|
3233
|
+
back to <a href="/">home</a>.
|
3234
|
+
</div>
|
3235
|
+
|
3236
|
+
<!-- replace element with other content-->
|
3237
|
+
back to <a href="/">home</a>.
|
3238
|
+
|
3239
|
+
<!-- replace content with other element -->
|
3240
|
+
<p>
|
3241
|
+
<div>
|
3242
|
+
back to <a href="/">home</a>.
|
3243
|
+
</div>
|
3244
|
+
</p>
|
3245
|
+
|
3246
|
+
<!-- replace content with other content -->
|
3247
|
+
<p>
|
3248
|
+
back to <a href="/">home</a>.
|
3249
|
+
</p>
|
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 > 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>
|