erubis 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +150 -2
- data/LGPL +504 -0
- data/README.txt +14 -8
- data/benchmark/erubybench.rb +1 -1
- data/benchmark/erubybench.rhtml +3 -3
- data/bin/erubis +1 -1
- data/bin/notext +154 -0
- data/contrib/erubis +1036 -374
- data/contrib/inline-require +5 -3
- data/doc-api/classes/Erubis.html +43 -1
- data/doc-api/classes/Erubis/ArrayBufferEnhancer.html +14 -14
- data/doc-api/classes/Erubis/ArrayEnhancer.html +14 -14
- data/doc-api/classes/Erubis/Basic.html +112 -0
- data/doc-api/classes/Erubis/Basic/Converter.html +318 -0
- data/doc-api/classes/Erubis/Basic/Engine.html +130 -0
- data/doc-api/classes/Erubis/BiPatternEnhancer.html +14 -14
- data/doc-api/classes/Erubis/CGenerator.html +386 -0
- data/doc-api/classes/Erubis/Context.html +31 -32
- data/doc-api/classes/Erubis/Converter.html +231 -0
- data/doc-api/classes/Erubis/Ec.html +9 -283
- data/doc-api/classes/Erubis/Ejava.html +9 -274
- data/doc-api/classes/Erubis/Ejavascript.html +9 -298
- data/doc-api/classes/Erubis/Engine.html +68 -508
- data/doc-api/classes/Erubis/Eperl.html +9 -259
- data/doc-api/classes/Erubis/Ephp.html +9 -239
- data/doc-api/classes/Erubis/ErubisError.html +2 -2
- data/doc-api/classes/Erubis/Eruby.html +4 -187
- data/doc-api/classes/Erubis/EscapeEnhancer.html +9 -11
- data/doc-api/classes/Erubis/Escheme.html +9 -272
- data/doc-api/classes/Erubis/Evaluator.html +212 -0
- data/doc-api/classes/Erubis/Generator.html +410 -0
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +16 -16
- data/doc-api/classes/Erubis/Helper.html +112 -0
- data/doc-api/classes/Erubis/Helper/CachedRailsTemplate.html +198 -0
- data/doc-api/classes/Erubis/Helper/RailsTemplate.html +366 -0
- data/doc-api/classes/Erubis/JavaGenerator.html +359 -0
- data/doc-api/classes/Erubis/JavascriptGenerator.html +381 -0
- data/doc-api/classes/Erubis/Main.html +27 -25
- data/doc-api/classes/Erubis/NoCodeEnhancer.html +249 -0
- data/doc-api/classes/Erubis/NoCodeEruby.html +120 -0
- data/doc-api/classes/Erubis/NoTextEnhancer.html +8 -8
- data/doc-api/classes/Erubis/NotSupportedError.html +119 -0
- data/doc-api/classes/Erubis/OptimizedEruby.html +22 -304
- data/doc-api/classes/Erubis/OptimizedGenerator.html +439 -0
- data/doc-api/classes/Erubis/OptimizedXmlEruby.html +7 -7
- data/doc-api/classes/Erubis/PI.html +124 -0
- data/doc-api/classes/Erubis/PI/Converter.html +318 -0
- data/doc-api/classes/Erubis/PI/Ec.html +166 -0
- data/doc-api/classes/Erubis/PI/Ejava.html +166 -0
- data/doc-api/classes/Erubis/PI/Ejavascript.html +166 -0
- data/doc-api/classes/Erubis/PI/Engine.html +122 -0
- data/doc-api/classes/Erubis/PI/Eperl.html +166 -0
- data/doc-api/classes/Erubis/PI/Ephp.html +166 -0
- data/doc-api/classes/Erubis/PI/Eruby.html +155 -0
- data/doc-api/classes/Erubis/PI/Escheme.html +166 -0
- data/doc-api/classes/Erubis/PI/TinyEruby.html +305 -0
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +7 -7
- data/doc-api/classes/Erubis/PerlGenerator.html +344 -0
- data/doc-api/classes/Erubis/PhpGenerator.html +350 -0
- data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +24 -24
- data/doc-api/classes/Erubis/PrintOutEnhancer.html +35 -35
- data/doc-api/classes/Erubis/RubyEvaluator.html +190 -0
- data/doc-api/classes/Erubis/RubyGenerator.html +327 -0
- data/doc-api/classes/Erubis/SchemeGenerator.html +382 -0
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +17 -13
- data/doc-api/classes/Erubis/StdoutEnhancer.html +14 -14
- data/doc-api/classes/Erubis/StringBufferEnhancer.html +14 -14
- data/doc-api/classes/Erubis/TinyEruby.html +45 -40
- data/doc-api/classes/Erubis/XmlHelper.html +14 -14
- data/doc-api/created.rid +1 -1
- data/doc-api/files/__/README_txt.html +27 -9
- data/doc-api/files/erubis/context_rb.html +107 -0
- data/doc-api/files/erubis/converter_rb.html +114 -0
- data/doc-api/files/erubis/engine/ec_rb.html +2 -2
- data/doc-api/files/erubis/engine/ejava_rb.html +2 -2
- data/doc-api/files/erubis/engine/ejavascript_rb.html +2 -2
- data/doc-api/files/erubis/engine/enhanced_rb.html +2 -2
- data/doc-api/files/erubis/engine/eperl_rb.html +2 -2
- data/doc-api/files/erubis/engine/ephp_rb.html +2 -2
- data/doc-api/files/erubis/engine/eruby_rb.html +3 -2
- data/doc-api/files/erubis/engine/escheme_rb.html +2 -2
- data/doc-api/files/erubis/engine/optimized_rb.html +2 -2
- data/doc-api/files/erubis/engine_rb.html +6 -3
- data/doc-api/files/erubis/enhancer_rb.html +2 -9
- data/doc-api/files/erubis/error_rb.html +107 -0
- data/doc-api/files/erubis/evaluator_rb.html +115 -0
- data/doc-api/files/erubis/generator_rb.html +114 -0
- data/doc-api/files/erubis/helper/rails_rb.html +140 -0
- data/doc-api/files/erubis/helper_rb.html +1 -1
- data/doc-api/files/erubis/local-setting_rb.html +1 -1
- data/doc-api/files/erubis/main_rb.html +2 -2
- data/doc-api/files/erubis/tiny_rb.html +2 -2
- data/doc-api/files/erubis_rb.html +2 -2
- data/doc-api/fr_class_index.html +32 -0
- data/doc-api/fr_file_index.html +6 -0
- data/doc-api/fr_method_index.html +178 -136
- data/doc/users-guide.html +538 -199
- data/examples/{Makefile → basic/Makefile} +11 -11
- data/examples/basic/example.ec +42 -0
- data/examples/{example.ejava → basic/example.ejava} +5 -1
- data/examples/{example.ejavascript → basic/example.ejs} +0 -0
- data/examples/{example.eperl → basic/example.eperl} +2 -2
- data/examples/{example.ephp → basic/example.ephp} +0 -0
- data/examples/{example.eruby → basic/example.eruby} +0 -0
- data/examples/{example.escheme → basic/example.escheme} +0 -0
- data/examples/pi/Makefile +54 -0
- data/examples/pi/example.ec +42 -0
- data/examples/pi/example.ejava +45 -0
- data/examples/pi/example.ejs +16 -0
- data/examples/pi/example.eperl +16 -0
- data/examples/pi/example.ephp +17 -0
- data/examples/pi/example.eruby +15 -0
- data/examples/pi/example.escheme +26 -0
- data/lib/erubis.rb +15 -8
- data/lib/erubis/context.rb +54 -0
- data/lib/erubis/converter.rb +307 -0
- data/lib/erubis/engine.rb +57 -227
- data/lib/erubis/engine/ec.rb +31 -20
- data/lib/erubis/engine/ejava.rb +33 -21
- data/lib/erubis/engine/ejavascript.rb +30 -18
- data/lib/erubis/engine/enhanced.rb +7 -2
- data/lib/erubis/engine/eperl.rb +33 -19
- data/lib/erubis/engine/ephp.rb +32 -14
- data/lib/erubis/engine/eruby.rb +34 -7
- data/lib/erubis/engine/escheme.rb +34 -15
- data/lib/erubis/engine/optimized.rb +25 -11
- data/lib/erubis/enhancer.rb +53 -19
- data/lib/erubis/error.rb +24 -0
- data/lib/erubis/evaluator.rb +71 -0
- data/lib/erubis/generator.rb +83 -0
- data/lib/erubis/helper.rb +1 -1
- data/lib/erubis/helper/rails.rb +159 -0
- data/lib/erubis/local-setting.rb +1 -1
- data/lib/erubis/main.rb +87 -46
- data/lib/erubis/tiny.rb +81 -7
- data/test/assert-text-equal.rb +1 -1
- data/test/test-engines.rb +8 -9
- data/test/test-erubis.rb +196 -18
- data/test/{test-bin.rb → test-main.rb} +123 -21
- data/test/test-notext.rb +27 -0
- data/test/test.rb +5 -3
- data/test/testutil.rb +25 -36
- metadata +75 -13
- data/COPYING +0 -340
- data/examples/example.ec +0 -24
@@ -65,8 +65,8 @@
|
|
65
65
|
<tr class="top-aligned-row">
|
66
66
|
<td><strong>Parent:</strong></td>
|
67
67
|
<td>
|
68
|
-
<a href="Engine.html">
|
69
|
-
Engine
|
68
|
+
<a href="Basic/Engine.html">
|
69
|
+
Basic::Engine
|
70
70
|
</a>
|
71
71
|
</td>
|
72
72
|
</tr>
|
@@ -90,19 +90,6 @@ engine for Ruby
|
|
90
90
|
|
91
91
|
</div>
|
92
92
|
|
93
|
-
<div id="method-list">
|
94
|
-
<h3 class="section-bar">Methods</h3>
|
95
|
-
|
96
|
-
<div class="name-list">
|
97
|
-
<a href="#M000126">add_expr_debug</a>
|
98
|
-
<a href="#M000125">add_expr_escaped</a>
|
99
|
-
<a href="#M000124">add_expr_literal</a>
|
100
|
-
<a href="#M000123">add_stmt</a>
|
101
|
-
<a href="#M000122">add_text</a>
|
102
|
-
<a href="#M000120">escape_text</a>
|
103
|
-
<a href="#M000121">escaped_expr</a>
|
104
|
-
</div>
|
105
|
-
</div>
|
106
93
|
|
107
94
|
</div>
|
108
95
|
|
@@ -112,7 +99,8 @@ engine for Ruby
|
|
112
99
|
<h3 class="section-bar">Included Modules</h3>
|
113
100
|
|
114
101
|
<div id="includes-list">
|
115
|
-
<span class="include-name"><a href="
|
102
|
+
<span class="include-name"><a href="RubyEvaluator.html">RubyEvaluator</a></span>
|
103
|
+
<span class="include-name"><a href="RubyGenerator.html">RubyGenerator</a></span>
|
116
104
|
</div>
|
117
105
|
</div>
|
118
106
|
|
@@ -126,177 +114,6 @@ engine for Ruby
|
|
126
114
|
|
127
115
|
|
128
116
|
<!-- if method_list -->
|
129
|
-
<div id="methods">
|
130
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
131
|
-
|
132
|
-
<div id="method-M000126" class="method-detail">
|
133
|
-
<a name="M000126"></a>
|
134
|
-
|
135
|
-
<div class="method-heading">
|
136
|
-
<a href="#M000126" class="method-signature">
|
137
|
-
<span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
|
138
|
-
</a>
|
139
|
-
</div>
|
140
|
-
|
141
|
-
<div class="method-description">
|
142
|
-
<p><a class="source-toggle" href="#"
|
143
|
-
onclick="toggleCode('M000126-source');return false;">[Source]</a></p>
|
144
|
-
<div class="method-source-code" id="M000126-source">
|
145
|
-
<pre>
|
146
|
-
<span class="ruby-comment cmt"># File erubis/engine/eruby.rb, line 58</span>
|
147
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_debug</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
148
|
-
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
|
149
|
-
<span class="ruby-identifier">s</span> = (<span class="ruby-identifier">code</span>.<span class="ruby-identifier">dump</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A"(.*)"\z/</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">$1</span>
|
150
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">' $stderr.puts("*** debug: '</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'=#{('</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">code</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">').inspect}");'</span>
|
151
|
-
<span class="ruby-keyword kw">end</span>
|
152
|
-
</pre>
|
153
|
-
</div>
|
154
|
-
</div>
|
155
|
-
</div>
|
156
|
-
|
157
|
-
<div id="method-M000125" class="method-detail">
|
158
|
-
<a name="M000125"></a>
|
159
|
-
|
160
|
-
<div class="method-heading">
|
161
|
-
<a href="#M000125" class="method-signature">
|
162
|
-
<span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
|
163
|
-
</a>
|
164
|
-
</div>
|
165
|
-
|
166
|
-
<div class="method-description">
|
167
|
-
<p><a class="source-toggle" href="#"
|
168
|
-
onclick="toggleCode('M000125-source');return false;">[Source]</a></p>
|
169
|
-
<div class="method-source-code" id="M000125-source">
|
170
|
-
<pre>
|
171
|
-
<span class="ruby-comment cmt"># File erubis/engine/eruby.rb, line 54</span>
|
172
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
173
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">' _buf << '</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>) <span class="ruby-operator"><<</span> <span class="ruby-value str">';'</span>
|
174
|
-
<span class="ruby-keyword kw">end</span>
|
175
|
-
</pre>
|
176
|
-
</div>
|
177
|
-
</div>
|
178
|
-
</div>
|
179
|
-
|
180
|
-
<div id="method-M000124" class="method-detail">
|
181
|
-
<a name="M000124"></a>
|
182
|
-
|
183
|
-
<div class="method-heading">
|
184
|
-
<a href="#M000124" class="method-signature">
|
185
|
-
<span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
|
186
|
-
</a>
|
187
|
-
</div>
|
188
|
-
|
189
|
-
<div class="method-description">
|
190
|
-
<p><a class="source-toggle" href="#"
|
191
|
-
onclick="toggleCode('M000124-source');return false;">[Source]</a></p>
|
192
|
-
<div class="method-source-code" id="M000124-source">
|
193
|
-
<pre>
|
194
|
-
<span class="ruby-comment cmt"># File erubis/engine/eruby.rb, line 50</span>
|
195
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
196
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">' _buf << ('</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">code</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">').to_s;'</span>
|
197
|
-
<span class="ruby-keyword kw">end</span>
|
198
|
-
</pre>
|
199
|
-
</div>
|
200
|
-
</div>
|
201
|
-
</div>
|
202
|
-
|
203
|
-
<div id="method-M000123" class="method-detail">
|
204
|
-
<a name="M000123"></a>
|
205
|
-
|
206
|
-
<div class="method-heading">
|
207
|
-
<a href="#M000123" class="method-signature">
|
208
|
-
<span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
|
209
|
-
</a>
|
210
|
-
</div>
|
211
|
-
|
212
|
-
<div class="method-description">
|
213
|
-
<p><a class="source-toggle" href="#"
|
214
|
-
onclick="toggleCode('M000123-source');return false;">[Source]</a></p>
|
215
|
-
<div class="method-source-code" id="M000123-source">
|
216
|
-
<pre>
|
217
|
-
<span class="ruby-comment cmt"># File erubis/engine/eruby.rb, line 44</span>
|
218
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
219
|
-
<span class="ruby-comment cmt">#src << code << ';'</span>
|
220
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">code</span>
|
221
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">';'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">code</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
|
222
|
-
<span class="ruby-keyword kw">end</span>
|
223
|
-
</pre>
|
224
|
-
</div>
|
225
|
-
</div>
|
226
|
-
</div>
|
227
|
-
|
228
|
-
<div id="method-M000122" class="method-detail">
|
229
|
-
<a name="M000122"></a>
|
230
|
-
|
231
|
-
<div class="method-heading">
|
232
|
-
<a href="#M000122" class="method-signature">
|
233
|
-
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
|
234
|
-
</a>
|
235
|
-
</div>
|
236
|
-
|
237
|
-
<div class="method-description">
|
238
|
-
<p><a class="source-toggle" href="#"
|
239
|
-
onclick="toggleCode('M000122-source');return false;">[Source]</a></p>
|
240
|
-
<div class="method-source-code" id="M000122-source">
|
241
|
-
<pre>
|
242
|
-
<span class="ruby-comment cmt"># File erubis/engine/eruby.rb, line 40</span>
|
243
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
|
244
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">" _buf << '"</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>) <span class="ruby-operator"><<</span> <span class="ruby-value str">"';"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
|
245
|
-
<span class="ruby-keyword kw">end</span>
|
246
|
-
</pre>
|
247
|
-
</div>
|
248
|
-
</div>
|
249
|
-
</div>
|
250
|
-
|
251
|
-
<div id="method-M000120" class="method-detail">
|
252
|
-
<a name="M000120"></a>
|
253
|
-
|
254
|
-
<div class="method-heading">
|
255
|
-
<a href="#M000120" class="method-signature">
|
256
|
-
<span class="method-name">escape_text</span><span class="method-args">(text)</span>
|
257
|
-
</a>
|
258
|
-
</div>
|
259
|
-
|
260
|
-
<div class="method-description">
|
261
|
-
<p><a class="source-toggle" href="#"
|
262
|
-
onclick="toggleCode('M000120-source');return false;">[Source]</a></p>
|
263
|
-
<div class="method-source-code" id="M000120-source">
|
264
|
-
<pre>
|
265
|
-
<span class="ruby-comment cmt"># File erubis/engine/eruby.rb, line 25</span>
|
266
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
|
267
|
-
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/['\\]/</span>, <span class="ruby-value str">'\\\\\&'</span>) <span class="ruby-comment cmt"># "'" => "\\'", '\\' => '\\\\'</span>
|
268
|
-
<span class="ruby-keyword kw">end</span>
|
269
|
-
</pre>
|
270
|
-
</div>
|
271
|
-
</div>
|
272
|
-
</div>
|
273
|
-
|
274
|
-
<div id="method-M000121" class="method-detail">
|
275
|
-
<a name="M000121"></a>
|
276
|
-
|
277
|
-
<div class="method-heading">
|
278
|
-
<a href="#M000121" class="method-signature">
|
279
|
-
<span class="method-name">escaped_expr</span><span class="method-args">(code)</span>
|
280
|
-
</a>
|
281
|
-
</div>
|
282
|
-
|
283
|
-
<div class="method-description">
|
284
|
-
<p><a class="source-toggle" href="#"
|
285
|
-
onclick="toggleCode('M000121-source');return false;">[Source]</a></p>
|
286
|
-
<div class="method-source-code" id="M000121-source">
|
287
|
-
<pre>
|
288
|
-
<span class="ruby-comment cmt"># File erubis/engine/eruby.rb, line 29</span>
|
289
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>)
|
290
|
-
<span class="ruby-ivar">@escape</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">"Erubis::XmlHelper.escape_xml"</span>
|
291
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-node">"#{@escape}(#{code})"</span>
|
292
|
-
<span class="ruby-keyword kw">end</span>
|
293
|
-
</pre>
|
294
|
-
</div>
|
295
|
-
</div>
|
296
|
-
</div>
|
297
|
-
|
298
|
-
|
299
|
-
</div>
|
300
117
|
|
301
118
|
|
302
119
|
</div>
|
@@ -98,7 +98,7 @@ this is language-indenedent.
|
|
98
98
|
<h3 class="section-bar">Methods</h3>
|
99
99
|
|
100
100
|
<div class="name-list">
|
101
|
-
<a href="#
|
101
|
+
<a href="#M000085">add_expr</a>
|
102
102
|
</div>
|
103
103
|
</div>
|
104
104
|
|
@@ -120,29 +120,27 @@ this is language-indenedent.
|
|
120
120
|
<div id="methods">
|
121
121
|
<h3 class="section-bar">Public Instance methods</h3>
|
122
122
|
|
123
|
-
<div id="method-
|
124
|
-
<a name="
|
123
|
+
<div id="method-M000085" class="method-detail">
|
124
|
+
<a name="M000085"></a>
|
125
125
|
|
126
126
|
<div class="method-heading">
|
127
|
-
<a href="#
|
127
|
+
<a href="#M000085" class="method-signature">
|
128
128
|
<span class="method-name">add_expr</span><span class="method-args">(src, code, indicator)</span>
|
129
129
|
</a>
|
130
130
|
</div>
|
131
131
|
|
132
132
|
<div class="method-description">
|
133
133
|
<p><a class="source-toggle" href="#"
|
134
|
-
onclick="toggleCode('
|
135
|
-
<div class="method-source-code" id="
|
134
|
+
onclick="toggleCode('M000085-source');return false;">[Source]</a></p>
|
135
|
+
<div class="method-source-code" id="M000085-source">
|
136
136
|
<pre>
|
137
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
137
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 38</span>
|
138
138
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">indicator</span>)
|
139
139
|
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">indicator</span>
|
140
140
|
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'='</span>
|
141
|
-
<span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
142
|
-
<span class="ruby-comment cmt">#add_expr_literal(src, code)</span>
|
141
|
+
<span class="ruby-ivar">@escape</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
143
142
|
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'=='</span>
|
144
|
-
<span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
145
|
-
<span class="ruby-comment cmt">#add_expr_escaped(src, code)</span>
|
143
|
+
<span class="ruby-ivar">@escape</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
146
144
|
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'==='</span>
|
147
145
|
<span class="ruby-identifier">add_expr_debug</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
148
146
|
<span class="ruby-keyword kw">end</span>
|
@@ -65,8 +65,8 @@
|
|
65
65
|
<tr class="top-aligned-row">
|
66
66
|
<td><strong>Parent:</strong></td>
|
67
67
|
<td>
|
68
|
-
<a href="Engine.html">
|
69
|
-
Engine
|
68
|
+
<a href="Basic/Engine.html">
|
69
|
+
Basic::Engine
|
70
70
|
</a>
|
71
71
|
</td>
|
72
72
|
</tr>
|
@@ -90,292 +90,29 @@ engine for Scheme
|
|
90
90
|
|
91
91
|
</div>
|
92
92
|
|
93
|
-
<div id="method-list">
|
94
|
-
<h3 class="section-bar">Methods</h3>
|
95
|
-
|
96
|
-
<div class="name-list">
|
97
|
-
<a href="#M000135">add_expr_debug</a>
|
98
|
-
<a href="#M000134">add_expr_escaped</a>
|
99
|
-
<a href="#M000133">add_expr_literal</a>
|
100
|
-
<a href="#M000136">add_postamble</a>
|
101
|
-
<a href="#M000128">add_preamble</a>
|
102
|
-
<a href="#M000132">add_stmt</a>
|
103
|
-
<a href="#M000131">add_text</a>
|
104
|
-
<a href="#M000129">escape_text</a>
|
105
|
-
<a href="#M000130">escaped_expr</a>
|
106
|
-
<a href="#M000127">new</a>
|
107
|
-
</div>
|
108
|
-
</div>
|
109
93
|
|
110
94
|
</div>
|
111
95
|
|
112
96
|
|
113
97
|
<!-- if includes -->
|
98
|
+
<div id="includes">
|
99
|
+
<h3 class="section-bar">Included Modules</h3>
|
114
100
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
<!-- if method_list -->
|
125
|
-
<div id="methods">
|
126
|
-
<h3 class="section-bar">Public Class methods</h3>
|
127
|
-
|
128
|
-
<div id="method-M000127" class="method-detail">
|
129
|
-
<a name="M000127"></a>
|
130
|
-
|
131
|
-
<div class="method-heading">
|
132
|
-
<a href="#M000127" class="method-signature">
|
133
|
-
<span class="method-name">new</span><span class="method-args">(input, properties={})</span>
|
134
|
-
</a>
|
135
|
-
</div>
|
136
|
-
|
137
|
-
<div class="method-description">
|
138
|
-
<p><a class="source-toggle" href="#"
|
139
|
-
onclick="toggleCode('M000127-source');return false;">[Source]</a></p>
|
140
|
-
<div class="method-source-code" id="M000127-source">
|
141
|
-
<pre>
|
142
|
-
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 25</span>
|
143
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">properties</span>={})
|
144
|
-
<span class="ruby-ivar">@func</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:func</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'_add'</span> <span class="ruby-comment cmt"># or 'display'</span>
|
145
|
-
<span class="ruby-keyword kw">super</span>
|
146
|
-
<span class="ruby-keyword kw">end</span>
|
147
|
-
</pre>
|
148
|
-
</div>
|
149
|
-
</div>
|
150
|
-
</div>
|
151
|
-
|
152
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
153
|
-
|
154
|
-
<div id="method-M000135" class="method-detail">
|
155
|
-
<a name="M000135"></a>
|
156
|
-
|
157
|
-
<div class="method-heading">
|
158
|
-
<a href="#M000135" class="method-signature">
|
159
|
-
<span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
|
160
|
-
</a>
|
161
|
-
</div>
|
162
|
-
|
163
|
-
<div class="method-description">
|
164
|
-
<p><a class="source-toggle" href="#"
|
165
|
-
onclick="toggleCode('M000135-source');return false;">[Source]</a></p>
|
166
|
-
<div class="method-source-code" id="M000135-source">
|
167
|
-
<pre>
|
168
|
-
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 72</span>
|
169
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_debug</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
170
|
-
<span class="ruby-identifier">s</span> = (<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">code</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\"/</span>, <span class="ruby-value str">'\\"'</span>)
|
171
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"(display \"*** debug: #{s}=\")(display #{code.strip})(display \"\\n\")"</span>
|
172
|
-
<span class="ruby-keyword kw">end</span>
|
173
|
-
</pre>
|
174
|
-
</div>
|
175
|
-
</div>
|
176
|
-
</div>
|
177
|
-
|
178
|
-
<div id="method-M000134" class="method-detail">
|
179
|
-
<a name="M000134"></a>
|
180
|
-
|
181
|
-
<div class="method-heading">
|
182
|
-
<a href="#M000134" class="method-signature">
|
183
|
-
<span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
|
184
|
-
</a>
|
185
|
-
</div>
|
186
|
-
|
187
|
-
<div class="method-description">
|
188
|
-
<p><a class="source-toggle" href="#"
|
189
|
-
onclick="toggleCode('M000134-source');return false;">[Source]</a></p>
|
190
|
-
<div class="method-source-code" id="M000134-source">
|
191
|
-
<pre>
|
192
|
-
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 68</span>
|
193
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
194
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"(#{@func} "</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>) <span class="ruby-operator"><<</span> <span class="ruby-value str">')'</span>
|
195
|
-
<span class="ruby-keyword kw">end</span>
|
196
|
-
</pre>
|
197
|
-
</div>
|
198
|
-
</div>
|
199
|
-
</div>
|
200
|
-
|
201
|
-
<div id="method-M000133" class="method-detail">
|
202
|
-
<a name="M000133"></a>
|
203
|
-
|
204
|
-
<div class="method-heading">
|
205
|
-
<a href="#M000133" class="method-signature">
|
206
|
-
<span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
|
207
|
-
</a>
|
208
|
-
</div>
|
209
|
-
|
210
|
-
<div class="method-description">
|
211
|
-
<p><a class="source-toggle" href="#"
|
212
|
-
onclick="toggleCode('M000133-source');return false;">[Source]</a></p>
|
213
|
-
<div class="method-source-code" id="M000133-source">
|
214
|
-
<pre>
|
215
|
-
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 64</span>
|
216
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
217
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"(#{@func} "</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">')'</span>
|
218
|
-
<span class="ruby-keyword kw">end</span>
|
219
|
-
</pre>
|
220
|
-
</div>
|
221
|
-
</div>
|
222
|
-
</div>
|
223
|
-
|
224
|
-
<div id="method-M000136" class="method-detail">
|
225
|
-
<a name="M000136"></a>
|
226
|
-
|
227
|
-
<div class="method-heading">
|
228
|
-
<a href="#M000136" class="method-signature">
|
229
|
-
<span class="method-name">add_postamble</span><span class="method-args">(src)</span>
|
230
|
-
</a>
|
231
|
-
</div>
|
232
|
-
|
233
|
-
<div class="method-description">
|
234
|
-
<p><a class="source-toggle" href="#"
|
235
|
-
onclick="toggleCode('M000136-source');return false;">[Source]</a></p>
|
236
|
-
<div class="method-source-code" id="M000136-source">
|
237
|
-
<pre>
|
238
|
-
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 77</span>
|
239
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
|
240
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@func</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'_add'</span>
|
241
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"\n"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
|
242
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">" (reverse _buf))\n"</span>
|
243
|
-
<span class="ruby-keyword kw">end</span>
|
244
|
-
</pre>
|
245
|
-
</div>
|
246
|
-
</div>
|
247
|
-
</div>
|
248
|
-
|
249
|
-
<div id="method-M000128" class="method-detail">
|
250
|
-
<a name="M000128"></a>
|
251
|
-
|
252
|
-
<div class="method-heading">
|
253
|
-
<a href="#M000128" class="method-signature">
|
254
|
-
<span class="method-name">add_preamble</span><span class="method-args">(src)</span>
|
255
|
-
</a>
|
256
|
-
</div>
|
257
|
-
|
258
|
-
<div class="method-description">
|
259
|
-
<p><a class="source-toggle" href="#"
|
260
|
-
onclick="toggleCode('M000128-source');return false;">[Source]</a></p>
|
261
|
-
<div class="method-source-code" id="M000128-source">
|
262
|
-
<pre>
|
263
|
-
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 30</span>
|
264
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
|
265
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@func</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'_add'</span>
|
266
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"(let ((_buf '())) "</span> <span class="ruby-operator">+</span> \
|
267
|
-
<span class="ruby-value str">"(define (_add x) (set! _buf (cons x _buf))) "</span>
|
268
|
-
<span class="ruby-comment cmt">#src << "(let* ((_buf '())" + # " (_add (lambda (x) (set! _buf (cons x _buf))))) "</span>
|
269
|
-
<span class="ruby-keyword kw">end</span>
|
270
|
-
</pre>
|
271
|
-
</div>
|
272
|
-
</div>
|
273
|
-
</div>
|
274
|
-
|
275
|
-
<div id="method-M000132" class="method-detail">
|
276
|
-
<a name="M000132"></a>
|
277
|
-
|
278
|
-
<div class="method-heading">
|
279
|
-
<a href="#M000132" class="method-signature">
|
280
|
-
<span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
|
281
|
-
</a>
|
282
|
-
</div>
|
283
|
-
|
284
|
-
<div class="method-description">
|
285
|
-
<p><a class="source-toggle" href="#"
|
286
|
-
onclick="toggleCode('M000132-source');return false;">[Source]</a></p>
|
287
|
-
<div class="method-source-code" id="M000132-source">
|
288
|
-
<pre>
|
289
|
-
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 60</span>
|
290
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
291
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">code</span>
|
292
|
-
<span class="ruby-keyword kw">end</span>
|
293
|
-
</pre>
|
294
|
-
</div>
|
295
|
-
</div>
|
101
|
+
<div id="includes-list">
|
102
|
+
<span class="include-name"><a href="SchemeGenerator.html">SchemeGenerator</a></span>
|
296
103
|
</div>
|
104
|
+
</div>
|
297
105
|
|
298
|
-
|
299
|
-
<a name="M000131"></a>
|
106
|
+
<div id="section">
|
300
107
|
|
301
|
-
<div class="method-heading">
|
302
|
-
<a href="#M000131" class="method-signature">
|
303
|
-
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
|
304
|
-
</a>
|
305
|
-
</div>
|
306
|
-
|
307
|
-
<div class="method-description">
|
308
|
-
<p><a class="source-toggle" href="#"
|
309
|
-
onclick="toggleCode('M000131-source');return false;">[Source]</a></p>
|
310
|
-
<div class="method-source-code" id="M000131-source">
|
311
|
-
<pre>
|
312
|
-
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 49</span>
|
313
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
|
314
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
|
315
|
-
<span class="ruby-identifier">t</span> = <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
|
316
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">t</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
|
317
|
-
<span class="ruby-identifier">t</span>[<span class="ruby-value">-1</span>, <span class="ruby-value">1</span>] = <span class="ruby-value str">''</span>
|
318
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"(#{@func} \""</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">t</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"\\n\")\n"</span>
|
319
|
-
<span class="ruby-keyword kw">else</span>
|
320
|
-
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"(#{@func} \""</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">t</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'")'</span>
|
321
|
-
<span class="ruby-keyword kw">end</span>
|
322
|
-
<span class="ruby-keyword kw">end</span>
|
323
|
-
</pre>
|
324
|
-
</div>
|
325
|
-
</div>
|
326
|
-
</div>
|
327
108
|
|
328
|
-
<div id="method-M000129" class="method-detail">
|
329
|
-
<a name="M000129"></a>
|
330
109
|
|
331
|
-
<div class="method-heading">
|
332
|
-
<a href="#M000129" class="method-signature">
|
333
|
-
<span class="method-name">escape_text</span><span class="method-args">(text)</span>
|
334
|
-
</a>
|
335
|
-
</div>
|
336
|
-
|
337
|
-
<div class="method-description">
|
338
|
-
<p><a class="source-toggle" href="#"
|
339
|
-
onclick="toggleCode('M000129-source');return false;">[Source]</a></p>
|
340
|
-
<div class="method-source-code" id="M000129-source">
|
341
|
-
<pre>
|
342
|
-
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 38</span>
|
343
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
|
344
|
-
<span class="ruby-ivar">@table_</span> <span class="ruby-operator">||=</span> { <span class="ruby-value str">'"'</span>=<span class="ruby-operator">></span><span class="ruby-value str">'\\"'</span>, <span class="ruby-value str">'\\'</span>=<span class="ruby-operator">></span><span class="ruby-value str">'\\\\'</span> }
|
345
|
-
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/["\\]/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@table_</span>[<span class="ruby-identifier">m</span>] }
|
346
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">text</span>
|
347
|
-
<span class="ruby-keyword kw">end</span>
|
348
|
-
</pre>
|
349
|
-
</div>
|
350
|
-
</div>
|
351
|
-
</div>
|
352
110
|
|
353
|
-
<div id="method-M000130" class="method-detail">
|
354
|
-
<a name="M000130"></a>
|
355
111
|
|
356
|
-
<div class="method-heading">
|
357
|
-
<a href="#M000130" class="method-signature">
|
358
|
-
<span class="method-name">escaped_expr</span><span class="method-args">(code)</span>
|
359
|
-
</a>
|
360
|
-
</div>
|
361
112
|
|
362
|
-
<div class="method-description">
|
363
|
-
<p><a class="source-toggle" href="#"
|
364
|
-
onclick="toggleCode('M000130-source');return false;">[Source]</a></p>
|
365
|
-
<div class="method-source-code" id="M000130-source">
|
366
|
-
<pre>
|
367
|
-
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 44</span>
|
368
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>)
|
369
|
-
<span class="ruby-ivar">@escape</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'escape'</span>
|
370
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-node">"(#{@escape} #{code.strip})"</span>
|
371
|
-
<span class="ruby-keyword kw">end</span>
|
372
|
-
</pre>
|
373
|
-
</div>
|
374
|
-
</div>
|
375
|
-
</div>
|
376
113
|
|
377
114
|
|
378
|
-
|
115
|
+
<!-- if method_list -->
|
379
116
|
|
380
117
|
|
381
118
|
</div>
|