kwartz 3.0.0 → 3.1.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/ChangeLog +36 -1
- data/LGPL +504 -0
- data/README.txt +16 -2
- data/bin/kwartz +1 -1
- data/doc-api/classes/Kwartz.html +47 -1
- data/doc-api/classes/Kwartz/Assertion.html +6 -6
- data/doc-api/classes/Kwartz/AssertionError.html +6 -6
- data/doc-api/classes/Kwartz/AttrInfo.html +42 -42
- data/doc-api/classes/Kwartz/BaseError.html +12 -12
- data/doc-api/classes/Kwartz/BaseTranslator.html +210 -43
- data/doc-api/classes/Kwartz/CharacterType.html +24 -24
- data/doc-api/classes/Kwartz/CommandOptionError.html +7 -7
- data/doc-api/classes/Kwartz/CommandOptions.html +49 -49
- data/doc-api/classes/Kwartz/Config.html +6 -1
- data/doc-api/classes/Kwartz/ConvertError.html +14 -14
- data/doc-api/classes/Kwartz/Converter.html +31 -30
- data/doc-api/classes/Kwartz/CssStyleParser.html +79 -57
- data/doc-api/classes/Kwartz/Defun.html +313 -0
- data/doc-api/classes/Kwartz/DocumentRuleset.html +58 -58
- data/doc-api/classes/Kwartz/ElementExpander.html +32 -32
- data/doc-api/classes/Kwartz/ElementInfo.html +29 -29
- data/doc-api/classes/Kwartz/ElementRuleset.html +126 -96
- data/doc-api/classes/Kwartz/EperlHandler.html +108 -84
- data/doc-api/classes/Kwartz/EperlTranslator.html +7 -7
- data/doc-api/classes/Kwartz/ErubisHandler.html +2 -2
- data/doc-api/classes/Kwartz/ErubisTranslator.html +8 -8
- data/doc-api/classes/Kwartz/ErubyHandler.html +2 -220
- data/doc-api/classes/Kwartz/ErubyTranslator.html +7 -7
- data/doc-api/classes/Kwartz/ExpandStatement.html +20 -20
- data/doc-api/classes/Kwartz/Handler.html +122 -117
- data/doc-api/classes/Kwartz/HandlerArgument.html +215 -0
- data/doc-api/classes/Kwartz/Helper.html +112 -0
- data/doc-api/classes/Kwartz/Helper/ActionViewHelper.html +221 -0
- data/doc-api/classes/Kwartz/Helper/RailsTemplate.html +630 -0
- data/doc-api/classes/Kwartz/JstlHandler.html +208 -193
- data/doc-api/classes/Kwartz/JstlTranslator.html +15 -15
- data/doc-api/classes/Kwartz/KwartzError.html +6 -6
- data/doc-api/classes/Kwartz/Main.html +39 -23
- data/doc-api/classes/Kwartz/NativeExpression.html +18 -18
- data/doc-api/classes/Kwartz/NativeStatement.html +25 -25
- data/doc-api/classes/Kwartz/Node.html +6 -6
- data/doc-api/classes/Kwartz/PIErubisHandler.html +113 -0
- data/doc-api/classes/Kwartz/PIErubisTranslator.html +200 -0
- data/doc-api/classes/Kwartz/ParseError.html +6 -6
- data/doc-api/classes/Kwartz/PhpHandler.html +102 -83
- data/doc-api/classes/Kwartz/PhpTranslator.html +14 -14
- data/doc-api/classes/Kwartz/PresentationLogicParser.html +136 -128
- data/doc-api/classes/Kwartz/PrintStatement.html +19 -19
- data/doc-api/classes/Kwartz/RailsHandler.html +121 -118
- data/doc-api/classes/Kwartz/RailsTranslator.html +7 -7
- data/doc-api/classes/Kwartz/RubyHandler.html +349 -0
- data/doc-api/classes/Kwartz/RubyStyleParser.html +85 -85
- data/doc-api/classes/Kwartz/RubyTranslator.html +218 -0
- data/doc-api/classes/Kwartz/StatementHelper.html +479 -0
- data/doc-api/classes/Kwartz/StrutsTranslator.html +12 -12
- data/doc-api/classes/Kwartz/TagInfo.html +28 -28
- data/doc-api/classes/Kwartz/TextConverter.html +28 -28
- data/doc-api/classes/Kwartz/Translator.html +42 -42
- data/doc-api/classes/Kwartz/Util.html +284 -0
- data/doc-api/created.rid +1 -1
- data/doc-api/files/__/README_txt.html +30 -3
- data/doc-api/files/kwartz/assert_rb.html +1 -1
- data/doc-api/files/kwartz/binding/eperl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/erubis_rb.html +3 -3
- data/doc-api/files/kwartz/binding/eruby_rb.html +3 -2
- data/doc-api/files/kwartz/binding/jstl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/php_rb.html +2 -2
- data/doc-api/files/kwartz/binding/pierubis_rb.html +116 -0
- data/doc-api/files/kwartz/binding/rails_rb.html +2 -2
- data/doc-api/files/kwartz/binding/ruby_rb.html +115 -0
- data/doc-api/files/kwartz/binding/struts_rb.html +1 -1
- data/doc-api/files/kwartz/config_rb.html +2 -2
- data/doc-api/files/kwartz/converter_rb.html +3 -2
- data/doc-api/files/kwartz/defun_rb.html +116 -0
- data/doc-api/files/kwartz/error_rb.html +1 -1
- data/doc-api/files/kwartz/helper/rails_rb.html +123 -0
- data/doc-api/files/kwartz/main_rb.html +5 -2
- data/doc-api/files/kwartz/node_rb.html +2 -2
- data/doc-api/files/kwartz/parser_rb.html +2 -2
- data/doc-api/files/kwartz/translator_rb.html +2 -2
- data/doc-api/files/kwartz/util/assert-text-equal_rb.html +1 -1
- data/doc-api/files/kwartz/util/testcase-helper_rb.html +2 -2
- data/doc-api/files/kwartz/util_rb.html +107 -0
- data/doc-api/files/kwartz_rb.html +3 -2
- data/doc-api/fr_class_index.html +11 -0
- data/doc-api/fr_file_index.html +5 -0
- data/doc-api/fr_method_index.html +242 -190
- data/doc/p-pattern.html +94 -94
- data/doc/reference.html +847 -612
- data/doc/users-guide.html +744 -241
- data/examples/rails1/README +2 -2
- data/examples/rails1/application_helper.rb +2 -27
- data/examples/rails1/link_to.plogic +5 -5
- data/examples/rails1/list.plogic +2 -2
- data/examples/rails2/app/controllers/application.rb +14 -0
- data/examples/rails2/app/controllers/groups_controller.rb +47 -0
- data/examples/rails2/app/controllers/members_controller.rb +56 -0
- data/examples/rails2/app/helpers/application_helper.rb +6 -0
- data/examples/rails2/app/helpers/groups_helper.rb +2 -0
- data/examples/rails2/app/helpers/members_helper.rb +2 -0
- data/examples/rails2/app/models/group.rb +2 -0
- data/examples/rails2/app/models/member.rb +3 -0
- data/examples/rails2/app/views/groups/_form.html +30 -0
- data/examples/rails2/app/views/groups/_form.plogic +11 -0
- data/examples/rails2/app/views/groups/_link.plogic +19 -0
- data/examples/rails2/app/views/groups/_read.plogic +7 -0
- data/examples/rails2/app/views/groups/edit.cfg.yaml +2 -0
- data/examples/rails2/app/views/groups/edit.html +26 -0
- data/examples/rails2/app/views/groups/edit.plogic +9 -0
- data/examples/rails2/app/views/groups/list.html +48 -0
- data/examples/rails2/app/views/groups/list.plogic +32 -0
- data/examples/rails2/app/views/groups/new.cfg.yaml +2 -0
- data/examples/rails2/app/views/groups/new.html +27 -0
- data/examples/rails2/app/views/groups/new.plogic +9 -0
- data/examples/rails2/app/views/groups/show.html +27 -0
- data/examples/rails2/app/views/groups/show.plogic +2 -0
- data/examples/rails2/app/views/layouts/groups.html +23 -0
- data/examples/rails2/app/views/layouts/groups.plogic +11 -0
- data/examples/rails2/app/views/layouts/members.html +23 -0
- data/examples/rails2/app/views/layouts/members.plogic +11 -0
- data/examples/rails2/app/views/layouts/members2.html +24 -0
- data/examples/rails2/app/views/layouts/members2.plogic +11 -0
- data/examples/rails2/app/views/members/_form.plogic +27 -0
- data/examples/rails2/app/views/members/_link.plogic +19 -0
- data/examples/rails2/app/views/members/_read.plogic +29 -0
- data/examples/rails2/app/views/members/edit.cfg.yaml +6 -0
- data/examples/rails2/app/views/members/edit.html +27 -0
- data/examples/rails2/app/views/members/edit.plogic +10 -0
- data/examples/rails2/app/views/members/list.html +53 -0
- data/examples/rails2/app/views/members/list.plogic +32 -0
- data/examples/rails2/app/views/members/new.html +61 -0
- data/examples/rails2/app/views/members/new.plogic +17 -0
- data/examples/rails2/app/views/members/show.html +41 -0
- data/examples/rails2/app/views/members/show.plogic +3 -0
- data/examples/rails2/db/create-tables.mysql.sql +27 -0
- data/examples/rails2/db/create-tables.pgsql.sql +27 -0
- data/examples/rails2/db/insert-data.sql +21 -0
- data/examples/rails2/db/tabledef.yaml +51 -0
- data/kwartz.gemspec +4 -4
- data/lib/kwartz.rb +10 -2
- data/lib/kwartz/assert.rb +1 -1
- data/lib/kwartz/binding/eperl.rb +85 -61
- data/lib/kwartz/binding/erubis.rb +6 -8
- data/lib/kwartz/binding/eruby.rb +5 -120
- data/lib/kwartz/binding/jstl.rb +116 -101
- data/lib/kwartz/binding/php.rb +79 -60
- data/lib/kwartz/binding/pierubis.rb +58 -0
- data/lib/kwartz/binding/rails.rb +45 -42
- data/lib/kwartz/binding/ruby.rb +193 -0
- data/lib/kwartz/binding/struts.rb +1 -1
- data/lib/kwartz/config.rb +4 -3
- data/lib/kwartz/converter.rb +231 -68
- data/lib/kwartz/defun.rb +126 -0
- data/lib/kwartz/error.rb +1 -1
- data/lib/kwartz/helper/rails.rb +437 -0
- data/lib/kwartz/main.rb +30 -38
- data/lib/kwartz/node.rb +46 -31
- data/lib/kwartz/parser.rb +43 -15
- data/lib/kwartz/translator.rb +104 -6
- data/lib/kwartz/util.rb +113 -0
- data/lib/kwartz/util/assert-text-equal.rb +1 -1
- data/lib/kwartz/util/testcase-helper.rb +26 -8
- data/test/test-compile.rb +3 -3
- data/test/test-compile.yaml +135 -5
- data/test/test-converter.rb +16 -8
- data/test/test-converter.yaml +307 -76
- data/test/test-directives.rb +1 -1
- data/test/test-directives.yaml +964 -979
- data/test/test-main.rb +61 -146
- data/test/test-main.yaml +235 -0
- data/test/test-parser.rb +10 -12
- data/test/test-parser.yaml +484 -326
- data/test/test-rails.rb +1 -1
- data/test/test-rails.yaml +37 -37
- data/test/test-ruleset.rb +1 -1
- data/test/test-ruleset.yaml +34 -40
- data/test/test.rb +1 -1
- metadata +82 -3
- data/COPYING +0 -340
data/doc/p-pattern.html
CHANGED
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
<div align="left"><h1>Presentation Pattern Catalog</h1></div>
|
|
17
17
|
<div align="left">
|
|
18
18
|
Makoto Kuwata <kwa(at)kuwata-lab.com><br>
|
|
19
|
-
last update: $Date: 2006-
|
|
19
|
+
last update: $Date: 2006-09-18 10:43:06 +0900 (Mon, 18 Sep 2006) $<br>
|
|
20
20
|
</div>
|
|
21
21
|
|
|
22
22
|
<a name="preface"></a>
|
|
23
23
|
<h2 class="section1">Preface</h2>
|
|
24
|
-
<p>Kwartz is the template system which realized the concept of '<
|
|
24
|
+
<p>Kwartz is the template system which realized the concept of '<strong>Independence of Presentation Logic (IoPL)</strong>.'
|
|
25
25
|
This concept enables to use complex presentation logics without breaking HTML design at all.
|
|
26
26
|
</p>
|
|
27
27
|
<p>There are several patterns which help you to separate presentation logic from presentation data well.
|
|
@@ -107,7 +107,7 @@ This is named 'Replace Element with Value Pattern.'
|
|
|
107
107
|
<a name="replace1.pdata"></a>
|
|
108
108
|
<div class="program_caption">
|
|
109
109
|
Presentation Data:</div>
|
|
110
|
-
<pre class="program">Hello <span <
|
|
110
|
+
<pre class="program">Hello <span <strong>id="mark:user"</strong>>World</span>!
|
|
111
111
|
</pre>
|
|
112
112
|
<a name="replace1.plogic"></a>
|
|
113
113
|
<div class="program_caption">
|
|
@@ -115,14 +115,14 @@ Presentation Logic:</div>
|
|
|
115
115
|
<pre class="program">/* print value of variable 'username' instead of the element */
|
|
116
116
|
#user {
|
|
117
117
|
logic: {
|
|
118
|
-
<
|
|
118
|
+
<strong>print username</strong>
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
</pre>
|
|
122
122
|
<a name="replace1.expected"></a>
|
|
123
123
|
<div class="output_caption">
|
|
124
124
|
Output Script:</div>
|
|
125
|
-
<pre class="output">Hello <
|
|
125
|
+
<pre class="output">Hello <strong><%= username %></strong>!
|
|
126
126
|
</pre>
|
|
127
127
|
<br>
|
|
128
128
|
|
|
@@ -138,7 +138,7 @@ Output Script:</div>
|
|
|
138
138
|
<p>The output script will be:
|
|
139
139
|
</p>
|
|
140
140
|
<a name="replace1a.expected"></a>
|
|
141
|
-
<pre class="output">Hello <
|
|
141
|
+
<pre class="output">Hello <strong><%= username %></strong>!
|
|
142
142
|
</pre>
|
|
143
143
|
<br>
|
|
144
144
|
|
|
@@ -165,7 +165,7 @@ This is named 'Replace Content with Value Pattern.'
|
|
|
165
165
|
<a name="replace2.pdata"></a>
|
|
166
166
|
<div class="program_caption">
|
|
167
167
|
Presentation Data:</div>
|
|
168
|
-
<pre class="program"><h1 <
|
|
168
|
+
<pre class="program"><h1 <strong>id="mark:title"</strong>>Example</h1>
|
|
169
169
|
</pre>
|
|
170
170
|
<a name="replace2.plogic"></a>
|
|
171
171
|
<div class="program_caption">
|
|
@@ -174,7 +174,7 @@ Presentation Logic:</div>
|
|
|
174
174
|
#title {
|
|
175
175
|
logic: {
|
|
176
176
|
_stag # start-tag
|
|
177
|
-
<
|
|
177
|
+
<strong>print title </strong>
|
|
178
178
|
_etag # end-tag
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -192,18 +192,18 @@ Output Script:</div>
|
|
|
192
192
|
</p>
|
|
193
193
|
<a name="replace2a.plogic"></a>
|
|
194
194
|
<pre class="program">#title {
|
|
195
|
-
<
|
|
195
|
+
<strong>cont: title;</strong>
|
|
196
196
|
/* or value: title; */
|
|
197
197
|
}
|
|
198
198
|
</pre>
|
|
199
199
|
<p>The output will be:
|
|
200
200
|
</p>
|
|
201
201
|
<a name="replace2a.expected"></a>
|
|
202
|
-
<pre class="output"><h1><
|
|
202
|
+
<pre class="output"><h1><strong><%= title %></strong></h1>
|
|
203
203
|
</pre>
|
|
204
|
-
<p>Kwartz Directive '<code>
|
|
204
|
+
<p>Kwartz Directive '<code>kw:d="cont: <em>expr</em>"</code>' or '<code>kw:d="value: <em>expr</em>"</code>' lets you to use this pattern without presentation logic file.
|
|
205
205
|
</p>
|
|
206
|
-
<pre class="program"><h1 <
|
|
206
|
+
<pre class="program"><h1 <strong>id="value: title"</strong>>Example</h1>
|
|
207
207
|
</pre>
|
|
208
208
|
<br>
|
|
209
209
|
|
|
@@ -236,7 +236,7 @@ displayed when username is null or empty.
|
|
|
236
236
|
<a name="replace5.pdata"></a>
|
|
237
237
|
<div class="program_caption">
|
|
238
238
|
Presentation Data:</div>
|
|
239
|
-
<pre class="program">Hello <span <
|
|
239
|
+
<pre class="program">Hello <span <strong>id="mark:user"</strong>>World</span>!
|
|
240
240
|
</pre>
|
|
241
241
|
<a name="replace5.plogic"></a>
|
|
242
242
|
<div class="program_caption">
|
|
@@ -245,9 +245,9 @@ Presentation Logic:</div>
|
|
|
245
245
|
#user {
|
|
246
246
|
logic: {
|
|
247
247
|
if username && !username.empty?
|
|
248
|
-
<
|
|
248
|
+
<strong>print username</strong>
|
|
249
249
|
else
|
|
250
|
-
<
|
|
250
|
+
<strong>_cont</strong> # print content text
|
|
251
251
|
end
|
|
252
252
|
}
|
|
253
253
|
}
|
|
@@ -264,10 +264,10 @@ World<% end %>
|
|
|
264
264
|
|
|
265
265
|
<a name="default-content-suppliment"></a>
|
|
266
266
|
<h4 class="section3">Suppliement</h4>
|
|
267
|
-
<p>Directive '
|
|
267
|
+
<p>Directive 'kw:d="default: <em>expr</em>"' is for Default Content Pattern.
|
|
268
268
|
</p>
|
|
269
269
|
<a name="replace5a.pdata"></a>
|
|
270
|
-
<pre class="program">Hello <span <
|
|
270
|
+
<pre class="program">Hello <span <strong>kw:d="default: user"</strong>>World</span>!
|
|
271
271
|
</pre>
|
|
272
272
|
<p>The output is:
|
|
273
273
|
</p>
|
|
@@ -300,13 +300,13 @@ or 'Replace Element with Content Pattern'.
|
|
|
300
300
|
<a name="replace3.pdata"></a>
|
|
301
301
|
<div class="program_caption">
|
|
302
302
|
Presentation Data:</div>
|
|
303
|
-
<pre class="program"><div <
|
|
303
|
+
<pre class="program"><div <strong>id="mark:links"</strong>>
|
|
304
304
|
<a href="/">HOME</a> | <a href="/doc">Document</a> | <a href="/faq">FAQ</a>
|
|
305
305
|
</div>
|
|
306
306
|
|
|
307
307
|
<p>Welcome to my Home Page!</p>
|
|
308
308
|
|
|
309
|
-
<div <
|
|
309
|
+
<div <strong>id="mark:links2"</strong>>
|
|
310
310
|
Home | Document | FAQ
|
|
311
311
|
</div>
|
|
312
312
|
</pre>
|
|
@@ -316,11 +316,11 @@ Presentation Logic:</div>
|
|
|
316
316
|
<pre class="program">/* replace the element 'links2' with the element 'links' */
|
|
317
317
|
#links2 {
|
|
318
318
|
logic: {
|
|
319
|
-
<
|
|
319
|
+
<strong>_element(links)</strong>
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
</pre>
|
|
323
|
-
<p><code>_element(<
|
|
323
|
+
<p><code>_element(<em>name</em>)</code> represents the element which is marked with <code>id="mark:<em>name</em>"</code> or <code>id="<em>name</em>"</code>.
|
|
324
324
|
</p>
|
|
325
325
|
<a name="replace3.expected"></a>
|
|
326
326
|
<div class="output_caption">
|
|
@@ -335,7 +335,7 @@ Output Script:</div>
|
|
|
335
335
|
<a href="/">HOME</a> | <a href="/doc">Document</a> | <a href="/faq">FAQ</a>
|
|
336
336
|
</div>
|
|
337
337
|
</pre>
|
|
338
|
-
<p>Use '_content(<
|
|
338
|
+
<p>Use '_content(<em>name</em>)' instead of '_element(<em>name</em>)'
|
|
339
339
|
if you want to reuse content of other element.
|
|
340
340
|
</p>
|
|
341
341
|
<a name="replace3a.plogic"></a>
|
|
@@ -344,7 +344,7 @@ Presentation Logic:</div>
|
|
|
344
344
|
<pre class="program">/* replace the element 'links2' with the content 'links' */
|
|
345
345
|
#links2 {
|
|
346
346
|
logic: {
|
|
347
|
-
<
|
|
347
|
+
<strong>_content(links)</strong>
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
</pre>
|
|
@@ -352,19 +352,19 @@ Presentation Logic:</div>
|
|
|
352
352
|
|
|
353
353
|
<a name="replace-elem-with-elem-supplement"></a>
|
|
354
354
|
<h4 class="section3">Supplement</h4>
|
|
355
|
-
<p>Directive '<code>id="replace_element_with_element: <
|
|
355
|
+
<p>Directive '<code>id="replace_element_with_element: <em>name</em>"</code>' and '<code>id="replace_element_with_content: <em>name</em>"</code>' lets you to use this pattern without presentation logic file.
|
|
356
356
|
</p>
|
|
357
|
-
<pre class="program"><div <
|
|
357
|
+
<pre class="program"><div <strong>id="mark:links"</strong>>
|
|
358
358
|
<a href="/">HOME</a> | <a href="/doc">Document</a> | <a href="/faq">FAQ</a>
|
|
359
359
|
</div>
|
|
360
360
|
|
|
361
361
|
<p>Welcome to my Home Page!</p>
|
|
362
362
|
|
|
363
|
-
<div <
|
|
363
|
+
<div <strong>id="replace_element_with_element: links"</strong>>
|
|
364
364
|
Home | Document | FAQ
|
|
365
365
|
</div>
|
|
366
366
|
</pre>
|
|
367
|
-
<p>The command-line option '<code>-i <
|
|
367
|
+
<p>The command-line option '<code>-i <em>file</em>,<em>file2</em>,...</code>' enables you
|
|
368
368
|
to use elements described in other files.
|
|
369
369
|
See Kwartz Users' Guide for details.
|
|
370
370
|
</p>
|
|
@@ -406,12 +406,12 @@ Presentation Data(contents.html):</div>
|
|
|
406
406
|
<body>
|
|
407
407
|
|
|
408
408
|
<p>menu:</p>
|
|
409
|
-
<ul <
|
|
410
|
-
<li><a href="..." <
|
|
409
|
+
<ul <strong>id="mark:menu"</strong>>
|
|
410
|
+
<li><a href="..." <strong>id="mark:menu_item"</strong>>menu1</a></li>
|
|
411
411
|
</ul>
|
|
412
412
|
|
|
413
413
|
<p>article:</p>
|
|
414
|
-
<div <
|
|
414
|
+
<div <strong>id="mark:article"</strong>>
|
|
415
415
|
<h2>What is Kwartz?</h2>
|
|
416
416
|
<p>Kwartz is a template system, which realized the concept
|
|
417
417
|
<strong>`Independence of Presentation Logic</strong>.
|
|
@@ -456,7 +456,7 @@ Presentation Data(layout.html):</div>
|
|
|
456
456
|
|
|
457
457
|
<!-- menu part -->
|
|
458
458
|
<td class="menu" width="100" valign="top"
|
|
459
|
-
<
|
|
459
|
+
<strong>id="mark:placeholder_menu"</strong>>
|
|
460
460
|
<ul>
|
|
461
461
|
<li>menu1</li>
|
|
462
462
|
<li>menu2</li>
|
|
@@ -466,7 +466,7 @@ Presentation Data(layout.html):</div>
|
|
|
466
466
|
|
|
467
467
|
<!-- article part -->
|
|
468
468
|
<td class="article" width="400" valign="top"
|
|
469
|
-
<
|
|
469
|
+
<strong>id="mark:placeholder_article"</strong>>
|
|
470
470
|
aaa<br>
|
|
471
471
|
bbb<br>
|
|
472
472
|
ccc<br>
|
|
@@ -493,7 +493,7 @@ Presentation Logic(layout.plogic):</div>
|
|
|
493
493
|
#placeholder_menu {
|
|
494
494
|
logic: {
|
|
495
495
|
_stag
|
|
496
|
-
<
|
|
496
|
+
<strong>_element(menu)</strong>
|
|
497
497
|
_etag
|
|
498
498
|
}
|
|
499
499
|
}
|
|
@@ -502,17 +502,17 @@ Presentation Logic(layout.plogic):</div>
|
|
|
502
502
|
#placeholder_article {
|
|
503
503
|
logic: {
|
|
504
504
|
_stag
|
|
505
|
-
<
|
|
505
|
+
<strong>_content(article)</strong>
|
|
506
506
|
_etag
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
</pre>
|
|
510
|
-
<p>Compilation requires the command-line option <code>-i <
|
|
510
|
+
<p>Compilation requires the command-line option <code>-i <em>file1,file2,...</em></code>
|
|
511
511
|
which enables to import elements defined in other files.
|
|
512
512
|
</p>
|
|
513
513
|
<p>Compile:
|
|
514
514
|
</p>
|
|
515
|
-
<pre class="terminal">$ kwartz -l eruby <
|
|
515
|
+
<pre class="terminal">$ kwartz -l eruby <strong>-i contents.html</strong> -p contens.plogic,layout.plogic layout.html
|
|
516
516
|
</pre>
|
|
517
517
|
<a name="layout.expected"></a>
|
|
518
518
|
<div class="output_caption">
|
|
@@ -563,14 +563,14 @@ Output Script:</div>
|
|
|
563
563
|
|
|
564
564
|
<a name="replace-cont-with-elem-supplement"></a>
|
|
565
565
|
<h4 class="section3">Supplement</h4>
|
|
566
|
-
<p>Kwartz Directive '<code>id="replace_content_with_element:<
|
|
566
|
+
<p>Kwartz Directive '<code>id="replace_content_with_element:<em>name</em>"</code>' and '<code>id="replace_content_with_content:<em>name</em>"</code>' lets you to use this pattern without presentation logic file(layout.plogic).
|
|
567
567
|
</p>
|
|
568
568
|
<div class="program_caption">
|
|
569
569
|
Presentation Data(layout.html):</div>
|
|
570
570
|
<pre class="program"> :
|
|
571
571
|
<!-- menu part -->
|
|
572
572
|
<td class="menu" width="100" valign="top"
|
|
573
|
-
<
|
|
573
|
+
<strong>id="replace_content_with_element:menu"</strong>>
|
|
574
574
|
<ul>
|
|
575
575
|
<li>menu1</li>
|
|
576
576
|
<li>menu2</li>
|
|
@@ -580,7 +580,7 @@ Presentation Data(layout.html):</div>
|
|
|
580
580
|
|
|
581
581
|
<!-- article part -->
|
|
582
582
|
<td class="article" width="400" valign="top">
|
|
583
|
-
<
|
|
583
|
+
<strong>id="replace_content_with_content:article"</strong>>
|
|
584
584
|
aaa<br>
|
|
585
585
|
bbb<br>
|
|
586
586
|
ccc<br>
|
|
@@ -620,7 +620,7 @@ This pattern is named 'Delete Element Pattern' or 'Dummy Element Pattern.'
|
|
|
620
620
|
Presentation Data:</div>
|
|
621
621
|
<pre class="program"><ul>
|
|
622
622
|
<li>foo</li>
|
|
623
|
-
<li <
|
|
623
|
+
<li <strong>id="dummy"</strong>>bar</li>
|
|
624
624
|
</ul>
|
|
625
625
|
</pre>
|
|
626
626
|
<a name="dummy_elem.plogic"></a>
|
|
@@ -643,13 +643,13 @@ Output Script:</div>
|
|
|
643
643
|
|
|
644
644
|
<a name="delete-elem-supplement"></a>
|
|
645
645
|
<h4 class="section3">Supplement</h4>
|
|
646
|
-
<p>Kwartz directive '<code>id="dummy:<
|
|
646
|
+
<p>Kwartz directive '<code>id="dummy:<em>str</em>"</code>' lets you to use this pattern without presentation logic file.
|
|
647
647
|
</p>
|
|
648
648
|
<div class="program_caption">
|
|
649
649
|
Presentation Data:</div>
|
|
650
650
|
<pre class="program"><ul>
|
|
651
651
|
<li>foo</li>
|
|
652
|
-
<li <
|
|
652
|
+
<li <strong>id="dummy:d1"</strong>>bar</li>
|
|
653
653
|
</ul>
|
|
654
654
|
</pre>
|
|
655
655
|
<br>
|
|
@@ -678,7 +678,7 @@ This pattern is named 'Delete Tag Pattern' or 'Dummy Tag Pattern.'
|
|
|
678
678
|
<a name="dummy_tag.pdata"></a>
|
|
679
679
|
<div class="program_caption">
|
|
680
680
|
Presentation Data:</div>
|
|
681
|
-
<pre class="program"><a href="..." <
|
|
681
|
+
<pre class="program"><a href="..." <strong>id="mark:next"</strong>>Next</a>
|
|
682
682
|
</pre>
|
|
683
683
|
<a name="dummy_tag.plogic"></a>
|
|
684
684
|
<div class="program_caption">
|
|
@@ -688,7 +688,7 @@ Presentation Logic:</div>
|
|
|
688
688
|
attrs: "href" url;
|
|
689
689
|
logic: {
|
|
690
690
|
if !url || url.empty?
|
|
691
|
-
<
|
|
691
|
+
<strong>_cont</strong>
|
|
692
692
|
else
|
|
693
693
|
_stag
|
|
694
694
|
_cont
|
|
@@ -737,8 +737,8 @@ This pattern is very useful for all these situations.
|
|
|
737
737
|
<div class="program_caption">
|
|
738
738
|
Presentation Data:</div>
|
|
739
739
|
<pre class="program"><table>
|
|
740
|
-
<tr <
|
|
741
|
-
<td
|
|
740
|
+
<tr <strong>id="mark:list"</strong>>
|
|
741
|
+
<td kw:d="value: item">item</td>
|
|
742
742
|
</tr>
|
|
743
743
|
</table>
|
|
744
744
|
</pre>
|
|
@@ -748,11 +748,11 @@ Presentation Logic:</div>
|
|
|
748
748
|
<pre class="program">/* iterate element */
|
|
749
749
|
#list {
|
|
750
750
|
logic: {
|
|
751
|
-
<
|
|
751
|
+
<strong>for item in list</strong>
|
|
752
752
|
_stag
|
|
753
753
|
_cont
|
|
754
754
|
_etag
|
|
755
|
-
<
|
|
755
|
+
<strong>end</strong>
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
758
|
</pre>
|
|
@@ -771,12 +771,12 @@ Output Script:</div>
|
|
|
771
771
|
|
|
772
772
|
<a name="iterate-elem-supplement"></a>
|
|
773
773
|
<h4 class="section3">Supplement</h4>
|
|
774
|
-
<p>Kwartz directive <code>
|
|
774
|
+
<p>Kwartz directive <code>kw:d="for <em>item</em> in <em>list</em>"</code> lets you to use this pattern without presentation logic file.
|
|
775
775
|
See reference manual for details.
|
|
776
776
|
</p>
|
|
777
777
|
<pre class="program"><table>
|
|
778
|
-
<tr <
|
|
779
|
-
<td
|
|
778
|
+
<tr <strong>kw:d="for item in list"</strong>>
|
|
779
|
+
<td kw:d="value: item">item</td>
|
|
780
780
|
</tr>
|
|
781
781
|
</table>
|
|
782
782
|
</pre>
|
|
@@ -805,9 +805,9 @@ This pattern is named 'Iterate Content' pattern.
|
|
|
805
805
|
<a name="iterate_cont.pdata"></a>
|
|
806
806
|
<div class="program_caption">
|
|
807
807
|
Presentation Data:</div>
|
|
808
|
-
<pre class="program"><dl <
|
|
809
|
-
<dt
|
|
810
|
-
<dd
|
|
808
|
+
<pre class="program"><dl <strong>id="mark:list"</strong>>
|
|
809
|
+
<dt kw:d="value: item.text">text</dt>
|
|
810
|
+
<dd kw:d="value: item.desc">description</dd>
|
|
811
811
|
</dl>
|
|
812
812
|
</pre>
|
|
813
813
|
<a name="iterate_cont.plogic"></a>
|
|
@@ -817,9 +817,9 @@ Presentation Logic:</div>
|
|
|
817
817
|
#list {
|
|
818
818
|
logic: {
|
|
819
819
|
_stag
|
|
820
|
-
<
|
|
820
|
+
<strong>for item in items</strong>
|
|
821
821
|
_cont
|
|
822
|
-
<
|
|
822
|
+
<strong>end</strong>
|
|
823
823
|
_etag
|
|
824
824
|
}
|
|
825
825
|
}
|
|
@@ -838,12 +838,12 @@ Output Script:</div>
|
|
|
838
838
|
|
|
839
839
|
<a name="iterate-cont-supplement"></a>
|
|
840
840
|
<h4 class="section3">Supplement</h4>
|
|
841
|
-
<p>Kwartz directive <code>
|
|
841
|
+
<p>Kwartz directive <code>kw:d="list <em>item</em> in <em>list</em>"</code> lets you to use this pattern without presentation logic file.
|
|
842
842
|
See reference manual for details.
|
|
843
843
|
</p>
|
|
844
|
-
<pre class="program"><dl <
|
|
845
|
-
<dt
|
|
846
|
-
<dd
|
|
844
|
+
<pre class="program"><dl <strong>kw:d="list item in items"</strong>>
|
|
845
|
+
<dt kw:d="value: item.text">text</dt>
|
|
846
|
+
<dd kw:d="value: item.desc">description</dd>
|
|
847
847
|
</dl>
|
|
848
848
|
</pre>
|
|
849
849
|
<br>
|
|
@@ -877,9 +877,9 @@ This pattern is named 'Select Element Pattern' or 'Select Content Pattern'.
|
|
|
877
877
|
<div class="program_caption">
|
|
878
878
|
Presentation Data:</div>
|
|
879
879
|
<pre class="program"><div id="mark:message">
|
|
880
|
-
<span style="color:red" <
|
|
881
|
-
<span style="color:blue" <
|
|
882
|
-
<span style="color:black" <
|
|
880
|
+
<span style="color:red" <strong>id="mark:error"</strong>>ERROR!</span>
|
|
881
|
+
<span style="color:blue" <strong>id="mark:warning"</strong>>Warning:</span>
|
|
882
|
+
<span style="color:black" <strong>id="mark:good"</strong>>No error.</span>
|
|
883
883
|
</div>
|
|
884
884
|
</pre>
|
|
885
885
|
<a name="select_elem.plogic"></a>
|
|
@@ -889,11 +889,11 @@ Presentation Logic:</div>
|
|
|
889
889
|
#message {
|
|
890
890
|
logic: {
|
|
891
891
|
if status == 'error'
|
|
892
|
-
<
|
|
892
|
+
<strong>_element(error)</strong> # ERROR!
|
|
893
893
|
else if (status == 'warning')
|
|
894
|
-
<
|
|
894
|
+
<strong>_element(warning)</strong> # Warning:
|
|
895
895
|
else
|
|
896
|
-
<
|
|
896
|
+
<strong>_element(good)</strong> # No error.
|
|
897
897
|
end
|
|
898
898
|
}
|
|
899
899
|
}
|
|
@@ -913,13 +913,13 @@ Output Script:</div>
|
|
|
913
913
|
|
|
914
914
|
<a name="select-elem-supplement"></a>
|
|
915
915
|
<h4 class="section3">Supplement</h4>
|
|
916
|
-
<p> Kwartz directive '<code>
|
|
917
|
-
and '<code>
|
|
916
|
+
<p> Kwartz directive '<code>kw:d="if <em>condition</em>"</code>', '<code>kw:d="elsif <em>condition</em>"</code>',
|
|
917
|
+
and '<code>kw:d="else"</code>' let you to use this pattern without presentation logic file.
|
|
918
918
|
</p>
|
|
919
919
|
<pre class="program"><div>
|
|
920
|
-
<span style="color:red" <
|
|
921
|
-
<span style="color:blue" <
|
|
922
|
-
<span style="color:black" <
|
|
920
|
+
<span style="color:red" <strong>kw:d="if status=='error'"</strong>>ERROR!</span>
|
|
921
|
+
<span style="color:blue" <strong>kw:d="elsif status=='warning'"</strong>>Warning:</span>
|
|
922
|
+
<span style="color:black" <strong>kw:d="else"</strong>>No error.</span>
|
|
923
923
|
</div>
|
|
924
924
|
</pre>
|
|
925
925
|
<br>
|
|
@@ -954,13 +954,13 @@ In 'Pick-up Element' pattern, necessary elements are marked and leaved so that d
|
|
|
954
954
|
Presentation Data:</div>
|
|
955
955
|
<pre class="program"><html>
|
|
956
956
|
<body>
|
|
957
|
-
<div <
|
|
958
|
-
<a href="/" <
|
|
959
|
-
<span <
|
|
957
|
+
<div <strong>id="breadcrumbs"</strong>>
|
|
958
|
+
<a href="/" <strong>id="mark:crumb"</strong>>Home</a>
|
|
959
|
+
<span <strong>id="mark:separator"</strong>>&gt;</span>
|
|
960
960
|
<a href="/aaa/">AAA</a> &lt;
|
|
961
961
|
<a href="/aaa/bbb/">BBB</a> &lgt;
|
|
962
962
|
<a href="/aaa/bbb/ccc">CCC</a> &lgt;
|
|
963
|
-
<strong <
|
|
963
|
+
<strong <strong>id="mark:title"</strong>>title</strong>
|
|
964
964
|
</div>
|
|
965
965
|
</body>
|
|
966
966
|
</html>
|
|
@@ -971,10 +971,10 @@ Presentation Logic:</div>
|
|
|
971
971
|
<pre class="program">#breadcrumbs {
|
|
972
972
|
logic: {
|
|
973
973
|
for item in list
|
|
974
|
-
<
|
|
975
|
-
<
|
|
974
|
+
<strong>_element(crumb)</strong> # print <a>...</a>
|
|
975
|
+
<strong>_content(separator)</strong> # print '&gt;'
|
|
976
976
|
end
|
|
977
|
-
<
|
|
977
|
+
<strong>_element(title)</strong> # print <strong>title</strong>
|
|
978
978
|
}
|
|
979
979
|
}
|
|
980
980
|
|
|
@@ -1026,16 +1026,16 @@ This pattern is named 'Extract Element Pattern' or 'Extract Content Pattern'.
|
|
|
1026
1026
|
<a name="design.html"></a>
|
|
1027
1027
|
<div class="program_caption">
|
|
1028
1028
|
Presentation Data (<a href="p-pattern/design.html">design.html</a>):</div>
|
|
1029
|
-
<pre class="program"><html <
|
|
1029
|
+
<pre class="program"><html <strong>id="mark:whole"</strong>>
|
|
1030
1030
|
<head>
|
|
1031
1031
|
<title>Design Examples</title>
|
|
1032
1032
|
<link rel="stylesheet" href="design.css" type="text/css">
|
|
1033
1033
|
</head>
|
|
1034
1034
|
<body>
|
|
1035
1035
|
|
|
1036
|
-
<div <
|
|
1036
|
+
<div <strong>id="mark:tablist"</strong>>
|
|
1037
1037
|
<div class="tabs" id="mark:tabs">
|
|
1038
|
-
<a href="/" class="" <
|
|
1038
|
+
<a href="/" class="" <strong>id="mark:tab"</strong>>Home</a>
|
|
1039
1039
|
<a href="/product/" class="selected">Product</a>
|
|
1040
1040
|
<a href="/download/" class="">Download</a>
|
|
1041
1041
|
<a href="/support/" class="">Support</a>
|
|
@@ -1046,11 +1046,11 @@ Presentation Data (<a href="p-pattern/design.html">design.html</a>):</div>
|
|
|
1046
1046
|
|
|
1047
1047
|
<br>
|
|
1048
1048
|
|
|
1049
|
-
<div <
|
|
1049
|
+
<div <strong>id="mark:menulist"</strong>>
|
|
1050
1050
|
<span class="menu_title" id="value:menu_title">MenuList</span>
|
|
1051
|
-
<div class="menus" <
|
|
1052
|
-
<a href="/cgi-bin/email.cgi" class="" <
|
|
1053
|
-
<span <
|
|
1051
|
+
<div class="menus" <strong>id="mark:menus"</strong>>
|
|
1052
|
+
<a href="/cgi-bin/email.cgi" class="" <strong>id="mark:menu"</strong>>E-Mail</a>
|
|
1053
|
+
<span <strong>id="mark:menu_separator"</strong>><br></span>
|
|
1054
1054
|
<a href="/cgi-bin/board.cgi" class="selected">MesgBoard</a><br>
|
|
1055
1055
|
<a href="/cgi-bin/photo.cgi" class="">PhotoAlbum</a><br>
|
|
1056
1056
|
<a href="/cgi-bin/greeting.cgi" class="">GreetingCard</a><br>
|
|
@@ -1062,7 +1062,7 @@ Presentation Data (<a href="p-pattern/design.html">design.html</a>):</div>
|
|
|
1062
1062
|
<p> ..... </p>
|
|
1063
1063
|
<p> ..... </p>
|
|
1064
1064
|
|
|
1065
|
-
<div align="center" class="copyright" <
|
|
1065
|
+
<div align="center" class="copyright" <strong>id="mark:copyright"</strong>>
|
|
1066
1066
|
Copyright&copy; 2004-2005 kuwata-lab. All Rights Reserved.
|
|
1067
1067
|
</div>
|
|
1068
1068
|
|
|
@@ -1073,9 +1073,9 @@ Presentation Data (<a href="p-pattern/design.html">design.html</a>):</div>
|
|
|
1073
1073
|
<div class="program_caption">
|
|
1074
1074
|
Presentation Logic (copyright.plogic):</div>
|
|
1075
1075
|
<pre class="program">/* replace the 'whole' element with the element you want to extract */
|
|
1076
|
-
<
|
|
1076
|
+
<strong>#whole</strong> {
|
|
1077
1077
|
logic: {
|
|
1078
|
-
<
|
|
1078
|
+
<strong>_element(copyright)</strong>
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
1081
1081
|
</pre>
|
|
@@ -1083,9 +1083,9 @@ Presentation Logic (copyright.plogic):</div>
|
|
|
1083
1083
|
<div class="program_caption">
|
|
1084
1084
|
Presentation Logic (tablist.plogic):</div>
|
|
1085
1085
|
<pre class="program">/* replace the 'whole' element with the element you want to extract */
|
|
1086
|
-
<
|
|
1086
|
+
<strong>#whole</strong> {
|
|
1087
1087
|
logic: {
|
|
1088
|
-
<
|
|
1088
|
+
<strong>_element(tablist)</strong>
|
|
1089
1089
|
}
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
@@ -1110,9 +1110,9 @@ Presentation Logic (tablist.plogic):</div>
|
|
|
1110
1110
|
<div class="program_caption">
|
|
1111
1111
|
Presentation Logic (menulist.plogic):</div>
|
|
1112
1112
|
<pre class="program">/* replace the 'whole' element with the element you want to extract */
|
|
1113
|
-
<
|
|
1113
|
+
<strong>#whole</strong> {
|
|
1114
1114
|
logic: {
|
|
1115
|
-
<
|
|
1115
|
+
<strong>_element(menulist)</strong>
|
|
1116
1116
|
}
|
|
1117
1117
|
}
|
|
1118
1118
|
|
|
@@ -1187,9 +1187,9 @@ Output Script (menulist.rhtml):</div>
|
|
|
1187
1187
|
|
|
1188
1188
|
<a name="extract-elem-supplement"></a>
|
|
1189
1189
|
<h4 class="section3">Supplement</h4>
|
|
1190
|
-
<p> The command-line option '<code>-X <
|
|
1190
|
+
<p> The command-line option '<code>-X <em>name</em></code>' extracts the element marked with <code><em>name</em></code> in kwartz-ruby.
|
|
1191
1191
|
</p>
|
|
1192
|
-
<p> The command-line option '<code>-x <
|
|
1192
|
+
<p> The command-line option '<code>-x <em>name</em></code>' extracts the content of the element marked with <code><em>name</em></code> in kwartz-ruby.
|
|
1193
1193
|
</p>
|
|
1194
1194
|
<br>
|
|
1195
1195
|
|