kwartz 3.1.2 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +444 -0
- data/README.txt +4 -1
- data/bin/kwartz +2 -2
- data/doc-api/classes/Kwartz.html +16 -7
- data/doc-api/classes/Kwartz/Assertion.html +6 -6
- data/doc-api/classes/Kwartz/AssertionError.html +6 -6
- data/doc-api/classes/Kwartz/AttrInfo.html +71 -61
- data/doc-api/classes/Kwartz/BaseError.html +12 -12
- data/doc-api/classes/Kwartz/BaseTranslator.html +104 -74
- data/doc-api/classes/Kwartz/CharacterType.html +24 -24
- data/doc-api/classes/Kwartz/CommandOptionError.html +7 -7
- data/doc-api/classes/Kwartz/CommandOptions.html +50 -50
- data/doc-api/classes/Kwartz/Config.html +5 -0
- data/doc-api/classes/Kwartz/ConvertError.html +12 -12
- data/doc-api/classes/Kwartz/Converter.html +31 -33
- data/doc-api/classes/Kwartz/CssStyleParser.html +207 -168
- data/doc-api/classes/Kwartz/Defun.html +32 -31
- data/doc-api/classes/Kwartz/{HandlerArgument.html → Directive.html} +27 -53
- data/doc-api/classes/Kwartz/ElementInfo.html +68 -53
- data/doc-api/classes/Kwartz/EperlExpressionParser.html +185 -0
- data/doc-api/classes/Kwartz/EperlHandler.html +65 -58
- data/doc-api/classes/Kwartz/EperlTranslator.html +14 -7
- data/doc-api/classes/Kwartz/ErubisTranslator.html +14 -7
- data/doc-api/classes/Kwartz/ErubyTranslator.html +14 -7
- data/doc-api/classes/Kwartz/ExpandStatement.html +20 -20
- data/doc-api/classes/Kwartz/Expander.html +358 -0
- data/doc-api/classes/Kwartz/Handler.html +287 -157
- data/doc-api/classes/Kwartz/{StatementHelper.html → HandlerHelper.html} +307 -112
- data/doc-api/classes/Kwartz/Helper/ActionViewHelper.html +23 -23
- data/doc-api/classes/Kwartz/Helper/RailsTemplate.html +96 -96
- data/doc-api/classes/Kwartz/JstlExpressionParser.html +181 -0
- data/doc-api/classes/Kwartz/JstlHandler.html +134 -126
- data/doc-api/classes/Kwartz/JstlTranslator.html +21 -14
- data/doc-api/classes/Kwartz/KwartzError.html +6 -6
- data/doc-api/classes/Kwartz/Main.html +4 -4
- data/doc-api/classes/Kwartz/NativeExpression.html +19 -19
- data/doc-api/classes/Kwartz/NativeStatement.html +24 -24
- data/doc-api/classes/Kwartz/Node.html +7 -7
- data/doc-api/classes/Kwartz/PIErubisTranslator.html +21 -14
- data/doc-api/classes/Kwartz/ParseError.html +6 -6
- data/doc-api/classes/Kwartz/PerlExpressionParser.html +185 -0
- data/doc-api/classes/Kwartz/PerlHandler.html +353 -0
- data/doc-api/classes/Kwartz/PerlTranslator.html +226 -0
- data/doc-api/classes/Kwartz/PhpExpressionParser.html +185 -0
- data/doc-api/classes/Kwartz/PhpHandler.html +63 -56
- data/doc-api/classes/Kwartz/PhpTranslator.html +21 -14
- data/doc-api/classes/Kwartz/PresentationLogicParser.html +126 -123
- data/doc-api/classes/Kwartz/PrintStatement.html +18 -18
- data/doc-api/classes/Kwartz/RailsHandler.html +84 -85
- data/doc-api/classes/Kwartz/RailsTranslator.html +13 -6
- data/doc-api/classes/Kwartz/RubyExpressionParser.html +180 -0
- data/doc-api/classes/Kwartz/RubyHandler.html +73 -69
- data/doc-api/classes/Kwartz/RubyStyleParser.html +86 -86
- data/doc-api/classes/Kwartz/RubyTranslator.html +28 -21
- data/doc-api/classes/Kwartz/Ruleset.html +622 -1
- data/doc-api/classes/Kwartz/StrutsTranslator.html +14 -14
- data/doc-api/classes/Kwartz/TagInfo.html +52 -27
- data/doc-api/classes/Kwartz/TextConverter.html +75 -37
- data/doc-api/classes/Kwartz/Translator.html +54 -53
- data/doc-api/classes/Kwartz/Util.html +25 -25
- data/doc-api/created.rid +1 -1
- data/doc-api/files/__/README_txt.html +7 -2
- data/doc-api/files/kwartz/assert_rb.html +2 -2
- data/doc-api/files/kwartz/binding/eperl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/erubis_rb.html +2 -2
- data/doc-api/files/kwartz/binding/eruby_rb.html +2 -2
- data/doc-api/files/kwartz/binding/jstl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/perl_rb.html +115 -0
- data/doc-api/files/kwartz/binding/php_rb.html +2 -2
- data/doc-api/files/kwartz/binding/pierubis_rb.html +2 -2
- data/doc-api/files/kwartz/binding/rails_rb.html +2 -2
- data/doc-api/files/kwartz/binding/ruby_rb.html +2 -2
- data/doc-api/files/kwartz/binding/struts_rb.html +2 -2
- data/doc-api/files/kwartz/config_rb.html +2 -2
- data/doc-api/files/kwartz/converter_rb.html +2 -2
- data/doc-api/files/kwartz/defun_rb.html +2 -2
- data/doc-api/files/kwartz/error_rb.html +2 -2
- data/doc-api/files/kwartz/helper/rails_rb.html +2 -2
- data/doc-api/files/kwartz/main_rb.html +3 -2
- data/doc-api/files/kwartz/node_rb.html +2 -2
- data/doc-api/files/kwartz/parser_rb.html +2 -2
- data/doc-api/files/kwartz/translator_rb.html +2 -2
- data/doc-api/files/kwartz/util/assert-text-equal_rb.html +2 -2
- data/doc-api/files/kwartz/util/testcase-helper_rb.html +2 -2
- data/doc-api/files/kwartz/util_rb.html +2 -2
- data/doc-api/files/kwartz_rb.html +2 -2
- data/doc-api/fr_class_index.html +10 -5
- data/doc-api/fr_file_index.html +1 -0
- data/doc-api/fr_method_index.html +268 -239
- data/doc/docstyle.css +9 -3
- data/doc/img/fig05.png +0 -0
- data/doc/introduction-to-kwartz.html +3040 -0
- data/doc/pattern-catalog.html +5 -3
- data/doc/reference.html +680 -26
- data/doc/users-guide.html +222 -67
- data/kwartz.gemspec +4 -4
- data/lib/kwartz.rb +3 -3
- data/lib/kwartz/assert.rb +2 -2
- data/lib/kwartz/binding/eperl.rb +71 -31
- data/lib/kwartz/binding/erubis.rb +3 -2
- data/lib/kwartz/binding/eruby.rb +3 -2
- data/lib/kwartz/binding/jstl.rb +66 -29
- data/lib/kwartz/binding/perl.rb +230 -0
- data/lib/kwartz/binding/php.rb +69 -29
- data/lib/kwartz/binding/pierubis.rb +3 -2
- data/lib/kwartz/binding/rails.rb +18 -18
- data/lib/kwartz/binding/ruby.rb +74 -42
- data/lib/kwartz/binding/struts.rb +22 -21
- data/lib/kwartz/config.rb +4 -4
- data/lib/kwartz/converter.rb +465 -345
- data/lib/kwartz/defun.rb +2 -2
- data/lib/kwartz/error.rb +2 -2
- data/lib/kwartz/helper/rails.rb +2 -2
- data/lib/kwartz/main.rb +5 -4
- data/lib/kwartz/node.rb +92 -144
- data/lib/kwartz/parser.rb +112 -103
- data/lib/kwartz/translator.rb +14 -6
- data/lib/kwartz/util.rb +2 -2
- data/lib/kwartz/util/assert-text-equal.rb +2 -2
- data/lib/kwartz/util/testcase-helper.rb +1 -1
- data/test/test-compile.rb +2 -2
- data/test/test-compile.yaml +81 -0
- data/test/test-converter.rb +4 -8
- data/test/test-converter.yaml +152 -3
- data/test/test-directives.rb +2 -2
- data/test/test-directives.yaml +222 -0
- data/test/test-main.rb +6 -4
- data/test/test-main.yaml +66 -1
- data/test/test-parser.rb +12 -3
- data/test/test-parser.yaml +64 -51
- data/test/test-rails.rb +2 -2
- data/test/test-ruleset.rb +2 -2
- data/test/test-ruleset.yaml +465 -4
- data/test/test.log +6 -0
- data/test/test.rb +2 -2
- metadata +116 -106
- data/ChangeLog +0 -156
- data/doc-api/classes/Kwartz/DocumentRuleset.html +0 -369
- data/doc-api/classes/Kwartz/ElementExpander.html +0 -325
- data/doc-api/classes/Kwartz/ElementRuleset.html +0 -612
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
7
|
<head>
|
8
|
-
<title>Module: Kwartz::
|
8
|
+
<title>Module: Kwartz::HandlerHelper</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
11
|
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
@@ -50,7 +50,7 @@
|
|
50
50
|
<table class="header-table">
|
51
51
|
<tr class="top-aligned-row">
|
52
52
|
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">Kwartz::
|
53
|
+
<td class="class-name-in-header">Kwartz::HandlerHelper</td>
|
54
54
|
</tr>
|
55
55
|
<tr class="top-aligned-row">
|
56
56
|
<td><strong>In:</strong></td>
|
@@ -80,17 +80,23 @@
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
81
81
|
|
82
82
|
<div class="name-list">
|
83
|
-
<a href="#
|
84
|
-
<a href="#
|
85
|
-
<a href="#
|
86
|
-
<a href="#
|
87
|
-
<a href="#
|
88
|
-
<a href="#
|
89
|
-
<a href="#
|
90
|
-
<a href="#
|
91
|
-
<a href="#
|
92
|
-
<a href="#
|
93
|
-
<a href="#
|
83
|
+
<a href="#M000008">_last_stmt_kind</a>
|
84
|
+
<a href="#M000021">add_foreach_stmts</a>
|
85
|
+
<a href="#M000018">add_native_code</a>
|
86
|
+
<a href="#M000022">add_native_expr_with_default</a>
|
87
|
+
<a href="#M000010">build_print_args</a>
|
88
|
+
<a href="#M000012">build_print_expr_stmt</a>
|
89
|
+
<a href="#M000011">build_print_stmt</a>
|
90
|
+
<a href="#M000009">create_text_print_stmt</a>
|
91
|
+
<a href="#M000006">error_if_empty_tag</a>
|
92
|
+
<a href="#M000007">error_when_last_stmt_is_not_if</a>
|
93
|
+
<a href="#M000017">etag_stmt</a>
|
94
|
+
<a href="#M000013">expand_attr_vars</a>
|
95
|
+
<a href="#M000014">expand_attr_vars_in_native_expr</a>
|
96
|
+
<a href="#M000015">expand_attr_vars_in_native_stmt</a>
|
97
|
+
<a href="#M000016">stag_stmt</a>
|
98
|
+
<a href="#M000020">wrap_content_with_native_stmt</a>
|
99
|
+
<a href="#M000019">wrap_element_with_native_stmt</a>
|
94
100
|
</div>
|
95
101
|
</div>
|
96
102
|
|
@@ -112,56 +118,84 @@
|
|
112
118
|
<div id="methods">
|
113
119
|
<h3 class="section-bar">Public Instance methods</h3>
|
114
120
|
|
115
|
-
<div id="method-
|
116
|
-
<a name="
|
121
|
+
<div id="method-M000008" class="method-detail">
|
122
|
+
<a name="M000008"></a>
|
117
123
|
|
118
124
|
<div class="method-heading">
|
119
|
-
<a href="#
|
120
|
-
<span class="method-name">
|
125
|
+
<a href="#M000008" class="method-signature">
|
126
|
+
<span class="method-name">_last_stmt_kind</span><span class="method-args">(stmt_list)</span>
|
121
127
|
</a>
|
122
128
|
</div>
|
123
129
|
|
124
130
|
<div class="method-description">
|
131
|
+
<p>
|
132
|
+
private
|
133
|
+
</p>
|
125
134
|
<p><a class="source-toggle" href="#"
|
126
|
-
onclick="toggleCode('
|
127
|
-
<div class="method-source-code" id="
|
135
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
136
|
+
<div class="method-source-code" id="M000008-source">
|
137
|
+
<pre>
|
138
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 273</span>
|
139
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_last_stmt_kind</span>(<span class="ruby-identifier">stmt_list</span>)
|
140
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">empty?</span>
|
141
|
+
<span class="ruby-identifier">stmt</span> = <span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">last</span>
|
142
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">stmt</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NativeStatement</span>)
|
143
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">stmt</span>.<span class="ruby-identifier">kind</span>
|
144
|
+
<span class="ruby-keyword kw">end</span>
|
145
|
+
</pre>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
<div id="method-M000021" class="method-detail">
|
151
|
+
<a name="M000021"></a>
|
152
|
+
|
153
|
+
<div class="method-heading">
|
154
|
+
<a href="#M000021" class="method-signature">
|
155
|
+
<span class="method-name">add_foreach_stmts</span><span class="method-args">(elem_info, stmt_list, foreach_code, endforeach_code, content_only, counter, toggle, init_code, incr_code, toggle_code)</span>
|
156
|
+
</a>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
<div class="method-description">
|
160
|
+
<p><a class="source-toggle" href="#"
|
161
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
162
|
+
<div class="method-source-code" id="M000021-source">
|
128
163
|
<pre>
|
129
|
-
<span class="ruby-comment cmt"># File kwartz/converter.rb, line
|
130
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_foreach_stmts</span>(<span class="ruby-identifier">
|
164
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 431</span>
|
165
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_foreach_stmts</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">foreach_code</span>, <span class="ruby-identifier">endforeach_code</span>,
|
131
166
|
<span class="ruby-identifier">content_only</span>, <span class="ruby-identifier">counter</span>, <span class="ruby-identifier">toggle</span>, <span class="ruby-identifier">init_code</span>, <span class="ruby-identifier">incr_code</span>, <span class="ruby-identifier">toggle_code</span>)
|
132
|
-
<span class="ruby-identifier">
|
133
|
-
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">stag_stmt</span>(<span class="ruby-identifier">arg</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">content_only</span>
|
167
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">stag_stmt</span>(<span class="ruby-identifier">elem_info</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">content_only</span>
|
134
168
|
<span class="ruby-identifier">start_code</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\n/</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
|
135
169
|
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">NativeStatement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">kind</span>)
|
136
170
|
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">start_code</span>
|
137
|
-
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">stag_stmt</span>(<span class="ruby-identifier">
|
138
|
-
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">
|
139
|
-
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">etag_stmt</span>(<span class="ruby-identifier">
|
171
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">stag_stmt</span>(<span class="ruby-identifier">elem_info</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">content_only</span>
|
172
|
+
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">elem_info</span>.<span class="ruby-identifier">cont_stmts</span>)
|
173
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">etag_stmt</span>(<span class="ruby-identifier">elem_info</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">content_only</span>
|
140
174
|
<span class="ruby-identifier">end_code</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\n/</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
|
141
175
|
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">NativeStatement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">kind</span>)
|
142
176
|
<span class="ruby-keyword kw">end</span>
|
143
|
-
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">etag_stmt</span>(<span class="ruby-identifier">
|
177
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">etag_stmt</span>(<span class="ruby-identifier">elem_info</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">content_only</span>
|
144
178
|
<span class="ruby-keyword kw">end</span>
|
145
179
|
</pre>
|
146
180
|
</div>
|
147
181
|
</div>
|
148
182
|
</div>
|
149
183
|
|
150
|
-
<div id="method-
|
151
|
-
<a name="
|
184
|
+
<div id="method-M000018" class="method-detail">
|
185
|
+
<a name="M000018"></a>
|
152
186
|
|
153
187
|
<div class="method-heading">
|
154
|
-
<a href="#
|
188
|
+
<a href="#M000018" class="method-signature">
|
155
189
|
<span class="method-name">add_native_code</span><span class="method-args">(stmt_list, code, kind)</span>
|
156
190
|
</a>
|
157
191
|
</div>
|
158
192
|
|
159
193
|
<div class="method-description">
|
160
194
|
<p><a class="source-toggle" href="#"
|
161
|
-
onclick="toggleCode('
|
162
|
-
<div class="method-source-code" id="
|
195
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
196
|
+
<div class="method-source-code" id="M000018-source">
|
163
197
|
<pre>
|
164
|
-
<span class="ruby-comment cmt"># File kwartz/converter.rb, line
|
198
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 404</span>
|
165
199
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_native_code</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">kind</span>)
|
166
200
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">code</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
167
201
|
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">NativeStatement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">kind</span>)
|
@@ -174,43 +208,42 @@
|
|
174
208
|
</div>
|
175
209
|
</div>
|
176
210
|
|
177
|
-
<div id="method-
|
178
|
-
<a name="
|
211
|
+
<div id="method-M000022" class="method-detail">
|
212
|
+
<a name="M000022"></a>
|
179
213
|
|
180
214
|
<div class="method-heading">
|
181
|
-
<a href="#
|
182
|
-
<span class="method-name">add_native_expr_with_default</span><span class="method-args">(
|
215
|
+
<a href="#M000022" class="method-signature">
|
216
|
+
<span class="method-name">add_native_expr_with_default</span><span class="method-args">(elem_info, stmt_list, expr_code, flag_escape, if_code, else_code, endif_code)</span>
|
183
217
|
</a>
|
184
218
|
</div>
|
185
219
|
|
186
220
|
<div class="method-description">
|
187
221
|
<p><a class="source-toggle" href="#"
|
188
|
-
onclick="toggleCode('
|
189
|
-
<div class="method-source-code" id="
|
222
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
223
|
+
<div class="method-source-code" id="M000022-source">
|
190
224
|
<pre>
|
191
|
-
<span class="ruby-comment cmt"># File kwartz/converter.rb, line
|
192
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_native_expr_with_default</span>(<span class="ruby-identifier">
|
225
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 447</span>
|
226
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_native_expr_with_default</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>,
|
193
227
|
<span class="ruby-identifier">expr_code</span>, <span class="ruby-identifier">flag_escape</span>,
|
194
228
|
<span class="ruby-identifier">if_code</span>, <span class="ruby-identifier">else_code</span>, <span class="ruby-identifier">endif_code</span>)
|
195
|
-
<span class="ruby-identifier">
|
196
|
-
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">stag_stmt</span>(<span class="ruby-identifier">arg</span>)
|
229
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">stag_stmt</span>(<span class="ruby-identifier">elem_info</span>)
|
197
230
|
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">NativeStatement</span>.<span class="ruby-identifier">new_without_newline</span>(<span class="ruby-identifier">if_code</span>, <span class="ruby-identifier">:if</span>)
|
198
231
|
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">PrintStatement</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-constant">NativeExpression</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">expr_code</span>, <span class="ruby-identifier">flag_escape</span>) ])
|
199
232
|
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">NativeStatement</span>.<span class="ruby-identifier">new_without_newline</span>(<span class="ruby-identifier">else_code</span>, <span class="ruby-identifier">:else</span>)
|
200
|
-
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">
|
233
|
+
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">elem_info</span>.<span class="ruby-identifier">cont_stmts</span>)
|
201
234
|
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">NativeStatement</span>.<span class="ruby-identifier">new_without_newline</span>(<span class="ruby-identifier">endif_code</span>, <span class="ruby-identifier">:else</span>)
|
202
|
-
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">etag_stmt</span>(<span class="ruby-identifier">
|
235
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">etag_stmt</span>(<span class="ruby-identifier">elem_info</span>)
|
203
236
|
<span class="ruby-keyword kw">end</span>
|
204
237
|
</pre>
|
205
238
|
</div>
|
206
239
|
</div>
|
207
240
|
</div>
|
208
241
|
|
209
|
-
<div id="method-
|
210
|
-
<a name="
|
242
|
+
<div id="method-M000010" class="method-detail">
|
243
|
+
<a name="M000010"></a>
|
211
244
|
|
212
245
|
<div class="method-heading">
|
213
|
-
<a href="#
|
246
|
+
<a href="#M000010" class="method-signature">
|
214
247
|
<span class="method-name">build_print_args</span><span class="method-args">(taginfo, attr_info, append_exprs)</span>
|
215
248
|
</a>
|
216
249
|
</div>
|
@@ -222,10 +255,10 @@ href="NativeExpression.html">NativeExpression</a> for <a
|
|
222
255
|
href="PrintStatement.html">PrintStatement</a>
|
223
256
|
</p>
|
224
257
|
<p><a class="source-toggle" href="#"
|
225
|
-
onclick="toggleCode('
|
226
|
-
<div class="method-source-code" id="
|
258
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
259
|
+
<div class="method-source-code" id="M000010-source">
|
227
260
|
<pre>
|
228
|
-
<span class="ruby-comment cmt"># File kwartz/converter.rb, line
|
261
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 289</span>
|
229
262
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_print_args</span>(<span class="ruby-identifier">taginfo</span>, <span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">append_exprs</span>)
|
230
263
|
<span class="ruby-keyword kw">return</span> [] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">taginfo</span>.<span class="ruby-identifier">tagname</span>.<span class="ruby-identifier">nil?</span>
|
231
264
|
<span class="ruby-comment cmt">#if taginfo.tagname.nil?</span>
|
@@ -244,8 +277,9 @@ href="PrintStatement.html">PrintStatement</a>
|
|
244
277
|
<span class="ruby-identifier">attr_info</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">space</span>, <span class="ruby-identifier">aname</span>, <span class="ruby-identifier">avalue</span><span class="ruby-operator">|</span>
|
245
278
|
<span class="ruby-identifier">sb</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{space}#{aname}=\""</span>
|
246
279
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">avalue</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NativeExpression</span>)
|
280
|
+
<span class="ruby-identifier">native_expr</span> = <span class="ruby-identifier">expand_attr_vars_in_native_expr</span>(<span class="ruby-identifier">avalue</span>, <span class="ruby-identifier">attr_info</span>)
|
247
281
|
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sb</span> <span class="ruby-comment cmt"># TextExpression.new(sb)</span>
|
248
|
-
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">
|
282
|
+
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">native_expr</span>
|
249
283
|
<span class="ruby-identifier">sb</span> = <span class="ruby-value str">''</span>
|
250
284
|
<span class="ruby-keyword kw">else</span>
|
251
285
|
<span class="ruby-identifier">sb</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">avalue</span>
|
@@ -257,7 +291,10 @@ href="PrintStatement.html">PrintStatement</a>
|
|
257
291
|
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sb</span> <span class="ruby-comment cmt"># TextExpression.new(sb)</span>
|
258
292
|
<span class="ruby-identifier">sb</span> = <span class="ruby-value str">''</span>
|
259
293
|
<span class="ruby-keyword kw">end</span>
|
260
|
-
<span class="ruby-identifier">
|
294
|
+
<span class="ruby-identifier">append_exprs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">append_expr</span><span class="ruby-operator">|</span>
|
295
|
+
<span class="ruby-identifier">native_expr</span> = <span class="ruby-identifier">expand_attr_vars_in_native_expr</span>(<span class="ruby-identifier">append_expr</span>, <span class="ruby-identifier">attr_info</span>)
|
296
|
+
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">native_expr</span>
|
297
|
+
<span class="ruby-keyword kw">end</span>
|
261
298
|
<span class="ruby-keyword kw">end</span>
|
262
299
|
<span class="ruby-identifier">sb</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{t.extra_space}#{t.is_empty ? '/' : ''}>#{t.tail_space}"</span>
|
263
300
|
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sb</span> <span class="ruby-comment cmt"># TextExpression.new(sb)</span>
|
@@ -268,12 +305,12 @@ href="PrintStatement.html">PrintStatement</a>
|
|
268
305
|
</div>
|
269
306
|
</div>
|
270
307
|
|
271
|
-
<div id="method-
|
272
|
-
<a name="
|
308
|
+
<div id="method-M000012" class="method-detail">
|
309
|
+
<a name="M000012"></a>
|
273
310
|
|
274
311
|
<div class="method-heading">
|
275
|
-
<a href="#
|
276
|
-
<span class="method-name">build_print_expr_stmt</span><span class="method-args">(native_expr, stag_info, etag_info)</span>
|
312
|
+
<a href="#M000012" class="method-signature">
|
313
|
+
<span class="method-name">build_print_expr_stmt</span><span class="method-args">(native_expr, stag_info, etag_info, attr_info=nil)</span>
|
277
314
|
</a>
|
278
315
|
</div>
|
279
316
|
|
@@ -283,15 +320,16 @@ create <a href="PrintStatement.html">PrintStatement</a> for <a
|
|
283
320
|
href="NativeExpression.html">NativeExpression</a>
|
284
321
|
</p>
|
285
322
|
<p><a class="source-toggle" href="#"
|
286
|
-
onclick="toggleCode('
|
287
|
-
<div class="method-source-code" id="
|
323
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
324
|
+
<div class="method-source-code" id="M000012-source">
|
288
325
|
<pre>
|
289
|
-
<span class="ruby-comment cmt"># File kwartz/converter.rb, line
|
290
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_print_expr_stmt</span>(<span class="ruby-identifier">native_expr</span>, <span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">etag_info</span>)
|
326
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 340</span>
|
327
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_print_expr_stmt</span>(<span class="ruby-identifier">native_expr</span>, <span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">etag_info</span>, <span class="ruby-identifier">attr_info</span>=<span class="ruby-keyword kw">nil</span>)
|
291
328
|
<span class="ruby-identifier">head_space</span> = (<span class="ruby-identifier">stag_info</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">etag_info</span>).<span class="ruby-identifier">head_space</span>
|
292
329
|
<span class="ruby-identifier">tail_space</span> = (<span class="ruby-identifier">etag_info</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">stag_info</span>).<span class="ruby-identifier">tail_space</span>
|
330
|
+
<span class="ruby-identifier">native_expr</span> = <span class="ruby-identifier">expand_attr_vars_in_native_expr</span>(<span class="ruby-identifier">native_expr</span>, <span class="ruby-identifier">attr_info</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">attr_info</span>
|
293
331
|
<span class="ruby-identifier">args</span> = []
|
294
|
-
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">head_space</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">head_space</span> <span class="ruby-comment cmt">#
|
332
|
+
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">head_space</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">head_space</span> <span class="ruby-comment cmt"># TextExpression.new(head_space)</span>
|
295
333
|
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">native_expr</span>
|
296
334
|
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">tail_space</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tail_space</span> <span class="ruby-comment cmt"># TextExpression.new(tail_space)</span>
|
297
335
|
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">PrintStatement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args</span>)
|
@@ -301,11 +339,11 @@ href="NativeExpression.html">NativeExpression</a>
|
|
301
339
|
</div>
|
302
340
|
</div>
|
303
341
|
|
304
|
-
<div id="method-
|
305
|
-
<a name="
|
342
|
+
<div id="method-M000011" class="method-detail">
|
343
|
+
<a name="M000011"></a>
|
306
344
|
|
307
345
|
<div class="method-heading">
|
308
|
-
<a href="#
|
346
|
+
<a href="#M000011" class="method-signature">
|
309
347
|
<span class="method-name">build_print_stmt</span><span class="method-args">(taginfo, attr_info, append_exprs)</span>
|
310
348
|
</a>
|
311
349
|
</div>
|
@@ -316,10 +354,10 @@ create <a href="PrintStatement.html">PrintStatement</a> for <a
|
|
316
354
|
href="TagInfo.html">TagInfo</a>
|
317
355
|
</p>
|
318
356
|
<p><a class="source-toggle" href="#"
|
319
|
-
onclick="toggleCode('
|
320
|
-
<div class="method-source-code" id="
|
357
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
358
|
+
<div class="method-source-code" id="M000011-source">
|
321
359
|
<pre>
|
322
|
-
<span class="ruby-comment cmt"># File kwartz/converter.rb, line
|
360
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 333</span>
|
323
361
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">taginfo</span>, <span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">append_exprs</span>)
|
324
362
|
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">build_print_args</span>(<span class="ruby-identifier">taginfo</span>, <span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">append_exprs</span>)
|
325
363
|
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">PrintStatement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args</span>)
|
@@ -329,11 +367,11 @@ href="TagInfo.html">TagInfo</a>
|
|
329
367
|
</div>
|
330
368
|
</div>
|
331
369
|
|
332
|
-
<div id="method-
|
333
|
-
<a name="
|
370
|
+
<div id="method-M000009" class="method-detail">
|
371
|
+
<a name="M000009"></a>
|
334
372
|
|
335
373
|
<div class="method-heading">
|
336
|
-
<a href="#
|
374
|
+
<a href="#M000009" class="method-signature">
|
337
375
|
<span class="method-name">create_text_print_stmt</span><span class="method-args">(text)</span>
|
338
376
|
</a>
|
339
377
|
</div>
|
@@ -343,10 +381,10 @@ href="TagInfo.html">TagInfo</a>
|
|
343
381
|
create print statement from text
|
344
382
|
</p>
|
345
383
|
<p><a class="source-toggle" href="#"
|
346
|
-
onclick="toggleCode('
|
347
|
-
<div class="method-source-code" id="
|
384
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
385
|
+
<div class="method-source-code" id="M000009-source">
|
348
386
|
<pre>
|
349
|
-
<span class="ruby-comment cmt"># File kwartz/converter.rb, line
|
387
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 282</span>
|
350
388
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_text_print_stmt</span>(<span class="ruby-identifier">text</span>)
|
351
389
|
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">PrintStatement</span>.<span class="ruby-identifier">new</span>([<span class="ruby-identifier">text</span>])
|
352
390
|
<span class="ruby-comment cmt">#return PritnStatement.new([TextExpression.new(text)])</span>
|
@@ -361,102 +399,259 @@ create print statement from text
|
|
361
399
|
|
362
400
|
<div class="method-heading">
|
363
401
|
<a href="#M000006" class="method-signature">
|
364
|
-
<span class="method-name">
|
402
|
+
<span class="method-name">error_if_empty_tag</span><span class="method-args">(elem_info, directive_str)</span>
|
365
403
|
</a>
|
366
404
|
</div>
|
367
405
|
|
368
406
|
<div class="method-description">
|
369
407
|
<p>
|
370
|
-
|
408
|
+
raise error if etag_info is null
|
371
409
|
</p>
|
372
410
|
<p><a class="source-toggle" href="#"
|
373
411
|
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
374
412
|
<div class="method-source-code" id="M000006-source">
|
375
413
|
<pre>
|
376
|
-
<span class="ruby-comment cmt"># File kwartz/converter.rb, line
|
377
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
378
|
-
<span class="ruby-
|
379
|
-
|
414
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 253</span>
|
415
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">directive_str</span>)
|
416
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">elem_info</span>.<span class="ruby-identifier">etag_info</span>
|
417
|
+
<span class="ruby-identifier">msg</span> = <span class="ruby-node">"'#{directive_str}': directive is not available with empty tag."</span>
|
418
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-identifier">elem_info</span>.<span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>)
|
419
|
+
<span class="ruby-keyword kw">end</span>
|
380
420
|
<span class="ruby-keyword kw">end</span>
|
381
421
|
</pre>
|
382
422
|
</div>
|
383
423
|
</div>
|
384
424
|
</div>
|
385
425
|
|
386
|
-
<div id="method-
|
387
|
-
<a name="
|
426
|
+
<div id="method-M000007" class="method-detail">
|
427
|
+
<a name="M000007"></a>
|
388
428
|
|
389
429
|
<div class="method-heading">
|
390
|
-
<a href="#
|
391
|
-
<span class="method-name">
|
430
|
+
<a href="#M000007" class="method-signature">
|
431
|
+
<span class="method-name">error_when_last_stmt_is_not_if</span><span class="method-args">(elem_info, directive_str, stmt_list)</span>
|
432
|
+
</a>
|
433
|
+
</div>
|
434
|
+
|
435
|
+
<div class="method-description">
|
436
|
+
<p><a class="source-toggle" href="#"
|
437
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
438
|
+
<div class="method-source-code" id="M000007-source">
|
439
|
+
<pre>
|
440
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 261</span>
|
441
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error_when_last_stmt_is_not_if</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">directive_str</span>, <span class="ruby-identifier">stmt_list</span>)
|
442
|
+
<span class="ruby-identifier">kind</span> = <span class="ruby-identifier">_last_stmt_kind</span>(<span class="ruby-identifier">stmt_list</span>)
|
443
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:if</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">kind</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:elseif</span>
|
444
|
+
<span class="ruby-identifier">msg</span> = <span class="ruby-node">"'#{directive_str}': previous statement should be 'if' or 'elsif'."</span>
|
445
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-identifier">elem_info</span>.<span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>)
|
446
|
+
<span class="ruby-keyword kw">end</span>
|
447
|
+
<span class="ruby-keyword kw">end</span>
|
448
|
+
</pre>
|
449
|
+
</div>
|
450
|
+
</div>
|
451
|
+
</div>
|
452
|
+
|
453
|
+
<div id="method-M000017" class="method-detail">
|
454
|
+
<a name="M000017"></a>
|
455
|
+
|
456
|
+
<div class="method-heading">
|
457
|
+
<a href="#M000017" class="method-signature">
|
458
|
+
<span class="method-name">etag_stmt</span><span class="method-args">(elem_info)</span>
|
392
459
|
</a>
|
393
460
|
</div>
|
394
461
|
|
395
462
|
<div class="method-description">
|
396
463
|
<p>
|
397
|
-
build print
|
464
|
+
build print statemetn of end-tag
|
398
465
|
</p>
|
399
466
|
<p><a class="source-toggle" href="#"
|
400
|
-
onclick="toggleCode('
|
401
|
-
<div class="method-source-code" id="
|
467
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
468
|
+
<div class="method-source-code" id="M000017-source">
|
402
469
|
<pre>
|
403
|
-
<span class="ruby-comment cmt"># File kwartz/converter.rb, line
|
404
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
405
|
-
<span class="ruby-identifier">
|
406
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">arg</span>.<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">append_exprs</span>)
|
470
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 399</span>
|
471
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">etag_stmt</span>(<span class="ruby-identifier">elem_info</span>)
|
472
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">elem_info</span>.<span class="ruby-identifier">etag_info</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>)
|
407
473
|
<span class="ruby-keyword kw">end</span>
|
408
474
|
</pre>
|
409
475
|
</div>
|
410
476
|
</div>
|
411
477
|
</div>
|
412
478
|
|
413
|
-
<div id="method-
|
414
|
-
<a name="
|
479
|
+
<div id="method-M000013" class="method-detail">
|
480
|
+
<a name="M000013"></a>
|
415
481
|
|
416
482
|
<div class="method-heading">
|
417
|
-
<a href="#
|
418
|
-
<span class="method-name">
|
483
|
+
<a href="#M000013" class="method-signature">
|
484
|
+
<span class="method-name">expand_attr_vars</span><span class="method-args">(code, attr_info)</span>
|
419
485
|
</a>
|
420
486
|
</div>
|
421
487
|
|
422
488
|
<div class="method-description">
|
489
|
+
<p>
|
490
|
+
expand attribute variables (such as ’$(rows)’ or
|
491
|
+
’$(value)’) and return new code
|
492
|
+
</p>
|
423
493
|
<p><a class="source-toggle" href="#"
|
424
|
-
onclick="toggleCode('
|
425
|
-
<div class="method-source-code" id="
|
494
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
495
|
+
<div class="method-source-code" id="M000013-source">
|
496
|
+
<pre>
|
497
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 353</span>
|
498
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expand_attr_vars</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">attr_info</span>)
|
499
|
+
<span class="ruby-identifier">new_code</span> = <span class="ruby-identifier">code</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\$\((\w+(?::\w+)?)\)/</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
|
500
|
+
<span class="ruby-identifier">aname</span> = <span class="ruby-identifier">$1</span>
|
501
|
+
<span class="ruby-comment cmt">#unless attrs.key?(aname)</span>
|
502
|
+
<span class="ruby-comment cmt"># raise "#{m}: attribute '#{aname}' expected but not found."</span>
|
503
|
+
<span class="ruby-comment cmt">#end</span>
|
504
|
+
<span class="ruby-identifier">avalue</span> = <span class="ruby-identifier">attr_info</span>[<span class="ruby-identifier">aname</span>]
|
505
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">avalue</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NativeExpression</span>)
|
506
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-node">"#{m}: attribute value of '#{aname}' is NativeExpression object."</span>
|
507
|
+
<span class="ruby-keyword kw">end</span>
|
508
|
+
<span class="ruby-identifier">avalue</span>
|
509
|
+
<span class="ruby-keyword kw">end</span>
|
510
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">new_code</span>
|
511
|
+
<span class="ruby-keyword kw">end</span>
|
512
|
+
</pre>
|
513
|
+
</div>
|
514
|
+
</div>
|
515
|
+
</div>
|
516
|
+
|
517
|
+
<div id="method-M000014" class="method-detail">
|
518
|
+
<a name="M000014"></a>
|
519
|
+
|
520
|
+
<div class="method-heading">
|
521
|
+
<a href="#M000014" class="method-signature">
|
522
|
+
<span class="method-name">expand_attr_vars_in_native_expr</span><span class="method-args">(native_expr, attr_info)</span>
|
523
|
+
</a>
|
524
|
+
</div>
|
525
|
+
|
526
|
+
<div class="method-description">
|
527
|
+
<p>
|
528
|
+
expand attribute variables and return new <a
|
529
|
+
href="NativeExpression.html">NativeExpression</a>
|
530
|
+
</p>
|
531
|
+
<p><a class="source-toggle" href="#"
|
532
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
533
|
+
<div class="method-source-code" id="M000014-source">
|
534
|
+
<pre>
|
535
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 370</span>
|
536
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expand_attr_vars_in_native_expr</span>(<span class="ruby-identifier">native_expr</span>, <span class="ruby-identifier">attr_info</span>)
|
537
|
+
<span class="ruby-identifier">code</span> = <span class="ruby-identifier">expand_attr_vars</span>(<span class="ruby-identifier">native_expr</span>.<span class="ruby-identifier">code</span>, <span class="ruby-identifier">attr_info</span>)
|
538
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">code</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">native_expr</span>.<span class="ruby-identifier">code</span>
|
539
|
+
<span class="ruby-identifier">native_expr</span> = <span class="ruby-constant">NativeExpression</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">native_expr</span>.<span class="ruby-identifier">escape</span>)
|
540
|
+
<span class="ruby-keyword kw">end</span>
|
541
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">native_expr</span>
|
542
|
+
<span class="ruby-keyword kw">end</span>
|
543
|
+
</pre>
|
544
|
+
</div>
|
545
|
+
</div>
|
546
|
+
</div>
|
547
|
+
|
548
|
+
<div id="method-M000015" class="method-detail">
|
549
|
+
<a name="M000015"></a>
|
550
|
+
|
551
|
+
<div class="method-heading">
|
552
|
+
<a href="#M000015" class="method-signature">
|
553
|
+
<span class="method-name">expand_attr_vars_in_native_stmt</span><span class="method-args">(native_stmt, attr_info)</span>
|
554
|
+
</a>
|
555
|
+
</div>
|
556
|
+
|
557
|
+
<div class="method-description">
|
558
|
+
<p>
|
559
|
+
expand attribute variables and return new <a
|
560
|
+
href="NativeExpression.html">NativeExpression</a>
|
561
|
+
</p>
|
562
|
+
<p><a class="source-toggle" href="#"
|
563
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
564
|
+
<div class="method-source-code" id="M000015-source">
|
426
565
|
<pre>
|
427
566
|
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 380</span>
|
428
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
429
|
-
<span class="ruby-identifier">
|
567
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expand_attr_vars_in_native_stmt</span>(<span class="ruby-identifier">native_stmt</span>, <span class="ruby-identifier">attr_info</span>)
|
568
|
+
<span class="ruby-identifier">code</span> = <span class="ruby-identifier">expand_attr_vars</span>(<span class="ruby-identifier">native_stmt</span>.<span class="ruby-identifier">code</span>, <span class="ruby-identifier">attr_info</span>)
|
569
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">code</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">native_stmt</span>.<span class="ruby-identifier">code</span>
|
570
|
+
<span class="ruby-identifier">no_newline</span> = <span class="ruby-identifier">native_stmt</span>.<span class="ruby-identifier">no_newline</span>
|
571
|
+
<span class="ruby-identifier">native_stmt</span> = <span class="ruby-constant">NativeStatement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">native_stmt</span>.<span class="ruby-identifier">kind</span>)
|
572
|
+
<span class="ruby-identifier">native_stmt</span>.<span class="ruby-identifier">no_newline</span> = <span class="ruby-identifier">no_newline</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">no_newline</span>.<span class="ruby-identifier">nil?</span>
|
573
|
+
<span class="ruby-keyword kw">end</span>
|
574
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">native_stmt</span>
|
575
|
+
<span class="ruby-keyword kw">end</span>
|
576
|
+
</pre>
|
577
|
+
</div>
|
578
|
+
</div>
|
579
|
+
</div>
|
580
|
+
|
581
|
+
<div id="method-M000016" class="method-detail">
|
582
|
+
<a name="M000016"></a>
|
583
|
+
|
584
|
+
<div class="method-heading">
|
585
|
+
<a href="#M000016" class="method-signature">
|
586
|
+
<span class="method-name">stag_stmt</span><span class="method-args">(elem_info)</span>
|
587
|
+
</a>
|
588
|
+
</div>
|
589
|
+
|
590
|
+
<div class="method-description">
|
591
|
+
<p>
|
592
|
+
build print statement of start-tag
|
593
|
+
</p>
|
594
|
+
<p><a class="source-toggle" href="#"
|
595
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
596
|
+
<div class="method-source-code" id="M000016-source">
|
597
|
+
<pre>
|
598
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 392</span>
|
599
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stag_stmt</span>(<span class="ruby-identifier">elem_info</span>)
|
600
|
+
<span class="ruby-identifier">e</span> = <span class="ruby-identifier">elem_info</span>
|
601
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">build_print_stmt</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">stag_info</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">attr_info</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">append_exprs</span>)
|
602
|
+
<span class="ruby-keyword kw">end</span>
|
603
|
+
</pre>
|
604
|
+
</div>
|
605
|
+
</div>
|
606
|
+
</div>
|
607
|
+
|
608
|
+
<div id="method-M000020" class="method-detail">
|
609
|
+
<a name="M000020"></a>
|
610
|
+
|
611
|
+
<div class="method-heading">
|
612
|
+
<a href="#M000020" class="method-signature">
|
613
|
+
<span class="method-name">wrap_content_with_native_stmt</span><span class="method-args">(elem_info, stmt_list, start_code, end_code, kind=nil)</span>
|
614
|
+
</a>
|
615
|
+
</div>
|
616
|
+
|
617
|
+
<div class="method-description">
|
618
|
+
<p><a class="source-toggle" href="#"
|
619
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
620
|
+
<div class="method-source-code" id="M000020-source">
|
621
|
+
<pre>
|
622
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 422</span>
|
623
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wrap_content_with_native_stmt</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">start_code</span>, <span class="ruby-identifier">end_code</span>, <span class="ruby-identifier">kind</span>=<span class="ruby-keyword kw">nil</span>)
|
624
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">stag_stmt</span>(<span class="ruby-identifier">elem_info</span>)
|
430
625
|
<span class="ruby-identifier">add_native_code</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">start_code</span>, <span class="ruby-identifier">kind</span>)
|
431
|
-
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">
|
626
|
+
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">elem_info</span>.<span class="ruby-identifier">cont_stmts</span>)
|
432
627
|
<span class="ruby-identifier">add_native_code</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">end_code</span>, <span class="ruby-identifier">kind</span>)
|
433
|
-
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">etag_stmt</span>(<span class="ruby-identifier">
|
628
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">etag_stmt</span>(<span class="ruby-identifier">elem_info</span>)
|
434
629
|
<span class="ruby-keyword kw">end</span>
|
435
630
|
</pre>
|
436
631
|
</div>
|
437
632
|
</div>
|
438
633
|
</div>
|
439
634
|
|
440
|
-
<div id="method-
|
441
|
-
<a name="
|
635
|
+
<div id="method-M000019" class="method-detail">
|
636
|
+
<a name="M000019"></a>
|
442
637
|
|
443
638
|
<div class="method-heading">
|
444
|
-
<a href="#
|
445
|
-
<span class="method-name">wrap_element_with_native_stmt</span><span class="method-args">(
|
639
|
+
<a href="#M000019" class="method-signature">
|
640
|
+
<span class="method-name">wrap_element_with_native_stmt</span><span class="method-args">(elem_info, stmt_list, start_code, end_code, kind=nil)</span>
|
446
641
|
</a>
|
447
642
|
</div>
|
448
643
|
|
449
644
|
<div class="method-description">
|
450
645
|
<p><a class="source-toggle" href="#"
|
451
|
-
onclick="toggleCode('
|
452
|
-
<div class="method-source-code" id="
|
646
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
647
|
+
<div class="method-source-code" id="M000019-source">
|
453
648
|
<pre>
|
454
|
-
<span class="ruby-comment cmt"># File kwartz/converter.rb, line
|
455
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">
|
649
|
+
<span class="ruby-comment cmt"># File kwartz/converter.rb, line 413</span>
|
650
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">start_code</span>, <span class="ruby-identifier">end_code</span>, <span class="ruby-identifier">kind</span>=<span class="ruby-keyword kw">nil</span>)
|
456
651
|
<span class="ruby-identifier">add_native_code</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">start_code</span>, <span class="ruby-identifier">kind</span>)
|
457
|
-
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">stag_stmt</span>(<span class="ruby-identifier">
|
458
|
-
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">
|
459
|
-
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">etag_stmt</span>(<span class="ruby-identifier">
|
652
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">stag_stmt</span>(<span class="ruby-identifier">elem_info</span>)
|
653
|
+
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">elem_info</span>.<span class="ruby-identifier">cont_stmts</span>)
|
654
|
+
<span class="ruby-identifier">stmt_list</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">etag_stmt</span>(<span class="ruby-identifier">elem_info</span>)
|
460
655
|
<span class="ruby-identifier">add_native_code</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">end_code</span>, <span class="ruby-identifier">kind</span>)
|
461
656
|
<span class="ruby-keyword kw">end</span>
|
462
657
|
</pre>
|