kwartz 3.1.2 → 3.2.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.
Files changed (140) hide show
  1. data/CHANGES +444 -0
  2. data/README.txt +4 -1
  3. data/bin/kwartz +2 -2
  4. data/doc-api/classes/Kwartz.html +16 -7
  5. data/doc-api/classes/Kwartz/Assertion.html +6 -6
  6. data/doc-api/classes/Kwartz/AssertionError.html +6 -6
  7. data/doc-api/classes/Kwartz/AttrInfo.html +71 -61
  8. data/doc-api/classes/Kwartz/BaseError.html +12 -12
  9. data/doc-api/classes/Kwartz/BaseTranslator.html +104 -74
  10. data/doc-api/classes/Kwartz/CharacterType.html +24 -24
  11. data/doc-api/classes/Kwartz/CommandOptionError.html +7 -7
  12. data/doc-api/classes/Kwartz/CommandOptions.html +50 -50
  13. data/doc-api/classes/Kwartz/Config.html +5 -0
  14. data/doc-api/classes/Kwartz/ConvertError.html +12 -12
  15. data/doc-api/classes/Kwartz/Converter.html +31 -33
  16. data/doc-api/classes/Kwartz/CssStyleParser.html +207 -168
  17. data/doc-api/classes/Kwartz/Defun.html +32 -31
  18. data/doc-api/classes/Kwartz/{HandlerArgument.html → Directive.html} +27 -53
  19. data/doc-api/classes/Kwartz/ElementInfo.html +68 -53
  20. data/doc-api/classes/Kwartz/EperlExpressionParser.html +185 -0
  21. data/doc-api/classes/Kwartz/EperlHandler.html +65 -58
  22. data/doc-api/classes/Kwartz/EperlTranslator.html +14 -7
  23. data/doc-api/classes/Kwartz/ErubisTranslator.html +14 -7
  24. data/doc-api/classes/Kwartz/ErubyTranslator.html +14 -7
  25. data/doc-api/classes/Kwartz/ExpandStatement.html +20 -20
  26. data/doc-api/classes/Kwartz/Expander.html +358 -0
  27. data/doc-api/classes/Kwartz/Handler.html +287 -157
  28. data/doc-api/classes/Kwartz/{StatementHelper.html → HandlerHelper.html} +307 -112
  29. data/doc-api/classes/Kwartz/Helper/ActionViewHelper.html +23 -23
  30. data/doc-api/classes/Kwartz/Helper/RailsTemplate.html +96 -96
  31. data/doc-api/classes/Kwartz/JstlExpressionParser.html +181 -0
  32. data/doc-api/classes/Kwartz/JstlHandler.html +134 -126
  33. data/doc-api/classes/Kwartz/JstlTranslator.html +21 -14
  34. data/doc-api/classes/Kwartz/KwartzError.html +6 -6
  35. data/doc-api/classes/Kwartz/Main.html +4 -4
  36. data/doc-api/classes/Kwartz/NativeExpression.html +19 -19
  37. data/doc-api/classes/Kwartz/NativeStatement.html +24 -24
  38. data/doc-api/classes/Kwartz/Node.html +7 -7
  39. data/doc-api/classes/Kwartz/PIErubisTranslator.html +21 -14
  40. data/doc-api/classes/Kwartz/ParseError.html +6 -6
  41. data/doc-api/classes/Kwartz/PerlExpressionParser.html +185 -0
  42. data/doc-api/classes/Kwartz/PerlHandler.html +353 -0
  43. data/doc-api/classes/Kwartz/PerlTranslator.html +226 -0
  44. data/doc-api/classes/Kwartz/PhpExpressionParser.html +185 -0
  45. data/doc-api/classes/Kwartz/PhpHandler.html +63 -56
  46. data/doc-api/classes/Kwartz/PhpTranslator.html +21 -14
  47. data/doc-api/classes/Kwartz/PresentationLogicParser.html +126 -123
  48. data/doc-api/classes/Kwartz/PrintStatement.html +18 -18
  49. data/doc-api/classes/Kwartz/RailsHandler.html +84 -85
  50. data/doc-api/classes/Kwartz/RailsTranslator.html +13 -6
  51. data/doc-api/classes/Kwartz/RubyExpressionParser.html +180 -0
  52. data/doc-api/classes/Kwartz/RubyHandler.html +73 -69
  53. data/doc-api/classes/Kwartz/RubyStyleParser.html +86 -86
  54. data/doc-api/classes/Kwartz/RubyTranslator.html +28 -21
  55. data/doc-api/classes/Kwartz/Ruleset.html +622 -1
  56. data/doc-api/classes/Kwartz/StrutsTranslator.html +14 -14
  57. data/doc-api/classes/Kwartz/TagInfo.html +52 -27
  58. data/doc-api/classes/Kwartz/TextConverter.html +75 -37
  59. data/doc-api/classes/Kwartz/Translator.html +54 -53
  60. data/doc-api/classes/Kwartz/Util.html +25 -25
  61. data/doc-api/created.rid +1 -1
  62. data/doc-api/files/__/README_txt.html +7 -2
  63. data/doc-api/files/kwartz/assert_rb.html +2 -2
  64. data/doc-api/files/kwartz/binding/eperl_rb.html +2 -2
  65. data/doc-api/files/kwartz/binding/erubis_rb.html +2 -2
  66. data/doc-api/files/kwartz/binding/eruby_rb.html +2 -2
  67. data/doc-api/files/kwartz/binding/jstl_rb.html +2 -2
  68. data/doc-api/files/kwartz/binding/perl_rb.html +115 -0
  69. data/doc-api/files/kwartz/binding/php_rb.html +2 -2
  70. data/doc-api/files/kwartz/binding/pierubis_rb.html +2 -2
  71. data/doc-api/files/kwartz/binding/rails_rb.html +2 -2
  72. data/doc-api/files/kwartz/binding/ruby_rb.html +2 -2
  73. data/doc-api/files/kwartz/binding/struts_rb.html +2 -2
  74. data/doc-api/files/kwartz/config_rb.html +2 -2
  75. data/doc-api/files/kwartz/converter_rb.html +2 -2
  76. data/doc-api/files/kwartz/defun_rb.html +2 -2
  77. data/doc-api/files/kwartz/error_rb.html +2 -2
  78. data/doc-api/files/kwartz/helper/rails_rb.html +2 -2
  79. data/doc-api/files/kwartz/main_rb.html +3 -2
  80. data/doc-api/files/kwartz/node_rb.html +2 -2
  81. data/doc-api/files/kwartz/parser_rb.html +2 -2
  82. data/doc-api/files/kwartz/translator_rb.html +2 -2
  83. data/doc-api/files/kwartz/util/assert-text-equal_rb.html +2 -2
  84. data/doc-api/files/kwartz/util/testcase-helper_rb.html +2 -2
  85. data/doc-api/files/kwartz/util_rb.html +2 -2
  86. data/doc-api/files/kwartz_rb.html +2 -2
  87. data/doc-api/fr_class_index.html +10 -5
  88. data/doc-api/fr_file_index.html +1 -0
  89. data/doc-api/fr_method_index.html +268 -239
  90. data/doc/docstyle.css +9 -3
  91. data/doc/img/fig05.png +0 -0
  92. data/doc/introduction-to-kwartz.html +3040 -0
  93. data/doc/pattern-catalog.html +5 -3
  94. data/doc/reference.html +680 -26
  95. data/doc/users-guide.html +222 -67
  96. data/kwartz.gemspec +4 -4
  97. data/lib/kwartz.rb +3 -3
  98. data/lib/kwartz/assert.rb +2 -2
  99. data/lib/kwartz/binding/eperl.rb +71 -31
  100. data/lib/kwartz/binding/erubis.rb +3 -2
  101. data/lib/kwartz/binding/eruby.rb +3 -2
  102. data/lib/kwartz/binding/jstl.rb +66 -29
  103. data/lib/kwartz/binding/perl.rb +230 -0
  104. data/lib/kwartz/binding/php.rb +69 -29
  105. data/lib/kwartz/binding/pierubis.rb +3 -2
  106. data/lib/kwartz/binding/rails.rb +18 -18
  107. data/lib/kwartz/binding/ruby.rb +74 -42
  108. data/lib/kwartz/binding/struts.rb +22 -21
  109. data/lib/kwartz/config.rb +4 -4
  110. data/lib/kwartz/converter.rb +465 -345
  111. data/lib/kwartz/defun.rb +2 -2
  112. data/lib/kwartz/error.rb +2 -2
  113. data/lib/kwartz/helper/rails.rb +2 -2
  114. data/lib/kwartz/main.rb +5 -4
  115. data/lib/kwartz/node.rb +92 -144
  116. data/lib/kwartz/parser.rb +112 -103
  117. data/lib/kwartz/translator.rb +14 -6
  118. data/lib/kwartz/util.rb +2 -2
  119. data/lib/kwartz/util/assert-text-equal.rb +2 -2
  120. data/lib/kwartz/util/testcase-helper.rb +1 -1
  121. data/test/test-compile.rb +2 -2
  122. data/test/test-compile.yaml +81 -0
  123. data/test/test-converter.rb +4 -8
  124. data/test/test-converter.yaml +152 -3
  125. data/test/test-directives.rb +2 -2
  126. data/test/test-directives.yaml +222 -0
  127. data/test/test-main.rb +6 -4
  128. data/test/test-main.yaml +66 -1
  129. data/test/test-parser.rb +12 -3
  130. data/test/test-parser.yaml +64 -51
  131. data/test/test-rails.rb +2 -2
  132. data/test/test-ruleset.rb +2 -2
  133. data/test/test-ruleset.yaml +465 -4
  134. data/test/test.log +6 -0
  135. data/test/test.rb +2 -2
  136. metadata +116 -106
  137. data/ChangeLog +0 -156
  138. data/doc-api/classes/Kwartz/DocumentRuleset.html +0 -369
  139. data/doc-api/classes/Kwartz/ElementExpander.html +0 -325
  140. data/doc-api/classes/Kwartz/ElementRuleset.html +0 -612
