erubis 2.6.6 → 2.7.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.txt +79 -3
- data/MIT-LICENSE +1 -1
- data/README.txt +2 -2
- data/benchmark/bench.rb +2 -2
- data/bin/erubis +2 -2
- data/contrib/erubis +293 -155
- data/contrib/inline-require +2 -2
- data/doc-api/classes/Erubis.html +10 -1
- data/doc-api/classes/Erubis/ArrayBufferEnhancer.html +12 -12
- data/doc-api/classes/Erubis/ArrayEnhancer.html +14 -14
- data/doc-api/classes/Erubis/Basic/Converter.html +24 -24
- data/doc-api/classes/Erubis/BiPatternEnhancer.html +12 -12
- 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/CppGenerator.html +382 -0
- data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +7 -7
- data/doc-api/classes/Erubis/Ecpp.html +126 -0
- data/doc-api/classes/Erubis/Engine.html +36 -36
- data/doc-api/classes/Erubis/ErboutEnhancer.html +14 -14
- data/doc-api/classes/Erubis/EscapeEnhancer.html +6 -6
- data/doc-api/classes/Erubis/EscapedEcpp.html +120 -0
- data/doc-api/classes/Erubis/Evaluator.html +19 -19
- data/doc-api/classes/Erubis/Generator.html +60 -60
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +14 -14
- data/doc-api/classes/Erubis/Helpers/RailsFormHelper.html +150 -150
- data/doc-api/classes/Erubis/Helpers/RailsHelper.html +49 -49
- data/doc-api/classes/Erubis/Helpers/RailsHelper/TemplateConverter.html +24 -24
- data/doc-api/classes/Erubis/InterpolationEnhancer.html +38 -39
- data/doc-api/classes/Erubis/JavaGenerator.html +60 -60
- data/doc-api/classes/Erubis/JavascriptGenerator.html +66 -66
- data/doc-api/classes/Erubis/Main.html +22 -22
- data/doc-api/classes/Erubis/NoCodeEnhancer.html +30 -30
- data/doc-api/classes/Erubis/NoTextEnhancer.html +6 -6
- 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.html +1 -0
- 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/Ecpp.html +166 -0
- 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 +18 -34
- data/doc-api/classes/Erubis/PerlGenerator.html +54 -54
- data/doc-api/classes/Erubis/PhpGenerator.html +54 -54
- data/doc-api/classes/Erubis/PrefixedLineEnhancer.html +210 -0
- data/doc-api/classes/Erubis/PrefixedLineEruby.html +120 -0
- data/doc-api/classes/Erubis/PreprocessingEruby.html +12 -12
- data/doc-api/classes/Erubis/PreprocessingHelper.html +22 -22
- data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +20 -20
- data/doc-api/classes/Erubis/PrintOutEnhancer.html +33 -33
- data/doc-api/classes/Erubis/RubyEvaluator.html +18 -18
- data/doc-api/classes/Erubis/RubyGenerator.html +59 -58
- data/doc-api/classes/Erubis/SchemeGenerator.html +60 -60
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +7 -7
- data/doc-api/classes/Erubis/StdoutEnhancer.html +13 -13
- data/doc-api/classes/Erubis/StringBufferEnhancer.html +14 -14
- data/doc-api/classes/Erubis/TinyEruby.html +24 -24
- data/doc-api/classes/Erubis/XmlHelper.html +30 -30
- data/doc-api/classes/Kernel.html +155 -0
- data/doc-api/created.rid +1 -1
- data/doc-api/files/README_txt.html +3 -3
- data/doc-api/files/erubis/context_rb.html +1 -1
- data/doc-api/files/erubis/converter_rb.html +3 -3
- data/doc-api/files/erubis/engine/ec_rb.html +1 -1
- data/doc-api/files/erubis/engine/ecpp_rb.html +115 -0
- 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 +1 -1
- data/doc-api/files/erubis/engine/ephp_rb.html +1 -1
- data/doc-api/files/erubis/engine/eruby_rb.html +2 -2
- 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 +2 -2
- 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 +1 -1
- data/doc-api/files/erubis/generator_rb.html +3 -3
- data/doc-api/files/erubis/helper_rb.html +1 -1
- data/doc-api/files/erubis/helpers/rails_form_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 +4 -2
- data/doc-api/files/erubis/preprocessing_rb.html +1 -1
- data/doc-api/files/erubis/tiny_rb.html +1 -1
- data/doc-api/files/erubis/util_rb.html +107 -0
- data/doc-api/files/erubis_rb.html +2 -2
- data/doc-api/fr_class_index.html +7 -0
- data/doc-api/fr_file_index.html +2 -0
- data/doc-api/fr_method_index.html +237 -223
- data/doc/docstyle.css +25 -4
- data/doc/users-guide.html +286 -21
- data/examples/basic/Makefile +7 -2
- data/examples/basic/example.ecpp +33 -0
- data/lib/erubis.rb +4 -3
- data/lib/erubis/context.rb +2 -2
- data/lib/erubis/converter.rb +3 -3
- data/lib/erubis/engine.rb +8 -8
- data/lib/erubis/engine/ec.rb +2 -2
- data/lib/erubis/engine/ecpp.rb +113 -0
- data/lib/erubis/engine/ejava.rb +9 -9
- data/lib/erubis/engine/ejavascript.rb +9 -9
- data/lib/erubis/engine/enhanced.rb +7 -2
- data/lib/erubis/engine/eperl.rb +2 -2
- data/lib/erubis/engine/ephp.rb +2 -2
- data/lib/erubis/engine/eruby.rb +8 -7
- data/lib/erubis/engine/escheme.rb +2 -2
- data/lib/erubis/engine/optimized.rb +2 -2
- data/lib/erubis/enhancer.rb +70 -27
- data/lib/erubis/error.rb +2 -2
- data/lib/erubis/evaluator.rb +2 -2
- data/lib/erubis/generator.rb +3 -3
- data/lib/erubis/helper.rb +2 -2
- data/lib/erubis/helpers/rails_form_helper.rb +2 -2
- data/lib/erubis/helpers/rails_helper.rb +2 -2
- data/lib/erubis/local-setting.rb +2 -2
- data/lib/erubis/main.rb +31 -4
- data/lib/erubis/preprocessing.rb +2 -2
- data/lib/erubis/tiny.rb +2 -2
- data/lib/erubis/util.rb +22 -0
- data/test/assert-text-equal.rb +2 -2
- data/test/data/users-guide/bufvar-example.rb +10 -0
- data/test/data/users-guide/bufvar-example.result +17 -0
- data/test/data/users-guide/example.ecpp +30 -0
- data/test/data/users-guide/example_c.result +22 -19
- data/test/data/users-guide/fasteruby-example.rb +8 -0
- data/test/data/users-guide/fasteruby-example.result +18 -0
- data/test/data/users-guide/percentline-example.rhtml +3 -1
- data/test/data/users-guide/percentline_example.result +5 -3
- data/test/data/users-guide/prefixedline-example.rb +9 -0
- data/test/data/users-guide/prefixedline-example.rhtml +6 -0
- data/test/data/users-guide/prefixedline_example.result +9 -0
- data/test/test-engines.rb +58 -2
- data/test/test-enhancers.rb +51 -2
- data/test/test-erubis.rb +14 -10
- data/test/test-index-cgi.rb +191 -0
- data/test/test-main.rb +35 -4
- data/test/test-users-guide.rb +18 -2
- data/test/test.rb +18 -2
- data/test/testutil.rb +22 -7
- metadata +30 -24
@@ -80,15 +80,15 @@
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
81
81
|
|
82
82
|
<div class="name-list">
|
83
|
-
<a href="#
|
84
|
-
<a href="#
|
85
|
-
<a href="#
|
86
|
-
<a href="#
|
87
|
-
<a href="#
|
88
|
-
<a href="#
|
89
|
-
<a href="#
|
90
|
-
<a href="#
|
91
|
-
<a href="#
|
83
|
+
<a href="#M000128">add_expr_debug</a>
|
84
|
+
<a href="#M000127">add_expr_escaped</a>
|
85
|
+
<a href="#M000126">add_expr_literal</a>
|
86
|
+
<a href="#M000130">add_postamble</a>
|
87
|
+
<a href="#M000123">add_preamble</a>
|
88
|
+
<a href="#M000129">add_stmt</a>
|
89
|
+
<a href="#M000125">add_text</a>
|
90
|
+
<a href="#M000124">escape_text</a>
|
91
|
+
<a href="#M000122">init_generator</a>
|
92
92
|
</div>
|
93
93
|
</div>
|
94
94
|
|
@@ -117,19 +117,19 @@
|
|
117
117
|
<div id="methods">
|
118
118
|
<h3 class="section-bar">Public Instance methods</h3>
|
119
119
|
|
120
|
-
<div id="method-
|
121
|
-
<a name="
|
120
|
+
<div id="method-M000128" class="method-detail">
|
121
|
+
<a name="M000128"></a>
|
122
122
|
|
123
123
|
<div class="method-heading">
|
124
|
-
<a href="#
|
124
|
+
<a href="#M000128" class="method-signature">
|
125
125
|
<span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
|
126
126
|
</a>
|
127
127
|
</div>
|
128
128
|
|
129
129
|
<div class="method-description">
|
130
130
|
<p><a class="source-toggle" href="#"
|
131
|
-
onclick="toggleCode('
|
132
|
-
<div class="method-source-code" id="
|
131
|
+
onclick="toggleCode('M000128-source');return false;">[Source]</a></p>
|
132
|
+
<div class="method-source-code" id="M000128-source">
|
133
133
|
<pre>
|
134
134
|
<span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 46</span>
|
135
135
|
<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>)
|
@@ -142,19 +142,19 @@
|
|
142
142
|
</div>
|
143
143
|
</div>
|
144
144
|
|
145
|
-
<div id="method-
|
146
|
-
<a name="
|
145
|
+
<div id="method-M000127" class="method-detail">
|
146
|
+
<a name="M000127"></a>
|
147
147
|
|
148
148
|
<div class="method-heading">
|
149
|
-
<a href="#
|
149
|
+
<a href="#M000127" class="method-signature">
|
150
150
|
<span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
|
151
151
|
</a>
|
152
152
|
</div>
|
153
153
|
|
154
154
|
<div class="method-description">
|
155
155
|
<p><a class="source-toggle" href="#"
|
156
|
-
onclick="toggleCode('
|
157
|
-
<div class="method-source-code" id="
|
156
|
+
onclick="toggleCode('M000127-source');return false;">[Source]</a></p>
|
157
|
+
<div class="method-source-code" id="M000127-source">
|
158
158
|
<pre>
|
159
159
|
<span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 42</span>
|
160
160
|
<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>)
|
@@ -165,19 +165,19 @@
|
|
165
165
|
</div>
|
166
166
|
</div>
|
167
167
|
|
168
|
-
<div id="method-
|
169
|
-
<a name="
|
168
|
+
<div id="method-M000126" class="method-detail">
|
169
|
+
<a name="M000126"></a>
|
170
170
|
|
171
171
|
<div class="method-heading">
|
172
|
-
<a href="#
|
172
|
+
<a href="#M000126" class="method-signature">
|
173
173
|
<span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
|
174
174
|
</a>
|
175
175
|
</div>
|
176
176
|
|
177
177
|
<div class="method-description">
|
178
178
|
<p><a class="source-toggle" href="#"
|
179
|
-
onclick="toggleCode('
|
180
|
-
<div class="method-source-code" id="
|
179
|
+
onclick="toggleCode('M000126-source');return false;">[Source]</a></p>
|
180
|
+
<div class="method-source-code" id="M000126-source">
|
181
181
|
<pre>
|
182
182
|
<span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 37</span>
|
183
183
|
<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>)
|
@@ -189,19 +189,19 @@
|
|
189
189
|
</div>
|
190
190
|
</div>
|
191
191
|
|
192
|
-
<div id="method-
|
193
|
-
<a name="
|
192
|
+
<div id="method-M000130" class="method-detail">
|
193
|
+
<a name="M000130"></a>
|
194
194
|
|
195
195
|
<div class="method-heading">
|
196
|
-
<a href="#
|
196
|
+
<a href="#M000130" class="method-signature">
|
197
197
|
<span class="method-name">add_postamble</span><span class="method-args">(src)</span>
|
198
198
|
</a>
|
199
199
|
</div>
|
200
200
|
|
201
201
|
<div class="method-description">
|
202
202
|
<p><a class="source-toggle" href="#"
|
203
|
-
onclick="toggleCode('
|
204
|
-
<div class="method-source-code" id="
|
203
|
+
onclick="toggleCode('M000130-source');return false;">[Source]</a></p>
|
204
|
+
<div class="method-source-code" id="M000130-source">
|
205
205
|
<pre>
|
206
206
|
<span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 63</span>
|
207
207
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
|
@@ -212,19 +212,19 @@
|
|
212
212
|
</div>
|
213
213
|
</div>
|
214
214
|
|
215
|
-
<div id="method-
|
216
|
-
<a name="
|
215
|
+
<div id="method-M000123" class="method-detail">
|
216
|
+
<a name="M000123"></a>
|
217
217
|
|
218
218
|
<div class="method-heading">
|
219
|
-
<a href="#
|
219
|
+
<a href="#M000123" class="method-signature">
|
220
220
|
<span class="method-name">add_preamble</span><span class="method-args">(src)</span>
|
221
221
|
</a>
|
222
222
|
</div>
|
223
223
|
|
224
224
|
<div class="method-description">
|
225
225
|
<p><a class="source-toggle" href="#"
|
226
|
-
onclick="toggleCode('
|
227
|
-
<div class="method-source-code" id="
|
226
|
+
onclick="toggleCode('M000123-source');return false;">[Source]</a></p>
|
227
|
+
<div class="method-source-code" id="M000123-source">
|
228
228
|
<pre>
|
229
229
|
<span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 25</span>
|
230
230
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
|
@@ -235,19 +235,19 @@
|
|
235
235
|
</div>
|
236
236
|
</div>
|
237
237
|
|
238
|
-
<div id="method-
|
239
|
-
<a name="
|
238
|
+
<div id="method-M000129" class="method-detail">
|
239
|
+
<a name="M000129"></a>
|
240
240
|
|
241
241
|
<div class="method-heading">
|
242
|
-
<a href="#
|
242
|
+
<a href="#M000129" class="method-signature">
|
243
243
|
<span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
|
244
244
|
</a>
|
245
245
|
</div>
|
246
246
|
|
247
247
|
<div class="method-description">
|
248
248
|
<p><a class="source-toggle" href="#"
|
249
|
-
onclick="toggleCode('
|
250
|
-
<div class="method-source-code" id="
|
249
|
+
onclick="toggleCode('M000129-source');return false;">[Source]</a></p>
|
250
|
+
<div class="method-source-code" id="M000129-source">
|
251
251
|
<pre>
|
252
252
|
<span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 52</span>
|
253
253
|
<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>)
|
@@ -265,19 +265,19 @@
|
|
265
265
|
</div>
|
266
266
|
</div>
|
267
267
|
|
268
|
-
<div id="method-
|
269
|
-
<a name="
|
268
|
+
<div id="method-M000125" class="method-detail">
|
269
|
+
<a name="M000125"></a>
|
270
270
|
|
271
271
|
<div class="method-heading">
|
272
|
-
<a href="#
|
272
|
+
<a href="#M000125" class="method-signature">
|
273
273
|
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
|
274
274
|
</a>
|
275
275
|
</div>
|
276
276
|
|
277
277
|
<div class="method-description">
|
278
278
|
<p><a class="source-toggle" href="#"
|
279
|
-
onclick="toggleCode('
|
280
|
-
<div class="method-source-code" id="
|
279
|
+
onclick="toggleCode('M000125-source');return false;">[Source]</a></p>
|
280
|
+
<div class="method-source-code" id="M000125-source">
|
281
281
|
<pre>
|
282
282
|
<span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 33</span>
|
283
283
|
<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>)
|
@@ -288,19 +288,19 @@
|
|
288
288
|
</div>
|
289
289
|
</div>
|
290
290
|
|
291
|
-
<div id="method-
|
292
|
-
<a name="
|
291
|
+
<div id="method-M000124" class="method-detail">
|
292
|
+
<a name="M000124"></a>
|
293
293
|
|
294
294
|
<div class="method-heading">
|
295
|
-
<a href="#
|
295
|
+
<a href="#M000124" class="method-signature">
|
296
296
|
<span class="method-name">escape_text</span><span class="method-args">(text)</span>
|
297
297
|
</a>
|
298
298
|
</div>
|
299
299
|
|
300
300
|
<div class="method-description">
|
301
301
|
<p><a class="source-toggle" href="#"
|
302
|
-
onclick="toggleCode('
|
303
|
-
<div class="method-source-code" id="
|
302
|
+
onclick="toggleCode('M000124-source');return false;">[Source]</a></p>
|
303
|
+
<div class="method-source-code" id="M000124-source">
|
304
304
|
<pre>
|
305
305
|
<span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 29</span>
|
306
306
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
|
@@ -311,19 +311,19 @@
|
|
311
311
|
</div>
|
312
312
|
</div>
|
313
313
|
|
314
|
-
<div id="method-
|
315
|
-
<a name="
|
314
|
+
<div id="method-M000122" class="method-detail">
|
315
|
+
<a name="M000122"></a>
|
316
316
|
|
317
317
|
<div class="method-heading">
|
318
|
-
<a href="#
|
318
|
+
<a href="#M000122" class="method-signature">
|
319
319
|
<span class="method-name">init_generator</span><span class="method-args">(properties={})</span>
|
320
320
|
</a>
|
321
321
|
</div>
|
322
322
|
|
323
323
|
<div class="method-description">
|
324
324
|
<p><a class="source-toggle" href="#"
|
325
|
-
onclick="toggleCode('
|
326
|
-
<div class="method-source-code" id="
|
325
|
+
onclick="toggleCode('M000122-source');return false;">[Source]</a></p>
|
326
|
+
<div class="method-source-code" id="M000122-source">
|
327
327
|
<pre>
|
328
328
|
<span class="ruby-comment cmt"># File erubis/engine/ephp.rb, line 20</span>
|
329
329
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
|
@@ -0,0 +1,210 @@
|
|
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::PrefixedLineEnhancer</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::PrefixedLineEnhancer</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
|
+
regards lines starting with ’^[ \t]*%’ as program code
|
78
|
+
</p>
|
79
|
+
<p>
|
80
|
+
in addition you can specify prefix character (default ’%’)
|
81
|
+
</p>
|
82
|
+
<p>
|
83
|
+
this is language-independent.
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000005">add_text</a>
|
96
|
+
<a href="#M000004">init_generator</a>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
<!-- if includes -->
|
104
|
+
|
105
|
+
<div id="section">
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<!-- if method_list -->
|
115
|
+
<div id="methods">
|
116
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
117
|
+
|
118
|
+
<div id="method-M000005" class="method-detail">
|
119
|
+
<a name="M000005"></a>
|
120
|
+
|
121
|
+
<div class="method-heading">
|
122
|
+
<a href="#M000005" class="method-signature">
|
123
|
+
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
|
124
|
+
</a>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div class="method-description">
|
128
|
+
<p><a class="source-toggle" href="#"
|
129
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
130
|
+
<div class="method-source-code" id="M000005-source">
|
131
|
+
<pre>
|
132
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 454</span>
|
133
|
+
<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>)
|
134
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@prefixrexp</span>
|
135
|
+
<span class="ruby-ivar">@prefixchar</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'%'</span>
|
136
|
+
<span class="ruby-ivar">@prefixrexp</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">compile</span>(<span class="ruby-node">"^([ \\t]*)\\#{@prefixchar}(.*?\\r?\\n)"</span>)
|
137
|
+
<span class="ruby-keyword kw">end</span>
|
138
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
|
139
|
+
<span class="ruby-identifier">text2</span> = <span class="ruby-value str">''</span>
|
140
|
+
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-ivar">@prefixrexp</span>) <span class="ruby-keyword kw">do</span>
|
141
|
+
<span class="ruby-identifier">space</span> = <span class="ruby-identifier">$1</span>
|
142
|
+
<span class="ruby-identifier">line</span> = <span class="ruby-identifier">$2</span>
|
143
|
+
<span class="ruby-identifier">space</span>, <span class="ruby-identifier">line</span> = <span class="ruby-value str">''</span>, <span class="ruby-identifier">$1</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">$2</span>
|
144
|
+
<span class="ruby-identifier">match</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
|
145
|
+
<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>
|
146
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-identifier">text</span>[<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">len</span>]
|
147
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
|
148
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text2</span>.<span class="ruby-identifier">empty?</span>
|
149
|
+
<span class="ruby-identifier">text2</span> = <span class="ruby-identifier">str</span>
|
150
|
+
<span class="ruby-keyword kw">else</span>
|
151
|
+
<span class="ruby-identifier">text2</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">str</span>
|
152
|
+
<span class="ruby-keyword kw">end</span>
|
153
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span>[<span class="ruby-value">0</span>, <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-ivar">@prefixchar</span>
|
154
|
+
<span class="ruby-identifier">text2</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">space</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">line</span>
|
155
|
+
<span class="ruby-keyword kw">else</span>
|
156
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text2</span>)
|
157
|
+
<span class="ruby-identifier">text2</span> = <span class="ruby-value str">''</span>
|
158
|
+
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">space</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">line</span>)
|
159
|
+
<span class="ruby-keyword kw">end</span>
|
160
|
+
<span class="ruby-keyword kw">end</span>
|
161
|
+
<span class="ruby-comment cmt">#rest = pos == 0 ? text : $' # ruby1.8</span>
|
162
|
+
<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">text</span>[<span class="ruby-identifier">pos</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-comment cmt"># ruby1.9</span>
|
163
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text2</span>.<span class="ruby-identifier">empty?</span>
|
164
|
+
<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>
|
165
|
+
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier">text2</span>
|
166
|
+
<span class="ruby-keyword kw">end</span>
|
167
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rest</span>)
|
168
|
+
<span class="ruby-keyword kw">end</span>
|
169
|
+
</pre>
|
170
|
+
</div>
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<div id="method-M000004" class="method-detail">
|
175
|
+
<a name="M000004"></a>
|
176
|
+
|
177
|
+
<div class="method-heading">
|
178
|
+
<a href="#M000004" class="method-signature">
|
179
|
+
<span class="method-name">init_generator</span><span class="method-args">(properties={})</span>
|
180
|
+
</a>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div class="method-description">
|
184
|
+
<p><a class="source-toggle" href="#"
|
185
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
186
|
+
<div class="method-source-code" id="M000004-source">
|
187
|
+
<pre>
|
188
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 449</span>
|
189
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
|
190
|
+
<span class="ruby-keyword kw">super</span>
|
191
|
+
<span class="ruby-ivar">@prefixchar</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:prefixchar</span>]
|
192
|
+
<span class="ruby-keyword kw">end</span>
|
193
|
+
</pre>
|
194
|
+
</div>
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
</div>
|
203
|
+
|
204
|
+
|
205
|
+
<div id="validator-badges">
|
206
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
207
|
+
</div>
|
208
|
+
|
209
|
+
</body>
|
210
|
+
</html>
|