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