@@ -13,9 +13,11 @@
13
13
  <div class="mainbody">
14
14
 
15
15
  <div align="left"><h1>Kwartz-Ruby Users' Guide</h1></div>
16
- <p>$Release: 3.1.2 $<br>
17
- $Date: 2006-09-30 05:02:08 +0900 (Sat, 30 Sep 2006) $
18
- </p>
16
+ <div align="left">
17
+ release: $Release: 3.2.0 $<br>
18
+ last update: $Date$<br>
19
+ </div>
20
+
19
21
  <a name="preface"></a>
20
22
  <h2 class="section1">Preface</h2>
21
23
  <p>This is the users' guide of Kwartz-ruby.
@@ -44,7 +46,7 @@ Kwartz-ruby is an implementation of Kwartz in Ruby.
44
46
  </li>
45
47
  <li><a href="#features">Features Overview</a>
46
48
  </li>
47
- <li><a href="#example1">Simple Example</a>
49
+ <li><a href="#example1">Quick Example</a>
48
50
  </li>
49
51
  <li><a href="#example2">Complex Example</a>
50
52
  </li>
@@ -54,12 +56,18 @@ Kwartz-ruby is an implementation of Kwartz in Ruby.
54
56
  </li>
55
57
  <li><a href="#detail">Features Detail</a>
