erubis 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +55 -2
- data/README.txt +1 -1
- data/benchmark/bench.rb +1 -1
- data/bin/erubis +1 -1
- data/contrib/erubis +57 -34
- data/contrib/inline-require +1 -1
- data/doc-api/classes/Erubis.html +6 -1
- data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +1 -1
- data/doc-api/classes/Erubis/Evaluator.html +3 -3
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +2 -2
- data/doc-api/classes/Erubis/InterpolationEnhancer.html +5 -5
- data/doc-api/classes/Erubis/JavascriptGenerator.html +16 -11
- data/doc-api/classes/Erubis/PI/Ejavascript.html +1 -1
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +22 -18
- data/doc-api/classes/Erubis/RubyEvaluator.html +4 -4
- data/doc-api/created.rid +1 -1
- data/doc-api/files/README_txt.html +2 -2
- data/doc-api/files/erubis/context_rb.html +1 -1
- data/doc-api/files/erubis/converter_rb.html +1 -1
- data/doc-api/files/erubis/engine/ec_rb.html +1 -1
- data/doc-api/files/erubis/engine/ejava_rb.html +1 -1
- data/doc-api/files/erubis/engine/ejavascript_rb.html +2 -2
- data/doc-api/files/erubis/engine/enhanced_rb.html +1 -1
- data/doc-api/files/erubis/engine/eperl_rb.html +1 -1
- data/doc-api/files/erubis/engine/ephp_rb.html +1 -1
- data/doc-api/files/erubis/engine/eruby_rb.html +1 -1
- data/doc-api/files/erubis/engine/escheme_rb.html +1 -1
- data/doc-api/files/erubis/engine/optimized_rb.html +1 -1
- data/doc-api/files/erubis/engine_rb.html +1 -1
- data/doc-api/files/erubis/enhancer_rb.html +2 -2
- data/doc-api/files/erubis/error_rb.html +1 -1
- data/doc-api/files/erubis/evaluator_rb.html +2 -2
- data/doc-api/files/erubis/generator_rb.html +1 -1
- data/doc-api/files/erubis/helper_rb.html +1 -1
- data/doc-api/files/erubis/helpers/rails_helper_rb.html +1 -1
- data/doc-api/files/erubis/local-setting_rb.html +1 -1
- data/doc-api/files/erubis/main_rb.html +1 -1
- data/doc-api/files/erubis/tiny_rb.html +1 -1
- data/doc-api/files/erubis_rb.html +1 -1
- data/doc/users-guide.html +126 -14
- data/lib/erubis.rb +2 -2
- data/lib/erubis/context.rb +1 -1
- data/lib/erubis/converter.rb +1 -1
- data/lib/erubis/engine.rb +1 -1
- data/lib/erubis/engine/ec.rb +1 -1
- data/lib/erubis/engine/ejava.rb +1 -1
- data/lib/erubis/engine/ejavascript.rb +9 -3
- data/lib/erubis/engine/enhanced.rb +1 -1
- data/lib/erubis/engine/eperl.rb +1 -1
- data/lib/erubis/engine/ephp.rb +1 -1
- data/lib/erubis/engine/eruby.rb +1 -1
- data/lib/erubis/engine/escheme.rb +1 -1
- data/lib/erubis/engine/optimized.rb +1 -1
- data/lib/erubis/enhancer.rb +23 -8
- data/lib/erubis/error.rb +1 -1
- data/lib/erubis/evaluator.rb +5 -3
- data/lib/erubis/generator.rb +1 -1
- data/lib/erubis/helper.rb +1 -1
- data/lib/erubis/helpers/rails_helper.rb +1 -1
- data/lib/erubis/local-setting.rb +1 -1
- data/lib/erubis/main.rb +1 -1
- data/lib/erubis/tiny.rb +1 -1
- data/test/assert-text-equal.rb +1 -1
- data/test/data/users-guide/main_program1.rb +8 -0
- data/test/data/users-guide/main_program1.result +6 -0
- data/test/data/users-guide/main_program2.rb +8 -0
- data/test/data/users-guide/main_program2.result +6 -0
- data/test/data/users-guide/stderr.log +3 -0
- data/test/data/users-guide/template1.rhtml +4 -0
- data/test/data/users-guide/template2.rhtml +4 -0
- data/test/test-engines.rb +29 -4
- data/test/test-enhancers.rb +4 -4
- data/test/test-erubis.rb +17 -2
- data/test/test-main.rb +2 -2
- data/test/test-users-guide.rb +1 -1
- data/test/test.rb +1 -1
- data/test/testutil.rb +1 -1
- metadata +9 -2
@@ -130,7 +130,7 @@ this is only for <a href="Eruby.html">Eruby</a>.
|
|
130
130
|
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
131
131
|
<div class="method-source-code" id="M000020-source">
|
132
132
|
<pre>
|
133
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
133
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 654</span>
|
134
134
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_add_text_to_str</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">text</span>)
|
135
135
|
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">text</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
|
136
136
|
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/['\#\\]/</span>, <span class="ruby-value str">'\\\\\&'</span>)
|
@@ -155,7 +155,7 @@ this is only for <a href="Eruby.html">Eruby</a>.
|
|
155
155
|
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
156
156
|
<div class="method-source-code" id="M000021-source">
|
157
157
|
<pre>
|
158
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
158
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 660</span>
|
159
159
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">code</span>)
|
160
160
|
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"\#{#{escaped_expr(code)}}"</span>
|
161
161
|
<span class="ruby-keyword kw">end</span>
|
@@ -178,7 +178,7 @@ this is only for <a href="Eruby.html">Eruby</a>.
|
|
178
178
|
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
179
179
|
<div class="method-source-code" id="M000022-source">
|
180
180
|
<pre>
|
181
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
181
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 664</span>
|
182
182
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">code</span>)
|
183
183
|
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"\#{#{code}}"</span>
|
184
184
|
<span class="ruby-keyword kw">end</span>
|
@@ -201,7 +201,7 @@ this is only for <a href="Eruby.html">Eruby</a>.
|
|
201
201
|
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
202
202
|
<div class="method-source-code" id="M000019-source">
|
203
203
|
<pre>
|
204
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
204
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 643</span>
|
205
205
|
<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>)
|
206
206
|
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">text</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
|
207
207
|
<span class="ruby-comment cmt">#src << " _buf << %Q`" << text << "`;"</span>
|
@@ -231,7 +231,7 @@ this is only for <a href="Eruby.html">Eruby</a>.
|
|
231
231
|
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
232
232
|
<div class="method-source-code" id="M000018-source">
|
233
233
|
<pre>
|
234
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
234
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 590</span>
|
235
235
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_input</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">input</span>)
|
236
236
|
<span class="ruby-identifier">pat</span> = <span class="ruby-ivar">@pattern</span>
|
237
237
|
<span class="ruby-identifier">regexp</span> = <span class="ruby-identifier">pat</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">pat</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'<% %>'</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Basic</span><span class="ruby-operator">::</span><span class="ruby-constant">Converter</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_REGEXP</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">pattern_regexp</span>(<span class="ruby-identifier">pat</span>)
|
@@ -132,7 +132,7 @@
|
|
132
132
|
onclick="toggleCode('M000146-source');return false;">[Source]</a></p>
|
133
133
|
<div class="method-source-code" id="M000146-source">
|
134
134
|
<pre>
|
135
|
-
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line
|
135
|
+
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 73</span>
|
136
136
|
<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>)
|
137
137
|
<span class="ruby-identifier">add_indent</span>(<span class="ruby-identifier">src</span>, <span class="ruby-ivar">@indent</span>)
|
138
138
|
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
|
@@ -157,7 +157,7 @@
|
|
157
157
|
onclick="toggleCode('M000145-source');return false;">[Source]</a></p>
|
158
158
|
<div class="method-source-code" id="M000145-source">
|
159
159
|
<pre>
|
160
|
-
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line
|
160
|
+
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 69</span>
|
161
161
|
<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>)
|
162
162
|
<span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>))
|
163
163
|
<span class="ruby-keyword kw">end</span>
|
@@ -180,7 +180,7 @@
|
|
180
180
|
onclick="toggleCode('M000144-source');return false;">[Source]</a></p>
|
181
181
|
<div class="method-source-code" id="M000144-source">
|
182
182
|
<pre>
|
183
|
-
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line
|
183
|
+
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 63</span>
|
184
184
|
<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>)
|
185
185
|
<span class="ruby-identifier">add_indent</span>(<span class="ruby-identifier">src</span>, <span class="ruby-ivar">@indent</span>)
|
186
186
|
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
|
@@ -205,7 +205,7 @@
|
|
205
205
|
onclick="toggleCode('M000141-source');return false;">[Source]</a></p>
|
206
206
|
<div class="method-source-code" id="M000141-source">
|
207
207
|
<pre>
|
208
|
-
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line
|
208
|
+
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 42</span>
|
209
209
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_indent</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">indent</span>)
|
210
210
|
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> (<span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">indent</span> <span class="ruby-operator">:</span> <span class="ruby-value str">' '</span>)
|
211
211
|
<span class="ruby-keyword kw">end</span>
|
@@ -228,10 +228,14 @@
|
|
228
228
|
onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
|
229
229
|
<div class="method-source-code" id="M000147-source">
|
230
230
|
<pre>
|
231
|
-
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line
|
231
|
+
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 79</span>
|
232
232
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
|
233
233
|
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"\n"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?;</span>
|
234
|
-
<span class="ruby-
|
234
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@docwrite</span>
|
235
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@indent</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'document.write('</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@buf</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">".join(\"\"));\n"</span>
|
236
|
+
<span class="ruby-keyword kw">else</span>
|
237
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@indent</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@buf</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">".join(\"\");\n"</span>
|
238
|
+
<span class="ruby-keyword kw">end</span>
|
235
239
|
<span class="ruby-keyword kw">end</span>
|
236
240
|
</pre>
|
237
241
|
</div>
|
@@ -252,7 +256,7 @@
|
|
252
256
|
onclick="toggleCode('M000139-source');return false;">[Source]</a></p>
|
253
257
|
<div class="method-source-code" id="M000139-source">
|
254
258
|
<pre>
|
255
|
-
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line
|
259
|
+
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 33</span>
|
256
260
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
|
257
261
|
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{@indent}var #{@buf} = [];"</span>
|
258
262
|
<span class="ruby-keyword kw">end</span>
|
@@ -275,7 +279,7 @@
|
|
275
279
|
onclick="toggleCode('M000143-source');return false;">[Source]</a></p>
|
276
280
|
<div class="method-source-code" id="M000143-source">
|
277
281
|
<pre>
|
278
|
-
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line
|
282
|
+
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 59</span>
|
279
283
|
<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>)
|
280
284
|
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">code</span>
|
281
285
|
<span class="ruby-keyword kw">end</span>
|
@@ -298,7 +302,7 @@
|
|
298
302
|
onclick="toggleCode('M000142-source');return false;">[Source]</a></p>
|
299
303
|
<div class="method-source-code" id="M000142-source">
|
300
304
|
<pre>
|
301
|
-
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line
|
305
|
+
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 46</span>
|
302
306
|
<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>)
|
303
307
|
<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>
|
304
308
|
<span class="ruby-identifier">add_indent</span>(<span class="ruby-identifier">src</span>, <span class="ruby-ivar">@indent</span>)
|
@@ -330,7 +334,7 @@
|
|
330
334
|
onclick="toggleCode('M000140-source');return false;">[Source]</a></p>
|
331
335
|
<div class="method-source-code" id="M000140-source">
|
332
336
|
<pre>
|
333
|
-
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line
|
337
|
+
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 37</span>
|
334
338
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
|
335
339
|
<span class="ruby-ivar">@@table_</span> <span class="ruby-operator">||=</span> { <span class="ruby-value str">"\r"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"\\r"</span>, <span class="ruby-value str">"\n"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"\\n\\\n"</span>, <span class="ruby-value str">"\t"</span>=<span class="ruby-operator">></span><span class="ruby-value str">"\\t"</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> }
|
336
340
|
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/[\r\n\t"\\]/</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>] } <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>
|
@@ -354,12 +358,13 @@
|
|
354
358
|
onclick="toggleCode('M000138-source');return false;">[Source]</a></p>
|
355
359
|
<div class="method-source-code" id="M000138-source">
|
356
360
|
<pre>
|
357
|
-
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line
|
361
|
+
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 25</span>
|
358
362
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
|
359
363
|
<span class="ruby-keyword kw">super</span>
|
360
364
|
<span class="ruby-ivar">@escapefunc</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'escape'</span>
|
361
365
|
<span class="ruby-ivar">@indent</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:indent</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>
|
362
366
|
<span class="ruby-ivar">@buf</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:out</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'_buf'</span>
|
367
|
+
<span class="ruby-ivar">@docwrite</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:docwrite</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">false</span> <span class="ruby-comment cmt"># '!= false' will be removed in the next release</span>
|
363
368
|
<span class="ruby-keyword kw">end</span>
|
364
369
|
</pre>
|
365
370
|
</div>
|
@@ -141,7 +141,7 @@ end
|
|
141
141
|
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
142
142
|
<div class="method-source-code" id="M000045-source">
|
143
143
|
<pre>
|
144
|
-
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line
|
144
|
+
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 112</span>
|
145
145
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_converter</span>(<span class="ruby-identifier">properties</span>={})
|
146
146
|
<span class="ruby-ivar">@pi</span> = <span class="ruby-value str">'js'</span>
|
147
147
|
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">properties</span>)
|
@@ -104,19 +104,6 @@ this is language-independent.
|
|
104
104
|
<div id="section">
|
105
105
|
|
106
106
|
|
107
|
-
<div id="constants-list">
|
108
|
-
<h3 class="section-bar">Constants</h3>
|
109
|
-
|
110
|
-
<div class="name-list">
|
111
|
-
<table summary="Constants">
|
112
|
-
<tr class="top-aligned-row context-row">
|
113
|
-
<td class="context-item-name">PERCENT_LINE_PATTERN</td>
|
114
|
-
<td>=</td>
|
115
|
-
<td class="context-item-value">/(.*?)^\%(.*?\r?\n)/m</td>
|
116
|
-
</tr>
|
117
|
-
</table>
|
118
|
-
</div>
|
119
|
-
</div>
|
120
107
|
|
121
108
|
|
122
109
|
|
@@ -141,17 +128,34 @@ this is language-independent.
|
|
141
128
|
onclick="toggleCode('M000157-source');return false;">[Source]</a></p>
|
142
129
|
<div class="method-source-code" id="M000157-source">
|
143
130
|
<pre>
|
144
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
131
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 446</span>
|
145
132
|
<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>)
|
146
|
-
<span class="ruby-identifier">
|
147
|
-
|
133
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
|
134
|
+
<span class="ruby-identifier">text2</span> = <span class="ruby-value str">''</span>
|
135
|
+
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/^\%(.*?\r?\n)/</span>) <span class="ruby-keyword kw">do</span>
|
136
|
+
<span class="ruby-identifier">line</span> = <span class="ruby-identifier">$1</span>
|
137
|
+
<span class="ruby-identifier">match</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
|
138
|
+
<span class="ruby-identifier">len</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>) <span class="ruby-operator">-</span> <span class="ruby-identifier">pos</span>
|
139
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-identifier">text</span>[<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">len</span>]
|
140
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
|
141
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text2</span>.<span class="ruby-identifier">empty?</span>
|
142
|
+
<span class="ruby-identifier">text2</span> = <span class="ruby-identifier">str</span>
|
143
|
+
<span class="ruby-keyword kw">else</span>
|
144
|
+
<span class="ruby-identifier">text2</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">str</span>
|
145
|
+
<span class="ruby-keyword kw">end</span>
|
148
146
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?%</span>
|
149
|
-
<span class="ruby-
|
147
|
+
<span class="ruby-identifier">text2</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">line</span>
|
150
148
|
<span class="ruby-keyword kw">else</span>
|
149
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text2</span>)
|
150
|
+
<span class="ruby-identifier">text2</span> = <span class="ruby-value str">''</span>
|
151
151
|
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">line</span>)
|
152
152
|
<span class="ruby-keyword kw">end</span>
|
153
153
|
<span class="ruby-keyword kw">end</span>
|
154
|
-
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier"
|
154
|
+
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier">pos</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$'</span> <span class="ruby-comment cmt"># or $' || text</span>
|
155
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text2</span>.<span class="ruby-identifier">empty?</span>
|
156
|
+
<span class="ruby-identifier">text2</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">rest</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rest</span>
|
157
|
+
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier">text2</span>
|
158
|
+
<span class="ruby-keyword kw">end</span>
|
155
159
|
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rest</span>)
|
156
160
|
<span class="ruby-keyword kw">end</span>
|
157
161
|
</pre>
|
@@ -135,7 +135,7 @@ define singleton method to it.
|
|
135
135
|
onclick="toggleCode('M000166-source');return false;">[Source]</a></p>
|
136
136
|
<div class="method-source-code" id="M000166-source">
|
137
137
|
<pre>
|
138
|
-
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line
|
138
|
+
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line 75</span>
|
139
139
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">def_method</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">filename</span>=<span class="ruby-keyword kw">nil</span>)
|
140
140
|
<span class="ruby-identifier">m</span> = <span class="ruby-identifier">object</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Module</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">:module_eval</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:instance_eval</span>
|
141
141
|
<span class="ruby-identifier">object</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">m</span>, <span class="ruby-node">"def #{method_name}; #{@src}; end"</span>, <span class="ruby-identifier">filename</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@filename</span> <span class="ruby-operator">||</span> <span class="ruby-value str">'(erubis)'</span>)
|
@@ -162,11 +162,11 @@ invoke context.instance_eval(@src)
|
|
162
162
|
onclick="toggleCode('M000165-source');return false;">[Source]</a></p>
|
163
163
|
<div class="method-source-code" id="M000165-source">
|
164
164
|
<pre>
|
165
|
-
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line
|
165
|
+
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line 66</span>
|
166
166
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">evaluate</span>(<span class="ruby-identifier">context</span>=<span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>)
|
167
167
|
<span class="ruby-identifier">context</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
|
168
168
|
<span class="ruby-comment cmt">#return context.instance_eval(@src, @filename || '(erubis)')</span>
|
169
|
-
<span class="ruby-ivar">@_proc</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">eval</span>(<span class="ruby-node">"proc { #{@src} }"</span>, <span class="ruby-constant">
|
169
|
+
<span class="ruby-ivar">@_proc</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">eval</span>(<span class="ruby-node">"proc { #{@src} }"</span>, <span class="ruby-constant">Erubis</span><span class="ruby-operator">::</span><span class="ruby-constant">EMPTY_BINDING</span>, <span class="ruby-ivar">@filename</span> <span class="ruby-operator">||</span> <span class="ruby-value str">'(erubis)'</span>)
|
170
170
|
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&</span><span class="ruby-ivar">@_proc</span>)
|
171
171
|
<span class="ruby-keyword kw">end</span>
|
172
172
|
</pre>
|
@@ -191,7 +191,7 @@ eval(@src) with binding object
|
|
191
191
|
onclick="toggleCode('M000164-source');return false;">[Source]</a></p>
|
192
192
|
<div class="method-source-code" id="M000164-source">
|
193
193
|
<pre>
|
194
|
-
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line
|
194
|
+
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line 54</span>
|
195
195
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">result</span>(<span class="ruby-identifier">_binding_or_hash</span>=<span class="ruby-constant">TOPLEVEL_BINDING</span>)
|
196
196
|
<span class="ruby-identifier">_arg</span> = <span class="ruby-identifier">_binding_or_hash</span>
|
197
197
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">_arg</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
|
data/doc-api/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Tue, 25 Sep 2007 07:56:39 +0900
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Tue Sep 25 07:56:38 +0900 2007</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -71,7 +71,7 @@
|
|
71
71
|
<div id="description">
|
72
72
|
<h1>README</h1>
|
73
73
|
<table>
|
74
|
-
<tr><td valign="top">release:</td><td>2.4.
|
74
|
+
<tr><td valign="top">release:</td><td>2.4.1
|
75
75
|
|
76
76
|
</td></tr>
|
77
77
|
<tr><td valign="top">copyright:</td><td>copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Mon Sep 24 23:04:21 +0900 2007</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -70,7 +70,7 @@
|
|
70
70
|
|
71
71
|
<div id="description">
|
72
72
|
<p>
|
73
|
-
$Rev:
|
73
|
+
$Rev: 95 $ $Release: 2.4.1 $ copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
74
74
|
</p>
|
75
75
|
|
76
76
|
</div>
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Mon Sep 10 16:23:59 +0900 2007</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -70,7 +70,7 @@
|
|
70
70
|
|
71
71
|
<div id="description">
|
72
72
|
<p>
|
73
|
-
$Rev:
|
73
|
+
$Rev: 93 $ $Release: 2.4.1 $ copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
74
74
|
</p>
|
75
75
|
|
76
76
|
</div>
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Tue Sep 18 17:02:49 +0900 2007</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -70,7 +70,7 @@
|
|
70
70
|
|
71
71
|
<div id="description">
|
72
72
|
<p>
|
73
|
-
$Rev:
|
73
|
+
$Rev: 94 $ $Release: 2.4.1 $ copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
74
74
|
</p>
|
75
75
|
|
76
76
|
</div>
|