erubis 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +120 -3
- data/README.txt +1 -1
- data/benchmark/Makefile +6 -0
- data/benchmark/bench.rb +306 -0
- data/benchmark/{erubybench.yaml → bench_context.yaml} +20 -20
- data/benchmark/templates/_footer.html +4 -0
- data/benchmark/{erubybench.rhtml → templates/_header.html} +1 -34
- data/benchmark/templates/bench_erb.rhtml +29 -0
- data/benchmark/templates/bench_erubis.rhtml +29 -0
- data/benchmark/templates/bench_eruby.rhtml +29 -0
- data/bin/erubis +2 -2
- data/contrib/erubis +3 -3114
- data/contrib/erubis-run.rb +132 -0
- data/contrib/inline-require +1 -1
- data/doc-api/classes/{ERB.html → ActionView/Base/ERB.html} +3 -3
- data/doc-api/classes/Erubis.html +8 -1
- data/doc-api/classes/Erubis/ArrayEnhancer.html +12 -12
- data/doc-api/classes/Erubis/Basic/Converter.html +24 -24
- data/doc-api/classes/Erubis/BiPatternEnhancer.html +14 -14
- data/doc-api/classes/Erubis/CGenerator.html +60 -60
- data/doc-api/classes/Erubis/Context.html +42 -42
- data/doc-api/classes/Erubis/Converter.html +27 -27
- data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +150 -0
- data/doc-api/classes/Erubis/DeleteIndentEruby.html +120 -0
- data/doc-api/classes/Erubis/Engine.html +31 -31
- data/doc-api/classes/Erubis/ErboutEnhancer.html +175 -0
- data/doc-api/classes/Erubis/ErboutEruby.html +120 -0
- data/doc-api/classes/Erubis/Eruby.html +5 -0
- data/doc-api/classes/Erubis/EscapeEnhancer.html +6 -6
- data/doc-api/classes/Erubis/Evaluator.html +19 -19
- data/doc-api/classes/Erubis/FastEruby.html +131 -0
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +14 -14
- data/doc-api/classes/Erubis/Helpers/RailsHelper.html +49 -45
- data/doc-api/classes/Erubis/InterpolationEnhancer.html +304 -0
- data/doc-api/classes/Erubis/InterpolationEruby.html +120 -0
- data/doc-api/classes/Erubis/JavaGenerator.html +54 -54
- data/doc-api/classes/Erubis/JavascriptGenerator.html +60 -60
- data/doc-api/classes/Erubis/Main.html +35 -27
- data/doc-api/classes/Erubis/NoCodeEnhancer.html +5 -5
- data/doc-api/classes/Erubis/NoTextEnhancer.html +7 -7
- data/doc-api/classes/Erubis/OptimizedEruby.html +6 -6
- data/doc-api/classes/Erubis/OptimizedGenerator.html +72 -72
- data/doc-api/classes/Erubis/OptimizedXmlEruby.html +6 -6
- data/doc-api/classes/Erubis/PI/Converter.html +18 -18
- data/doc-api/classes/Erubis/PI/Ec.html +6 -6
- data/doc-api/classes/Erubis/PI/Ejava.html +6 -6
- data/doc-api/classes/Erubis/PI/Ejavascript.html +6 -6
- data/doc-api/classes/Erubis/PI/Eperl.html +6 -6
- data/doc-api/classes/Erubis/PI/Ephp.html +6 -6
- data/doc-api/classes/Erubis/PI/Eruby.html +7 -7
- data/doc-api/classes/Erubis/PI/Escheme.html +6 -6
- data/doc-api/classes/Erubis/PI/TinyEruby.html +24 -24
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +8 -8
- data/doc-api/classes/Erubis/PerlGenerator.html +54 -54
- data/doc-api/classes/Erubis/PhpGenerator.html +54 -54
- data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +20 -20
- data/doc-api/classes/Erubis/PrintOutEnhancer.html +30 -30
- data/doc-api/classes/Erubis/RubyEvaluator.html +12 -12
- data/doc-api/classes/Erubis/RubyGenerator.html +48 -48
- data/doc-api/classes/Erubis/SchemeGenerator.html +60 -60
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +8 -8
- data/doc-api/classes/Erubis/StdoutEnhancer.html +12 -12
- data/doc-api/classes/Erubis/StringBufferEnhancer.html +12 -12
- data/doc-api/classes/Erubis/TinyEruby.html +24 -24
- data/doc-api/classes/Erubis/XmlHelper.html +14 -14
- data/doc-api/created.rid +1 -1
- data/doc-api/files/README_txt.html +4 -4
- data/doc-api/files/erubis/context_rb.html +2 -2
- data/doc-api/files/erubis/converter_rb.html +2 -2
- 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 +2 -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 +2 -2
- data/doc-api/files/erubis/enhancer_rb.html +2 -2
- data/doc-api/files/erubis/error_rb.html +2 -2
- data/doc-api/files/erubis/evaluator_rb.html +2 -2
- data/doc-api/files/erubis/generator_rb.html +2 -2
- data/doc-api/files/erubis/helper_rb.html +2 -2
- data/doc-api/files/erubis/helpers/rails_helper_rb.html +2 -2
- data/doc-api/files/erubis/local-setting_rb.html +2 -2
- 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 +1 -1
- data/doc-api/fr_class_index.html +8 -1
- data/doc-api/fr_method_index.html +166 -158
- data/doc/users-guide.html +623 -215
- data/lib/erubis.rb +2 -2
- data/lib/erubis/context.rb +2 -2
- data/lib/erubis/converter.rb +2 -2
- data/lib/erubis/engine.rb +3 -3
- data/lib/erubis/engine/ec.rb +2 -2
- data/lib/erubis/engine/ejava.rb +2 -2
- data/lib/erubis/engine/ejavascript.rb +2 -2
- data/lib/erubis/engine/enhanced.rb +17 -2
- data/lib/erubis/engine/eperl.rb +2 -2
- data/lib/erubis/engine/ephp.rb +2 -2
- data/lib/erubis/engine/eruby.rb +10 -2
- data/lib/erubis/engine/escheme.rb +2 -2
- data/lib/erubis/engine/optimized.rb +2 -2
- data/lib/erubis/enhancer.rb +134 -25
- data/lib/erubis/error.rb +2 -2
- data/lib/erubis/evaluator.rb +2 -2
- data/lib/erubis/generator.rb +2 -2
- data/lib/erubis/helper.rb +2 -2
- data/lib/erubis/helpers/rails_helper.rb +19 -75
- data/lib/erubis/local-setting.rb +2 -2
- data/lib/erubis/main.rb +63 -36
- data/lib/erubis/tiny.rb +2 -2
- data/test/assert-text-equal.rb +2 -2
- data/test/data/users-guide/Example.ejava +55 -0
- data/test/data/users-guide/array_example.result +9 -0
- data/test/data/users-guide/arraybuffer_example.result +9 -0
- data/test/data/users-guide/bipattern-example.rhtml +4 -0
- data/test/data/users-guide/bipattern_example.result +6 -0
- data/test/data/users-guide/context.rb +6 -0
- data/test/data/users-guide/context.yaml +8 -0
- data/test/data/users-guide/escape_example.result +9 -0
- data/test/data/users-guide/example.ec +27 -0
- data/test/data/users-guide/example.ejs +20 -0
- data/test/data/users-guide/example.eperl +18 -0
- data/test/data/users-guide/example.ephp +18 -0
- data/test/data/users-guide/example.eruby +6 -0
- data/test/data/users-guide/example.escheme +28 -0
- data/test/data/users-guide/example1.eruby +6 -0
- data/test/data/users-guide/example1.rb +16 -0
- data/test/data/users-guide/example1.result +16 -0
- data/test/data/users-guide/example10.rb +4 -0
- data/test/data/users-guide/example10.result +17 -0
- data/test/data/users-guide/example10.xhtml +14 -0
- data/test/data/users-guide/example10_x.result +17 -0
- data/test/data/users-guide/example11.php +20 -0
- data/test/data/users-guide/example11.result +23 -0
- data/test/data/users-guide/example11.rhtml +21 -0
- data/test/data/users-guide/example11_C.result +10 -0
- data/test/data/users-guide/example11_N.result +16 -0
- data/test/data/users-guide/example11_U.result +16 -0
- data/test/data/users-guide/example11_php.result +15 -0
- data/test/data/users-guide/example1_x.result +9 -0
- data/test/data/users-guide/example2.eruby +7 -0
- data/test/data/users-guide/example2.rb +10 -0
- data/test/data/users-guide/example2.result +27 -0
- data/test/data/users-guide/example2_trim.result +10 -0
- data/test/data/users-guide/example2_x.result +10 -0
- data/test/data/users-guide/example3.eruby +6 -0
- data/test/data/users-guide/example3.rb +10 -0
- data/test/data/users-guide/example31.result +22 -0
- data/test/data/users-guide/example32.result +4 -0
- data/test/data/users-guide/example3_e.result +8 -0
- data/test/data/users-guide/example4.eruby +3 -0
- data/test/data/users-guide/example4.rb +11 -0
- data/test/data/users-guide/example4.result +10 -0
- data/test/data/users-guide/example4_x.result +5 -0
- data/test/data/users-guide/example5.eruby +6 -0
- data/test/data/users-guide/example5.rb +16 -0
- data/test/data/users-guide/example5.result +7 -0
- data/test/data/users-guide/example6.rb +12 -0
- data/test/data/users-guide/example6.result +7 -0
- data/test/data/users-guide/example7.eruby +8 -0
- data/test/data/users-guide/example71.result +13 -0
- data/test/data/users-guide/example72.result +13 -0
- data/test/data/users-guide/example8.eruby +6 -0
- data/test/data/users-guide/example8_ruby.result +7 -0
- data/test/data/users-guide/example8_yaml.result +7 -0
- data/test/data/users-guide/example9.eruby +3 -0
- data/test/data/users-guide/example9.rb +8 -0
- data/test/data/users-guide/example9.result +9 -0
- data/test/data/users-guide/example91.result +5 -0
- data/test/data/users-guide/example92.result +4 -0
- data/test/data/users-guide/example_c.result +29 -0
- data/test/data/users-guide/example_java.result +56 -0
- data/test/data/users-guide/example_js.result +22 -0
- data/test/data/users-guide/example_perl.result +20 -0
- data/test/data/users-guide/example_php.result +19 -0
- data/test/data/users-guide/example_scheme.result +30 -0
- data/test/data/users-guide/example_scheme_display.result +29 -0
- data/test/data/users-guide/fasteruby.rb +11 -0
- data/test/data/users-guide/fasteruby.result +38 -0
- data/test/data/users-guide/fasteruby.rhtml +15 -0
- data/test/data/users-guide/headerfooter-example.eruby +9 -0
- data/test/data/users-guide/headerfooter-example2.rb +8 -0
- data/test/data/users-guide/headerfooter-example2.rhtml +10 -0
- data/test/data/users-guide/headerfooter_example.result +11 -0
- data/test/data/users-guide/headerfooter_example2.result +13 -0
- data/test/data/users-guide/interpolation_example.result +9 -0
- data/test/data/users-guide/nocode-example.eruby +14 -0
- data/test/data/users-guide/nocode-php.result +20 -0
- data/test/data/users-guide/nocode_example.result +15 -0
- data/test/data/users-guide/normal-eruby-test.eruby +9 -0
- data/test/data/users-guide/normal_eruby_test.result +11 -0
- data/test/data/users-guide/notext-example.eruby +14 -0
- data/test/data/users-guide/notext-example.php +19 -0
- data/test/data/users-guide/notext-php.result +20 -0
- data/test/data/users-guide/notext_example.result +16 -0
- data/test/data/users-guide/percentline-example.rhtml +4 -0
- data/test/data/users-guide/percentline_example.result +7 -0
- data/test/data/users-guide/printenable_example.result +4 -0
- data/test/data/users-guide/printenabled-example.eruby +3 -0
- data/test/data/users-guide/printenabled-example.rb +8 -0
- data/test/data/users-guide/printstatement_example.result +8 -0
- data/test/data/users-guide/simplify_example.result +9 -0
- data/test/data/users-guide/stdout_exmple.result +9 -0
- data/test/data/users-guide/stringbuffer_example.result +9 -0
- data/test/test-engines.rb +2 -2
- data/test/test-enhancers.rb +569 -0
- data/test/test-erubis.rb +3 -380
- data/test/test-main.rb +39 -15
- data/test/test-users-guide.rb +56 -0
- data/test/test.rb +4 -3
- data/test/testutil.rb +2 -2
- metadata +166 -57
- data/benchmark/erubybench-lib.rb +0 -189
- data/benchmark/erubybench.rb +0 -600
- data/bin/notext +0 -154
- data/test/test-notext.rb +0 -27
|
@@ -139,8 +139,8 @@ this is language-independent.
|
|
|
139
139
|
<h3 class="section-bar">Methods</h3>
|
|
140
140
|
|
|
141
141
|
<div class="name-list">
|
|
142
|
-
<a href="#
|
|
143
|
-
<a href="#
|
|
142
|
+
<a href="#M000087">add_text</a>
|
|
143
|
+
<a href="#M000088">convert</a>
|
|
144
144
|
</div>
|
|
145
145
|
</div>
|
|
146
146
|
|
|
@@ -193,21 +193,21 @@ this is language-independent.
|
|
|
193
193
|
<div id="methods">
|
|
194
194
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
195
195
|
|
|
196
|
-
<div id="method-
|
|
197
|
-
<a name="
|
|
196
|
+
<div id="method-M000087" class="method-detail">
|
|
197
|
+
<a name="M000087"></a>
|
|
198
198
|
|
|
199
199
|
<div class="method-heading">
|
|
200
|
-
<a href="#
|
|
200
|
+
<a href="#M000087" class="method-signature">
|
|
201
201
|
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
|
|
202
202
|
</a>
|
|
203
203
|
</div>
|
|
204
204
|
|
|
205
205
|
<div class="method-description">
|
|
206
206
|
<p><a class="source-toggle" href="#"
|
|
207
|
-
onclick="toggleCode('
|
|
208
|
-
<div class="method-source-code" id="
|
|
207
|
+
onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
|
|
208
|
+
<div class="method-source-code" id="M000087-source">
|
|
209
209
|
<pre>
|
|
210
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
|
210
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 522</span>
|
|
211
211
|
<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>)
|
|
212
212
|
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-constant">HEADER_FOOTER_PATTERN</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">txt</span>, <span class="ruby-identifier">lspace</span>, <span class="ruby-identifier">word</span>, <span class="ruby-identifier">content</span>, <span class="ruby-identifier">rspace</span><span class="ruby-operator">|</span>
|
|
213
213
|
<span class="ruby-identifier">flag_trim</span> = <span class="ruby-ivar">@trim</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">lspace</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">rspace</span>
|
|
@@ -225,21 +225,21 @@ this is language-independent.
|
|
|
225
225
|
</div>
|
|
226
226
|
</div>
|
|
227
227
|
|
|
228
|
-
<div id="method-
|
|
229
|
-
<a name="
|
|
228
|
+
<div id="method-M000088" class="method-detail">
|
|
229
|
+
<a name="M000088"></a>
|
|
230
230
|
|
|
231
231
|
<div class="method-heading">
|
|
232
|
-
<a href="#
|
|
232
|
+
<a href="#M000088" class="method-signature">
|
|
233
233
|
<span class="method-name">convert</span><span class="method-args">(input)</span>
|
|
234
234
|
</a>
|
|
235
235
|
</div>
|
|
236
236
|
|
|
237
237
|
<div class="method-description">
|
|
238
238
|
<p><a class="source-toggle" href="#"
|
|
239
|
-
onclick="toggleCode('
|
|
240
|
-
<div class="method-source-code" id="
|
|
239
|
+
onclick="toggleCode('M000088-source');return false;">[Source]</a></p>
|
|
240
|
+
<div class="method-source-code" id="M000088-source">
|
|
241
241
|
<pre>
|
|
242
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
|
242
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 537</span>
|
|
243
243
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
|
|
244
244
|
<span class="ruby-identifier">source</span> = <span class="ruby-keyword kw">super</span>
|
|
245
245
|
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@src</span> = <span class="ruby-node">"#{@header}#{source}#{@footer}"</span>
|
|
@@ -84,15 +84,15 @@ howto:
|
|
|
84
84
|
|
|
85
85
|
<pre>
|
|
86
86
|
require 'erubis/helpers/rails_helper'
|
|
87
|
-
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby
|
|
87
|
+
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby
|
|
88
88
|
#Erubis::Helpers::RailsHelper.init_properties = {}
|
|
89
|
-
#Erubis::Helpers::RailsHelper.show_src = false
|
|
89
|
+
#Erubis::Helpers::RailsHelper.show_src = false # set true for debugging
|
|
90
90
|
</pre>
|
|
91
91
|
</li>
|
|
92
92
|
<li>(optional) apply the patch for ‘action_view/base.rb‘
|
|
93
93
|
|
|
94
94
|
<pre>
|
|
95
|
-
$ cd /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.
|
|
95
|
+
$ cd /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/
|
|
96
96
|
$ sudo patch -p1 < /tmp/erubis_2.X.X/contrib/action_view_base_rb.patch
|
|
97
97
|
</pre>
|
|
98
98
|
</li>
|
|
@@ -116,12 +116,12 @@ debug.
|
|
|
116
116
|
<h3 class="section-bar">Methods</h3>
|
|
117
117
|
|
|
118
118
|
<div class="name-list">
|
|
119
|
-
<a href="#
|
|
120
|
-
<a href="#
|
|
121
|
-
<a href="#
|
|
122
|
-
<a href="#
|
|
123
|
-
<a href="#
|
|
124
|
-
<a href="#
|
|
119
|
+
<a href="#M000078">engine_class</a>
|
|
120
|
+
<a href="#M000079">engine_class=</a>
|
|
121
|
+
<a href="#M000080">init_properties</a>
|
|
122
|
+
<a href="#M000081">init_properties=</a>
|
|
123
|
+
<a href="#M000082">show_src</a>
|
|
124
|
+
<a href="#M000083">show_src=</a>
|
|
125
125
|
</div>
|
|
126
126
|
</div>
|
|
127
127
|
|
|
@@ -143,21 +143,25 @@ debug.
|
|
|
143
143
|
<div id="methods">
|
|
144
144
|
<h3 class="section-bar">Public Class methods</h3>
|
|
145
145
|
|
|
146
|
-
<div id="method-
|
|
147
|
-
<a name="
|
|
146
|
+
<div id="method-M000078" class="method-detail">
|
|
147
|
+
<a name="M000078"></a>
|
|
148
148
|
|
|
149
149
|
<div class="method-heading">
|
|
150
|
-
<a href="#
|
|
150
|
+
<a href="#M000078" class="method-signature">
|
|
151
151
|
<span class="method-name">engine_class</span><span class="method-args">()</span>
|
|
152
152
|
</a>
|
|
153
153
|
</div>
|
|
154
154
|
|
|
155
155
|
<div class="method-description">
|
|
156
|
+
<p>
|
|
157
|
+
@@<a href="RailsHelper.html#M000078">engine_class</a> = <a
|
|
158
|
+
href="../FastEruby.html">Erubis::FastEruby</a>
|
|
159
|
+
</p>
|
|
156
160
|
<p><a class="source-toggle" href="#"
|
|
157
|
-
onclick="toggleCode('
|
|
158
|
-
<div class="method-source-code" id="
|
|
161
|
+
onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
|
|
162
|
+
<div class="method-source-code" id="M000078-source">
|
|
159
163
|
<pre>
|
|
160
|
-
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line
|
|
164
|
+
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 51</span>
|
|
161
165
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">engine_class</span>
|
|
162
166
|
<span class="ruby-ivar">@@engine_class</span>
|
|
163
167
|
<span class="ruby-keyword kw">end</span>
|
|
@@ -166,21 +170,21 @@ debug.
|
|
|
166
170
|
</div>
|
|
167
171
|
</div>
|
|
168
172
|
|
|
169
|
-
<div id="method-
|
|
170
|
-
<a name="
|
|
173
|
+
<div id="method-M000079" class="method-detail">
|
|
174
|
+
<a name="M000079"></a>
|
|
171
175
|
|
|
172
176
|
<div class="method-heading">
|
|
173
|
-
<a href="#
|
|
177
|
+
<a href="#M000079" class="method-signature">
|
|
174
178
|
<span class="method-name">engine_class=</span><span class="method-args">(klass)</span>
|
|
175
179
|
</a>
|
|
176
180
|
</div>
|
|
177
181
|
|
|
178
182
|
<div class="method-description">
|
|
179
183
|
<p><a class="source-toggle" href="#"
|
|
180
|
-
onclick="toggleCode('
|
|
181
|
-
<div class="method-source-code" id="
|
|
184
|
+
onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
|
|
185
|
+
<div class="method-source-code" id="M000079-source">
|
|
182
186
|
<pre>
|
|
183
|
-
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line
|
|
187
|
+
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 55</span>
|
|
184
188
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">engine_class=</span>(<span class="ruby-identifier">klass</span>)
|
|
185
189
|
<span class="ruby-ivar">@@engine_class</span> = <span class="ruby-identifier">klass</span>
|
|
186
190
|
<span class="ruby-keyword kw">end</span>
|
|
@@ -189,21 +193,21 @@ debug.
|
|
|
189
193
|
</div>
|
|
190
194
|
</div>
|
|
191
195
|
|
|
192
|
-
<div id="method-
|
|
193
|
-
<a name="
|
|
196
|
+
<div id="method-M000080" class="method-detail">
|
|
197
|
+
<a name="M000080"></a>
|
|
194
198
|
|
|
195
199
|
<div class="method-heading">
|
|
196
|
-
<a href="#
|
|
200
|
+
<a href="#M000080" class="method-signature">
|
|
197
201
|
<span class="method-name">init_properties</span><span class="method-args">()</span>
|
|
198
202
|
</a>
|
|
199
203
|
</div>
|
|
200
204
|
|
|
201
205
|
<div class="method-description">
|
|
202
206
|
<p><a class="source-toggle" href="#"
|
|
203
|
-
onclick="toggleCode('
|
|
204
|
-
<div class="method-source-code" id="
|
|
207
|
+
onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
|
|
208
|
+
<div class="method-source-code" id="M000080-source">
|
|
205
209
|
<pre>
|
|
206
|
-
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line
|
|
210
|
+
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 62</span>
|
|
207
211
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">init_properties</span>
|
|
208
212
|
<span class="ruby-ivar">@@init_properties</span>
|
|
209
213
|
<span class="ruby-keyword kw">end</span>
|
|
@@ -212,21 +216,21 @@ debug.
|
|
|
212
216
|
</div>
|
|
213
217
|
</div>
|
|
214
218
|
|
|
215
|
-
<div id="method-
|
|
216
|
-
<a name="
|
|
219
|
+
<div id="method-M000081" class="method-detail">
|
|
220
|
+
<a name="M000081"></a>
|
|
217
221
|
|
|
218
222
|
<div class="method-heading">
|
|
219
|
-
<a href="#
|
|
223
|
+
<a href="#M000081" class="method-signature">
|
|
220
224
|
<span class="method-name">init_properties=</span><span class="method-args">(hash)</span>
|
|
221
225
|
</a>
|
|
222
226
|
</div>
|
|
223
227
|
|
|
224
228
|
<div class="method-description">
|
|
225
229
|
<p><a class="source-toggle" href="#"
|
|
226
|
-
onclick="toggleCode('
|
|
227
|
-
<div class="method-source-code" id="
|
|
230
|
+
onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
|
|
231
|
+
<div class="method-source-code" id="M000081-source">
|
|
228
232
|
<pre>
|
|
229
|
-
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line
|
|
233
|
+
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 66</span>
|
|
230
234
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">init_properties=</span>(<span class="ruby-identifier">hash</span>)
|
|
231
235
|
<span class="ruby-ivar">@@init_properties</span> = <span class="ruby-identifier">hash</span>
|
|
232
236
|
<span class="ruby-keyword kw">end</span>
|
|
@@ -235,21 +239,21 @@ debug.
|
|
|
235
239
|
</div>
|
|
236
240
|
</div>
|
|
237
241
|
|
|
238
|
-
<div id="method-
|
|
239
|
-
<a name="
|
|
242
|
+
<div id="method-M000082" class="method-detail">
|
|
243
|
+
<a name="M000082"></a>
|
|
240
244
|
|
|
241
245
|
<div class="method-heading">
|
|
242
|
-
<a href="#
|
|
246
|
+
<a href="#M000082" class="method-signature">
|
|
243
247
|
<span class="method-name">show_src</span><span class="method-args">()</span>
|
|
244
248
|
</a>
|
|
245
249
|
</div>
|
|
246
250
|
|
|
247
251
|
<div class="method-description">
|
|
248
252
|
<p><a class="source-toggle" href="#"
|
|
249
|
-
onclick="toggleCode('
|
|
250
|
-
<div class="method-source-code" id="
|
|
253
|
+
onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
|
|
254
|
+
<div class="method-source-code" id="M000082-source">
|
|
251
255
|
<pre>
|
|
252
|
-
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line
|
|
256
|
+
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 73</span>
|
|
253
257
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">show_src</span>
|
|
254
258
|
<span class="ruby-ivar">@@show_src</span>
|
|
255
259
|
<span class="ruby-keyword kw">end</span>
|
|
@@ -258,21 +262,21 @@ debug.
|
|
|
258
262
|
</div>
|
|
259
263
|
</div>
|
|
260
264
|
|
|
261
|
-
<div id="method-
|
|
262
|
-
<a name="
|
|
265
|
+
<div id="method-M000083" class="method-detail">
|
|
266
|
+
<a name="M000083"></a>
|
|
263
267
|
|
|
264
268
|
<div class="method-heading">
|
|
265
|
-
<a href="#
|
|
269
|
+
<a href="#M000083" class="method-signature">
|
|
266
270
|
<span class="method-name">show_src=</span><span class="method-args">(flag)</span>
|
|
267
271
|
</a>
|
|
268
272
|
</div>
|
|
269
273
|
|
|
270
274
|
<div class="method-description">
|
|
271
275
|
<p><a class="source-toggle" href="#"
|
|
272
|
-
onclick="toggleCode('
|
|
273
|
-
<div class="method-source-code" id="
|
|
276
|
+
onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
|
|
277
|
+
<div class="method-source-code" id="M000083-source">
|
|
274
278
|
<pre>
|
|
275
|
-
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line
|
|
279
|
+
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 77</span>
|
|
276
280
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">show_src=</span>(<span class="ruby-identifier">flag</span>)
|
|
277
281
|
<span class="ruby-ivar">@@show_src</span> = <span class="ruby-identifier">flag</span>
|
|
278
282
|
<span class="ruby-keyword kw">end</span>
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Module: Erubis::InterpolationEnhancer</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Module</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Erubis::InterpolationEnhancer</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/erubis/enhancer_rb.html">
|
|
59
|
+
erubis/enhancer.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
</table>
|
|
66
|
+
</div>
|
|
67
|
+
<!-- banner header -->
|
|
68
|
+
|
|
69
|
+
<div id="bodyContent">
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<div id="contextContent">
|
|
74
|
+
|
|
75
|
+
<div id="description">
|
|
76
|
+
<p>
|
|
77
|
+
convert "<h1><%=title%></h1>" into "_buf
|
|
78
|
+
<< %Q`<h1>#{title}</h1>`"
|
|
79
|
+
</p>
|
|
80
|
+
<p>
|
|
81
|
+
this is only for <a href="Eruby.html">Eruby</a>.
|
|
82
|
+
</p>
|
|
83
|
+
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div id="method-list">
|
|
90
|
+
<h3 class="section-bar">Methods</h3>
|
|
91
|
+
|
|
92
|
+
<div class="name-list">
|
|
93
|
+
<a href="#M000020">_add_text_to_str</a>
|
|
94
|
+
<a href="#M000021">add_expr_escaped</a>
|
|
95
|
+
<a href="#M000022">add_expr_literal</a>
|
|
96
|
+
<a href="#M000019">add_text</a>
|
|
97
|
+
<a href="#M000018">convert_input</a>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
<!-- if includes -->
|
|
105
|
+
|
|
106
|
+
<div id="section">
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
<!-- if method_list -->
|
|
116
|
+
<div id="methods">
|
|
117
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
118
|
+
|
|
119
|
+
<div id="method-M000020" class="method-detail">
|
|
120
|
+
<a name="M000020"></a>
|
|
121
|
+
|
|
122
|
+
<div class="method-heading">
|
|
123
|
+
<a href="#M000020" class="method-signature">
|
|
124
|
+
<span class="method-name">_add_text_to_str</span><span class="method-args">(str, text)</span>
|
|
125
|
+
</a>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<div class="method-description">
|
|
129
|
+
<p><a class="source-toggle" href="#"
|
|
130
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
|
131
|
+
<div class="method-source-code" id="M000020-source">
|
|
132
|
+
<pre>
|
|
133
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 639</span>
|
|
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
|
+
<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
|
+
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/['\#\\]/</span>, <span class="ruby-value str">'\\\\\&'</span>)
|
|
137
|
+
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">text</span>
|
|
138
|
+
<span class="ruby-keyword kw">end</span>
|
|
139
|
+
</pre>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div id="method-M000021" class="method-detail">
|
|
145
|
+
<a name="M000021"></a>
|
|
146
|
+
|
|
147
|
+
<div class="method-heading">
|
|
148
|
+
<a href="#M000021" class="method-signature">
|
|
149
|
+
<span class="method-name">add_expr_escaped</span><span class="method-args">(str, code)</span>
|
|
150
|
+
</a>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<div class="method-description">
|
|
154
|
+
<p><a class="source-toggle" href="#"
|
|
155
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
|
156
|
+
<div class="method-source-code" id="M000021-source">
|
|
157
|
+
<pre>
|
|
158
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 645</span>
|
|
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
|
+
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"\#{#{escaped_expr(code)}}"</span>
|
|
161
|
+
<span class="ruby-keyword kw">end</span>
|
|
162
|
+
</pre>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<div id="method-M000022" class="method-detail">
|
|
168
|
+
<a name="M000022"></a>
|
|
169
|
+
|
|
170
|
+
<div class="method-heading">
|
|
171
|
+
<a href="#M000022" class="method-signature">
|
|
172
|
+
<span class="method-name">add_expr_literal</span><span class="method-args">(str, code)</span>
|
|
173
|
+
</a>
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
<div class="method-description">
|
|
177
|
+
<p><a class="source-toggle" href="#"
|
|
178
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
|
179
|
+
<div class="method-source-code" id="M000022-source">
|
|
180
|
+
<pre>
|
|
181
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 649</span>
|
|
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
|
+
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"\#{#{code}}"</span>
|
|
184
|
+
<span class="ruby-keyword kw">end</span>
|
|
185
|
+
</pre>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div id="method-M000019" class="method-detail">
|
|
191
|
+
<a name="M000019"></a>
|
|
192
|
+
|
|
193
|
+
<div class="method-heading">
|
|
194
|
+
<a href="#M000019" class="method-signature">
|
|
195
|
+
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
|
|
196
|
+
</a>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div class="method-description">
|
|
200
|
+
<p><a class="source-toggle" href="#"
|
|
201
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
|
202
|
+
<div class="method-source-code" id="M000019-source">
|
|
203
|
+
<pre>
|
|
204
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 628</span>
|
|
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
|
+
<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
|
+
<span class="ruby-comment cmt">#src << " _buf << %Q`" << text << "`;"</span>
|
|
208
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
|
|
209
|
+
<span class="ruby-identifier">text</span>[<span class="ruby-value">-1</span>] = <span class="ruby-value str">"\\n"</span>
|
|
210
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">" _buf << %Q`"</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">text</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"`\n"</span>
|
|
211
|
+
<span class="ruby-keyword kw">else</span>
|
|
212
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">" _buf << %Q`"</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">text</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"`;"</span>
|
|
213
|
+
<span class="ruby-keyword kw">end</span>
|
|
214
|
+
<span class="ruby-keyword kw">end</span>
|
|
215
|
+
</pre>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<div id="method-M000018" class="method-detail">
|
|
221
|
+
<a name="M000018"></a>
|
|
222
|
+
|
|
223
|
+
<div class="method-heading">
|
|
224
|
+
<a href="#M000018" class="method-signature">
|
|
225
|
+
<span class="method-name">convert_input</span><span class="method-args">(src, input)</span>
|
|
226
|
+
</a>
|
|
227
|
+
</div>
|
|
228
|
+
|
|
229
|
+
<div class="method-description">
|
|
230
|
+
<p><a class="source-toggle" href="#"
|
|
231
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
|
232
|
+
<div class="method-source-code" id="M000018-source">
|
|
233
|
+
<pre>
|
|
234
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 575</span>
|
|
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
|
+
<span class="ruby-identifier">pat</span> = <span class="ruby-ivar">@pattern</span>
|
|
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>)
|
|
238
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
|
|
239
|
+
<span class="ruby-identifier">is_bol</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-comment cmt"># is beginning of line</span>
|
|
240
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
|
|
241
|
+
<span class="ruby-identifier">input</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">regexp</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">indicator</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">rspace</span><span class="ruby-operator">|</span>
|
|
242
|
+
<span class="ruby-identifier">match</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>()
|
|
243
|
+
<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>
|
|
244
|
+
<span class="ruby-identifier">text</span> = <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">len</span>]
|
|
245
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
|
|
246
|
+
<span class="ruby-identifier">ch</span> = <span class="ruby-identifier">indicator</span> <span class="ruby-value">? </span><span class="ruby-identifier">indicator</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
|
|
247
|
+
<span class="ruby-identifier">lspace</span> = <span class="ruby-identifier">ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?=</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">detect_spaces_at_bol</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">is_bol</span>)
|
|
248
|
+
<span class="ruby-identifier">is_bol</span> = <span class="ruby-identifier">rspace</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
|
|
249
|
+
<span class="ruby-identifier">_add_text_to_str</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">text</span>)
|
|
250
|
+
<span class="ruby-comment cmt">## * when '<%= %>', do nothing</span>
|
|
251
|
+
<span class="ruby-comment cmt">## * when '<% %>' or '<%# %>', delete spaces iff only spaces are around '<% %>'</span>
|
|
252
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?=</span> <span class="ruby-comment cmt"># <%= %></span>
|
|
253
|
+
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">lspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lspace</span>
|
|
254
|
+
<span class="ruby-identifier">add_expr</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">indicator</span>)
|
|
255
|
+
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">rspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rspace</span>
|
|
256
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?\#</span> <span class="ruby-comment cmt"># <%# %></span>
|
|
257
|
+
<span class="ruby-identifier">n</span> = <span class="ruby-identifier">code</span>.<span class="ruby-identifier">count</span>(<span class="ruby-value str">"\n"</span>) <span class="ruby-operator">+</span> (<span class="ruby-identifier">rspace</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)
|
|
258
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@trim</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">lspace</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">rspace</span>
|
|
259
|
+
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">str</span>)
|
|
260
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
|
|
261
|
+
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-value str">"\n"</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
|
|
262
|
+
<span class="ruby-keyword kw">else</span>
|
|
263
|
+
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">lspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lspace</span>
|
|
264
|
+
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">str</span>)
|
|
265
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
|
|
266
|
+
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-value str">"\n"</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
|
|
267
|
+
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">rspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rspace</span>
|
|
268
|
+
<span class="ruby-keyword kw">end</span>
|
|
269
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># <% %></span>
|
|
270
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@trim</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">lspace</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">rspace</span>
|
|
271
|
+
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">str</span>)
|
|
272
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
|
|
273
|
+
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-node">"#{lspace}#{code}#{rspace}"</span>)
|
|
274
|
+
<span class="ruby-keyword kw">else</span>
|
|
275
|
+
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">lspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lspace</span>
|
|
276
|
+
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">str</span>)
|
|
277
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
|
|
278
|
+
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
|
279
|
+
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">rspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rspace</span>
|
|
280
|
+
<span class="ruby-keyword kw">end</span>
|
|
281
|
+
<span class="ruby-keyword kw">end</span>
|
|
282
|
+
<span class="ruby-keyword kw">end</span>
|
|
283
|
+
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier">$'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">input</span> <span class="ruby-comment cmt"># add input when no matched</span>
|
|
284
|
+
<span class="ruby-identifier">_add_text_to_str</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">rest</span>)
|
|
285
|
+
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">str</span>)
|
|
286
|
+
<span class="ruby-keyword kw">end</span>
|
|
287
|
+
</pre>
|
|
288
|
+
</div>
|
|
289
|
+
</div>
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
<div id="validator-badges">
|
|
300
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
301
|
+
</div>
|
|
302
|
+
|
|
303
|
+
</body>
|
|
304
|
+
</html>
|