56
58
  <ul>
59
+ <li><a href="#selector">Selector</a>
60
+ </li>
57
61
  <li><a href="#ruleset">RuleSet and Properties</a>
58
62
  </li>
59
63
  <li><a href="#directives">Directives</a>
60
64
  </li>
61
65
  <li><a href="#embed_expr">Embed Expression in Presentation Data</a>
62
66
  </li>
67
+ <li><a href="#lang-independent-expr">Language-Independent Expression</a>
68
+ </li>
69
+ <li><a href="#attr-variable">Attribute Variable</a>
70
+ </li>
63
71
  <li><a href="#escape">Escape</a>
64
72
  </li>
65
73
  <li><a href="#langs">Multi-language</a>
@@ -141,13 +149,10 @@ If you are familiar with CSS, you'll be also familiar with Kwartz.
141
149
  </li>
142
150
  </ul>
143
151
  <div style="text-align: center">
144
- <span>Figure1. Relation of HTML, CSS, JavaScript, and Kwartz.</span><br />
152
+ <span>Figure1. Components in Presentation Layer.</span><br />
145
153
  <img src="img/fig04.png" alt="relation of HTML, CSS, JavaScript, and Kwartz" />
146
154
  </div>
147
- <p>Kwartz-ruby is an implemenation of Kwartz in Ruby.
148
- </p>
149
- <p>In the following, the word 'Kwartz' means the specification of the template system
150
- and the word 'Kwartz-ruby' means the implementation of it in Ruby language.
155
+ <p>If you are interested in concept of Kwartz, see <a href="">this presentation</a>.
151
156
  </p>
152
157
  <div class="footnote">
153
158
  <dl compact>
@@ -229,58 +234,31 @@ Auto-escape and Partial-escape</dt>
229
234
 
230
235
 
231
236
  <a name="example1"></a>
232
- <h3 class="section2">Simple Example</h3>
233
- <p>In Kwartz, a template is defined as both presentation data and presentation logic.
234
- They may be described in separate files.
235
- </p>
236
- <p>This is an example of a presentation data file.
237
- </p>
238
- <ul type="disc">
239
- <li>'<strong><code>id="list1"</code></strong>' means "I'll operate this element in presentation logic" (called 'marking' in Kwartz).
240
- </li>
241
- <li>'<strong><code>id="mark:item1"</code></strong>' is also an marking.
242
- Difference between <code>id="mark:item1"</code> and <code>id="item1"</code> is that id attribute in the former format is removed automatically and the latter format is leaved.
243
- </li>
244
- </ul>
245
- <p>Presentation data file(example1.html):
237
+ <h3 class="section2">Quick Example</h3>
238
+ <p>Here is an example of presentation data file (= HTML template).
246
239
  </p>
247
- <a name="example1.html"></a>
240
+ <div class="program_caption">
241
+ example1.html</div>
248
242
  <pre class="program">&lt;table&gt;
249
- &lt;tr <strong>id="list1"</strong>&gt;
243
+ &lt;tr <strong>id="mark:list1"</strong>&gt;
250
244
  &lt;td <strong>id="mark:item1"</strong>&gt;foo&lt;/td&gt;
251
245
  &lt;/tr&gt;
252
246
  &lt;/table&gt;
253
247
  </pre>
254
- <p>And the following is an example of presentation logic.
255
- In presentation logic, you can operate on elements which are marked in presentation data.
248
+ <p>Points:
256
249
  </p>
257
250
  <ul type="disc">
258
- <li>'<strong><code>#list1 { ... }</code></strong>' represents an element marked with name 'list1' (= '&lt;tr&gt;...&lt;/tr&gt;')
259
- <ul type="circle">
260
- <li>'<strong><code>logic: { ... }</code></strong>' represents presentation logic of the element.
261
- </li>
262
- <li>'<strong><code>_stag</code></strong>' represents a start tag (= '&lt;tr&gt;').
263
- </li>
264
- <li>'<strong><code>_cont</code></strong>' represents content(= '&lt;td id="mark:item1"&gt;foo&lt;/td&gt;').
265
- </li>
266
- <li>'<strong><code>_etag</code></strong>' represents an end tag(= '&lt;/tr&gt;').
267
- </li>
268
- <li>'<strong><code>for <em>var</em> in <em>list</em> ...</code></strong>' is a Ruby code to loop.
269
- In this case, the element(= start-tag + content + end-tag) is looped.
270
- </li>
271
- </ul>
251
+ <li>Mark elements by <code>id="mark:xxx"</code> or <code>id="xxx"</code>. The former will be remove at compile stage but the latter will be remained.
272
252
  </li>
273
- <li>'<strong><code>#item1 { ... }</code></strong>' represents an element marked with name 'item1' (= '&lt;td&gt;...&lt;/td&gt;').
274
- <ul type="circle">
275
- <li>'<strong><code>value: <em>expression</em>;</code></strong>' represents that the content of the element is replaced by value of <code><em>expression</em></code>, which is value of a variable <code>member</code> in this case.
276
- </li>
277
- </ul>
253
+ <li>No presentation logics in HTML file.
278
254
  </li>
279
255
  </ul>
256
+ <p>Here is an example of presentation logic file.
257
+ </p>
280
258
  <a name="example1.plogic"></a>
281
259
  <div class="program_caption">
282
- Presentation logic file(example1.plogic):</div>
283
- <pre class="program">/* The element which is marked by 'id="list1"' */
260
+ example1.plogic</div>
261
+ <pre class="program">/* The element which is marked by 'id="mark:list1"' */
284
262
  <strong>#list1</strong> {
285
263
  logic: {
286
264
  for member in @members
@@ -297,28 +275,41 @@ Presentation logic file(example1.plogic):</div>
297
275
  value: member;
298
276
  }
299
277
  </pre>
300
- <p>(Don't forget the semicolon at the end of line!)
278
+ <p>Points:
301
279
  </p>
302
- <p>Kwartz generates eRuby script from the above files. This action is called 'compiling'.
280
+ <ul type="disc">
281
+ <li>Presentation logic is separated from HTML file.
282
+ </li>
283
+ <li>Format is very similar to CSS with which you are familiar.
284
+ </li>
285
+ <li>Don't forget the semicolon at the end of line!
286
+ </li>
287
+ </ul>
288
+ <p>You must compile presentation data and logic files.
303
289
  </p>
304
290
  <div class="terminal_caption">
305
- how to compile</div>
306
- <pre class="terminal">$ kwartz -p example1.plogic example1.html &gt; example1.rhtml
291
+ Compile</div>
292
+ <pre class="terminal">$ kwartz -l ruby -p example1.plogic example1.html &gt; example1.rhtml
307
293
  </pre>
308
- <p>The following is the compiled output script.
309
- Notice that <code>id="mark:item1"</code> is removed automatically while <code>id="list1"</code> is leaved.
310
- </p>
311
294
  <a name="example1.expected"></a>
312
295
  <div class="program_caption">
313
- generated output script</div>
296
+ Generated script (example1.rhtml)</div>
314
297
  <pre class="program">&lt;table&gt;
315
- &lt;% for member in @members %&gt;
316
- &lt;tr id="list1"&gt;
317
- &lt;td&gt;&lt;%= member %&gt;&lt;/td&gt;
298
+ <strong>&lt;% for member in @members %&gt;</strong>
299
+ &lt;tr&gt;
300
+ &lt;td&gt;<strong>&lt;%= member %&gt;</strong>&lt;/td&gt;
318
301
  &lt;/tr&gt;
319
- &lt;% end %&gt;
302
+ <strong>&lt;% end %&gt;</strong>
320
303
  &lt;/table&gt;
321
304
  </pre>
305
+ <p>Points:
306
+ </p>
307
+ <ul type="disc">
308
+ <li>Kwartz compile presentation data and logic files into eRuby, PHP, JSP, Velocity, ....
309
+ </li>
310
+ <li>This is why Kwartz is so fast and can support multiple programming languages.
311
+ </li>
312
+ </ul>
322
313
  <br>
323
314
 
324
315
 
@@ -491,7 +482,7 @@ See <a href="p-pattern.html">Presentation Pattern Catalog</a> for details.
491
482
  </li>
492
483
  </ul>
493
484
  <ul type="disc">
494
- <li>Delete elemnt. This is useful for delete dummy data.
485
+ <li>Delete element. This is useful for delete dummy data.
495
486
  <pre class="program">#list {
496
487
  logic: {
497
488
  }
@@ -551,6 +542,33 @@ This way, you don't need to change presentation logic files even if the tag/attr
551
542
 
552
543
  <a name="detail"></a>
553
544
  <h2 class="section1">Features Detail</h2>
545
+ <a name="selector"></a>
546
+ <h3 class="section2">Selector</h3>
547
+ <p>(Experimental) Kwartz now supports class selector, tag selector, and multi selector.
548
+ </p>
549
+ <pre class="program">/* tag selector */
550
+ <strong>h1</strong> {
551
+ Value: title;
552
+ }
553
+ /* class selector */
554
+ <strong>.list</strong> {
555
+ attrs: 'bgcolor' color;
556
+ }
557
+ /* multi selector */
558
+ #foo<strong>,</strong> #bar<strong>,</strong> .baz {
559
+ value: item;
560
+ }
561
+ </pre>
562
+ <p>Compound selector is NOT supported.
563
+ </p>
564
+ <pre class="program">/* compound selector is not supported */
565
+ <strong>#foo .baz</strong> { // PARSE ERROR
566
+ value: item;
567
+ }
568
+ </pre>
569
+ <br>
570
+
571
+
554
572
  <a name="ruleset"></a>
555
573
  <h3 class="section2">RuleSet and Properties</h3>
556
574
  <p>Format of presentation logic in Kwartz is similar to CSS (Cascading Style Sheet).
@@ -584,14 +602,14 @@ etag: <em>expr</em>; </b></dt>
584
602
  <dt class="dt3"><b>
585
603
  elem: <em>expr</em>; </b></dt>
586
604
  <dd class="dd3">
587
- Replace elemnt by expression value.
605
+ Replace element by expression value.
588
606
  </dd>
589
607
  </dl>
590
608
  <dl class="dl3">
591
609
  <dt class="dt3"><b>
592
610
  cont: <em>expr</em>; </b></dt>
593
611
  <dd class="dd3">
594
- Replace content of element by expressin value.
612
+ Replace content of element by expression value.
595
613
  </dd>
596
614
  </dl>
597
615
  <dl class="dl3">
@@ -645,6 +663,20 @@ logic: { ... } </b></dt>
645
663
  Logic of the element.
646
664
  </dd>
647
665
  </dl>
666
+ <dl class="dl3">
667
+ <dt class="dt3"><b>
668
+ before: { ... } </b></dt>
669
+ <dd class="dd3">
670
+ Logics executed before 'logic:' part.
671
+ </dd>
672
+ </dl>
673
+ <dl class="dl3">
674
+ <dt class="dt3"><b>
675
+ after: { ... } </b></dt>
676
+ <dd class="dd3">
677
+ Logics executed after 'logic:' part.
678
+ </dd>
679
+ </dl>
648
680
  <p>'stag:' and 'elem:' are useful especially for Ruby on Rails.
649
681
  The following is an examle to use Kwartz in Ruby on Rails.
650
682
  </p>
@@ -814,7 +846,7 @@ presentation data (embed1_ruby.html)</div>
814
846
  <a name="embed1_ruby.expected"></a>
815
847
  <div class="terminal_caption">
816
848
  compile</div>
817
- <pre class="terminal">$ kwartz -l eruby embed1_ruby.html
849
+ <pre class="terminal">$ kwartz -l ruby embed1_ruby.html
818
850
  _buf = ""; _buf &lt;&lt; "&lt;p class=\"<strong>#{klass}</strong>\"&gt;Hello <strong>#{ERB::Util.h user}</strong>&lt;/p&gt;
819
851
  &lt;p class=\""; _buf &lt;&lt; <strong>(klass).to_s</strong>; _buf &lt;&lt; "\"&gt;Hello "; _buf &lt;&lt; <strong>ERB::Util.h(user)</strong>; _buf &lt;&lt; "&lt;/p&gt;\n";
820
852
  ; _buf
@@ -835,6 +867,121 @@ compile</div>
835
867
  <br>
836
868
 
837
869
 
870
+ <a name="lang-independent-expr"></a>
871
+ <h3 class="section2">Language-Independent Expression</h3>
872
+ <p>Basically, embedded expression should be target language. For example if you are Rails developer then you should embed Ruby expression into html file, or if you are PHP programmer you must embed PHP expression. This will prevent you to share html template files (or reuse) between different projects (such as Rails project and PHP project).
873
+ </p>
874
+ <p>Now Kwartz supports language-independent expression. If expression matches the following pattern then it is recognized as language-independent expression, else as language-depend expression.
875
+ </p>
876
+ <ul type="disc">
877
+ <li><code>variable</code>
878
+ </li>
879
+ <li><code>object.property</code>
880
+ </li>
881
+ <li><code>hash['key']</code>, <code>hash["key"]</code>, <code>hash[:key]</code>
882
+ </li>
883
+ <li><code>array[123]</code>, <code>array[index]</code>
884
+ </li>
885
+ </ul>
886
+ <p>Language-independet expression is converted into target language automatically. For example, <code>user.name</code> will be converted into <code>$user-&gt;name</code> in PHP.
887
+ </p>
888
+ <div class="program_caption">
889
+ Example (expr.html)</div>
890
+ <pre class="program">&lt;p id="value:user"&gt;foo&lt;/p&gt;
891
+ &lt;p id="value:user.name"&gt;foo&lt;/p&gt;
892
+ &lt;p id="value:user['name']"&gt;foo&lt;/p&gt;
893
+ &lt;p id="value:user[:name]"&gt;foo&lt;/p&gt;
894
+ &lt;p id="value:user[0]"&gt;foo&lt;/p&gt;
895
+ &lt;p id="value:user[i]"&gt;foo&lt;/p&gt;
896
+ &lt;div&gt;
897
+ @!{user}@
898
+ @!{user.name}@
899
+ @!{user['name']}@
900
+ @!{user[:name]}@
901
+ @!{user[0]}@
902
+ @!{user[i]}@
903
+ @!{$user-&gt;name}@
904
+ &lt;/div&gt;
905
+ </pre>
906
+ <div class="terminal_caption">
907
+ Compile:</div>
908
+ <pre class="terminal">$ kwarz -l eruby expr.html
909
+ &lt;p&gt;&lt;%= <strong>user</strong> %&gt;&lt;/p&gt;
910
+ &lt;p&gt;&lt;%= <strong>user.name</strong> %&gt;&lt;/p&gt;
911
+ &lt;p&gt;&lt;%= <strong>user['name']</strong> %&gt;&lt;/p&gt;
912
+ &lt;p&gt;&lt;%= <strong>user[:name]</strong> %&gt;&lt;/p&gt;
913
+ &lt;p&gt;&lt;%= <strong>user[0]</strong> %&gt;&lt;/p&gt;
914
+ &lt;p&gt;&lt;%= <strong>user[i]</strong> %&gt;&lt;/p&gt;
915
+ &lt;div&gt;
916
+ &lt;%= <strong>user</strong> %&gt;
917
+ &lt;%= <strong>user.name</strong> %&gt;
918
+ &lt;%= <strong>user['name']</strong> %&gt;
919
+ &lt;%= <strong>user[:name]</strong> %&gt;
920
+ &lt;%= <strong>user[0]</strong> %&gt;
921
+ &lt;%= <strong>user[i]</strong> %&gt;
922
+ &lt;%= <strong>$user-&gt;name</strong> %&gt;
923
+ &lt;/div&gt;
924
+ $ kwartz -l php expr.html
925
+ &lt;p&gt;&lt;?php echo <strong>$user</strong>; ?&gt;&lt;/p&gt;
926
+ &lt;p&gt;&lt;?php echo <strong>$user-&gt;name</strong>; ?&gt;&lt;/p&gt;
927
+ &lt;p&gt;&lt;?php echo <strong>$user['name']</strong>; ?&gt;&lt;/p&gt;
928
+ &lt;p&gt;&lt;?php echo <strong>$user['name']</strong>; ?&gt;&lt;/p&gt;
929
+ &lt;p&gt;&lt;?php echo <strong>$user[0]</strong>; ?&gt;&lt;/p&gt;
930
+ &lt;p&gt;&lt;?php echo <strong>$user[$i]</strong>; ?&gt;&lt;/p&gt;
931
+ &lt;div&gt;
932
+ &lt;?php echo <strong>$user</strong>; ?&gt;
933
+ &lt;?php echo <strong>$user-&gt;name</strong>; ?&gt;
934
+ &lt;?php echo <strong>$user['name']</strong>; ?&gt;
935
+ &lt;?php echo <strong>$user['name']</strong>; ?&gt;
936
+ &lt;?php echo <strong>$user[0]</strong>; ?&gt;
937
+ &lt;?php echo <strong>$user[$i]</strong>; ?&gt;
938
+ &lt;?php echo <strong>$user-&gt;name</strong>; ?&gt;
939
+ &lt;/div&gt;
940
+ </pre>
941
+ <p> This feature is limited for basic expression but will help you to share or reuse html templates between projects.
942
+ </p>
943
+ <br>
944
+
945
+
946
+ <a name="attr-variable"></a>
947
+ <h3 class="section2">Attribute Variable</h3>
948
+ <p>Attribute variable represents attribute value of element.
949
+ </p>
950
+ <div class="program_caption">
951
+ presentation data (form.html)</div>
952
+ <pre class="program">&lt;form <strong>action="create"</strong>&gt;
953
+ Username: &lt;input type="text" id="comment_username" <strong>size="20"</strong>&gt;&lt;br&gt;
954
+ Comment: &lt;textarea id="comment_body" <strong>cols="40"</strong> <strong>rows="3"</strong>&gt;&lt;/textarea&gt;&lt;br&gt;
955
+ &lt;input type="submit" id="mark:comment_submit" <strong>value="Send comment"</strong>&gt;
956
+ &lt;/form&gt;
957
+ </pre>
958
+ <div class="program_caption">
959
+ form.plogic</div>
960
+ <pre class="program">form {
961
+ stag: start_form_tag :action=&gt;'<strong>$(action)</strong>';
962
+ }
963
+ #comment_username {
964
+ elem: text_field 'comment', 'username', :size=&gt;<strong>$(size)</strong>;
965
+ }
966
+ #comment_body {
967
+ elem: text_area 'comment', 'body', :rows=&gt;<strong>$(rows)</strong>, :cols=&gt;<strong>$(cols)</strong>;
968
+ }
969
+ #comment_submit {
970
+ elem: submit_tag '<strong>$(value)</strong>';
971
+ }
972
+ </pre>
973
+ <div class="terminal_caption">
974
+ compile</div>
975
+ <pre class="terminal">$ kwartz -p form.plogic form.html
976
+ &lt;%= start_form_tag :action=&gt;'<strong>create</strong>' %&gt;
977
+ Username: &lt;%= text_field 'comment', 'username', :size=&gt;<strong>20</strong> %&gt;&lt;br&gt;
978
+ Comment: &lt;%= text_area 'comment', 'body', :rows=&gt;<strong>3</strong>, :cols=&gt;<strong>40</strong> %&gt;&lt;br&gt;
979
+ &lt;%= submit_tag '<strong>Send comment</strong>' %&gt;
980
+ &lt;/form&gt;
981
+ </pre>
982
+ <br>
983
+
984
+
838
985
  <a name="escape"></a>
839
986
  <h3 class="section2">Escape</h3>
840
987
  <p>Kwartz supports Automatic-escape and Partial-escape/unescape.
@@ -1490,7 +1637,7 @@ print statement because they can escape or unescape exression value.
1490
1637
  <a name="begin"></a>
1491
1638
  <h3 class="section2">Add Code at Beginning/End of Document</h3>
1492
1639
  <p>'#DOCUMENT' is a special selector which represents the document.
1493
- In '#DOCUMENT', properties 'begin:' and 'end:' are available to add codes at beginning/end of document.
1640
+ You can use 'before:' and 'after:' to add codes at beginning/end of document<sup>(<a href="#fnref:6" name="fnlink:6">*6</a>)</sup>.
1494
1641
  </p>
1495
1642
  <a name="document-test.html"></a>
1496
1643
  <div class="program_caption">
@@ -1503,11 +1650,11 @@ document-test.html</div>
1503
1650
  <div class="program_caption">
1504
1651
  document-test.plogic</div>
1505
1652
  <pre class="program"><strong>#DOCUMENT</strong> {
1506
- <strong>begin:</strong> {
1653
+ <strong>before:</strong> {
1507
1654
  title = cgi['title']
1508
1655
  user = cgi['user']
1509
1656
  }
1510
- <strong>end:</strong> {
1657
+ <strong>after:</strong> {
1511
1658
  print "&lt;!--end--&gt;\n"
1512
1659
  }
1513
1660
  }
@@ -1523,6 +1670,12 @@ compile</div>
1523
1670
  &lt;/html&gt;
1524
1671
  <strong>&lt;%= "&lt;!--end--&gt;\n" %&gt;</strong>
1525
1672
  </pre>
1673
+ <div class="footnote">
1674
+ <dl compact>
1675
+ <dt>(<a name="fnref:6" href="#fnlink:6">*6</a>)</dt>
1676
+ <dd>'begin:' and 'end:' are also available but obolete. Please use 'before:' and 'after:' instead.</dd>
1677
+ </dl>
1678
+ </div>
1526
1679
  <br>
1527
1680
 
1528
1681
 
@@ -1632,6 +1785,8 @@ _erbout
1632
1785
  <p>This section shows how to use Kwartz with Ruby on Rails.
1633
1786
  See 'examples/rails1' and 'examples/rails2' for examples.
1634
1787
  </p>
1788
+ <p><span style="color:#FF0000">NOTICE: THIS IS OBSOLETE INFORMATION.</span>
1789
+ </p>
1635
1790
  <a name="rails_template"></a>
1636
1791
  <h3 class="section2">Support of Ruby on Rails</h3>
1637
1792
  <p>If you want to use Kwartz with Ruby on Rails, add the following code in your 'app/controllers/application.rb' and restart web server.
@@ -3,8 +3,8 @@
3
3
  ###
4
4
  ### RubyGems Specification file for Kwartz-ruby
5
5
  ###
6
- ### $Rev: 142 $
7
- ### $Release: 3.1.2 $
6
+ ### $Rev$
7
+ ### $Release: 3.2.0 $
8
8
  ### copyright(c) 2004-2006 kuwata-lab.com all rights reserved
9
9
  ###
10
10
 
@@ -14,7 +14,7 @@ spec = Gem::Specification.new do |s|
14
14
  ## package information
15
15
  s.name = 'kwartz'
16
16
  s.author = 'Makoto Kuwata'
17
- s.version = ("$Release: 3.1.2 $" =~ /[\.\d]+/) && $&
17
+ s.version = ("$Release: 3.2.0 $" =~ /[\.\d]+/) && $&
18
18
  s.platform = Gem::Platform::RUBY
19
19
  s.homepage = 'http://www.kuwata-lab.com/kwartz'
20
20
  s.summary = "a template system for Ruby, PHP, and Java"
@@ -45,7 +45,7 @@ spec = Gem::Specification.new do |s|
45
45
  # #"doc/design.css", "doc/design.html",
46
46
  # ]
47
47
  files += Dir.glob('doc-api/**/*')
48
- files += %w[README.txt ChangeLog LGPL setup.rb kwartz.gemspec]
48
+ files += %w[README.txt CHANGES LGPL setup.rb kwartz.gemspec]
49
49
  s.files = files
50
50
  s.executables = ["kwartz"]
51
51
  s.bindir = "bin"