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
@@ -0,0 +1,439 @@
|
|
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::OptimizedGenerator</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::OptimizedGenerator</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/erubis/engine/optimized_rb.html">
|
59
|
+
erubis/engine/optimized.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
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000096">add_expr_debug</a>
|
84
|
+
<a href="#M000095">add_expr_escaped</a>
|
85
|
+
<a href="#M000094">add_expr_literal</a>
|
86
|
+
<a href="#M000097">add_postamble</a>
|
87
|
+
<a href="#M000091">add_preamble</a>
|
88
|
+
<a href="#M000093">add_stmt</a>
|
89
|
+
<a href="#M000092">add_text</a>
|
90
|
+
<a href="#M000087">escape_text</a>
|
91
|
+
<a href="#M000088">escaped_expr</a>
|
92
|
+
<a href="#M000086">init_generator</a>
|
93
|
+
<a href="#M000089">switch_to_expr</a>
|
94
|
+
<a href="#M000090">switch_to_stmt</a>
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if includes -->
|
102
|
+
<div id="includes">
|
103
|
+
<h3 class="section-bar">Included Modules</h3>
|
104
|
+
|
105
|
+
<div id="includes-list">
|
106
|
+
<span class="include-name"><a href="Generator.html">Generator</a></span>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
<div id="section">
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<!-- if method_list -->
|
120
|
+
<div id="methods">
|
121
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
122
|
+
|
123
|
+
<div id="method-M000086" class="method-detail">
|
124
|
+
<a name="M000086"></a>
|
125
|
+
|
126
|
+
<div class="method-heading">
|
127
|
+
<a href="#M000086" class="method-signature">
|
128
|
+
<span class="method-name">init_generator</span><span class="method-args">(properties={})</span>
|
129
|
+
</a>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
<div class="method-description">
|
133
|
+
<p><a class="source-toggle" href="#"
|
134
|
+
onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
|
135
|
+
<div class="method-source-code" id="M000086-source">
|
136
|
+
<pre>
|
137
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 21</span>
|
138
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
|
139
|
+
<span class="ruby-keyword kw">super</span>
|
140
|
+
<span class="ruby-ivar">@escapefunc</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">"Erubis::XmlHelper.escape_xml"</span>
|
141
|
+
<span class="ruby-ivar">@initialized</span> = <span class="ruby-keyword kw">false</span>
|
142
|
+
<span class="ruby-ivar">@prev_is_expr</span> = <span class="ruby-keyword kw">false</span>
|
143
|
+
<span class="ruby-keyword kw">end</span>
|
144
|
+
</pre>
|
145
|
+
</div>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
150
|
+
|
151
|
+
<div id="method-M000096" class="method-detail">
|
152
|
+
<a name="M000096"></a>
|
153
|
+
|
154
|
+
<div class="method-heading">
|
155
|
+
<a href="#M000096" class="method-signature">
|
156
|
+
<span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
|
157
|
+
</a>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
<div class="method-description">
|
161
|
+
<p><a class="source-toggle" href="#"
|
162
|
+
onclick="toggleCode('M000096-source');return false;">[Source]</a></p>
|
163
|
+
<div class="method-source-code" id="M000096-source">
|
164
|
+
<pre>
|
165
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 86</span>
|
166
|
+
<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>)
|
167
|
+
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
|
168
|
+
<span class="ruby-identifier">s</span> = (<span class="ruby-identifier">code</span>.<span class="ruby-identifier">dump</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A"(.*)"\z/</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">$1</span>
|
169
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">' $stderr.puts("*** debug: '</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'=#{('</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">code</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">').inspect}");'</span>
|
170
|
+
<span class="ruby-keyword kw">end</span>
|
171
|
+
</pre>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
<div id="method-M000095" class="method-detail">
|
177
|
+
<a name="M000095"></a>
|
178
|
+
|
179
|
+
<div class="method-heading">
|
180
|
+
<a href="#M000095" class="method-signature">
|
181
|
+
<span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
|
182
|
+
</a>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<div class="method-description">
|
186
|
+
<p><a class="source-toggle" href="#"
|
187
|
+
onclick="toggleCode('M000095-source');return false;">[Source]</a></p>
|
188
|
+
<div class="method-source-code" id="M000095-source">
|
189
|
+
<pre>
|
190
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 80</span>
|
191
|
+
<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>)
|
192
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@initialized</span>; <span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"_buf = ''"</span>; <span class="ruby-ivar">@initialized</span> = <span class="ruby-keyword kw">true</span>; <span class="ruby-keyword kw">end</span>
|
193
|
+
<span class="ruby-identifier">switch_to_expr</span>(<span class="ruby-identifier">src</span>)
|
194
|
+
<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">escaped_expr</span>(<span class="ruby-identifier">code</span>)
|
195
|
+
<span class="ruby-keyword kw">end</span>
|
196
|
+
</pre>
|
197
|
+
</div>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
<div id="method-M000094" class="method-detail">
|
202
|
+
<a name="M000094"></a>
|
203
|
+
|
204
|
+
<div class="method-heading">
|
205
|
+
<a href="#M000094" class="method-signature">
|
206
|
+
<span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
|
207
|
+
</a>
|
208
|
+
</div>
|
209
|
+
|
210
|
+
<div class="method-description">
|
211
|
+
<p><a class="source-toggle" href="#"
|
212
|
+
onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
|
213
|
+
<div class="method-source-code" id="M000094-source">
|
214
|
+
<pre>
|
215
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 74</span>
|
216
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
217
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@initialized</span>; <span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"_buf = ''"</span>; <span class="ruby-ivar">@initialized</span> = <span class="ruby-keyword kw">true</span>; <span class="ruby-keyword kw">end</span>
|
218
|
+
<span class="ruby-identifier">switch_to_expr</span>(<span class="ruby-identifier">src</span>)
|
219
|
+
<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">code</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">").to_s"</span>
|
220
|
+
<span class="ruby-keyword kw">end</span>
|
221
|
+
</pre>
|
222
|
+
</div>
|
223
|
+
</div>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
<div id="method-M000097" class="method-detail">
|
227
|
+
<a name="M000097"></a>
|
228
|
+
|
229
|
+
<div class="method-heading">
|
230
|
+
<a href="#M000097" class="method-signature">
|
231
|
+
<span class="method-name">add_postamble</span><span class="method-args">(src)</span>
|
232
|
+
</a>
|
233
|
+
</div>
|
234
|
+
|
235
|
+
<div class="method-description">
|
236
|
+
<p><a class="source-toggle" href="#"
|
237
|
+
onclick="toggleCode('M000097-source');return false;">[Source]</a></p>
|
238
|
+
<div class="method-source-code" id="M000097-source">
|
239
|
+
<pre>
|
240
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 92</span>
|
241
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
|
242
|
+
<span class="ruby-comment cmt">#super if @initialized</span>
|
243
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"\n_buf\n"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@initialized</span>
|
244
|
+
<span class="ruby-keyword kw">end</span>
|
245
|
+
</pre>
|
246
|
+
</div>
|
247
|
+
</div>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div id="method-M000091" class="method-detail">
|
251
|
+
<a name="M000091"></a>
|
252
|
+
|
253
|
+
<div class="method-heading">
|
254
|
+
<a href="#M000091" class="method-signature">
|
255
|
+
<span class="method-name">add_preamble</span><span class="method-args">(src)</span>
|
256
|
+
</a>
|
257
|
+
</div>
|
258
|
+
|
259
|
+
<div class="method-description">
|
260
|
+
<p><a class="source-toggle" href="#"
|
261
|
+
onclick="toggleCode('M000091-source');return false;">[Source]</a></p>
|
262
|
+
<div class="method-source-code" id="M000091-source">
|
263
|
+
<pre>
|
264
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 51</span>
|
265
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
|
266
|
+
<span class="ruby-comment cmt">#@initialized = false</span>
|
267
|
+
<span class="ruby-comment cmt">#@prev_is_expr = false</span>
|
268
|
+
<span class="ruby-keyword kw">end</span>
|
269
|
+
</pre>
|
270
|
+
</div>
|
271
|
+
</div>
|
272
|
+
</div>
|
273
|
+
|
274
|
+
<div id="method-M000093" class="method-detail">
|
275
|
+
<a name="M000093"></a>
|
276
|
+
|
277
|
+
<div class="method-heading">
|
278
|
+
<a href="#M000093" class="method-signature">
|
279
|
+
<span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
|
280
|
+
</a>
|
281
|
+
</div>
|
282
|
+
|
283
|
+
<div class="method-description">
|
284
|
+
<p><a class="source-toggle" href="#"
|
285
|
+
onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
|
286
|
+
<div class="method-source-code" id="M000093-source">
|
287
|
+
<pre>
|
288
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 67</span>
|
289
|
+
<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>)
|
290
|
+
<span class="ruby-identifier">switch_to_stmt</span>(<span class="ruby-identifier">src</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@initialized</span>
|
291
|
+
<span class="ruby-comment cmt">#super</span>
|
292
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">code</span>
|
293
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">';'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">code</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
|
294
|
+
<span class="ruby-keyword kw">end</span>
|
295
|
+
</pre>
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
</div>
|
299
|
+
|
300
|
+
<div id="method-M000092" class="method-detail">
|
301
|
+
<a name="M000092"></a>
|
302
|
+
|
303
|
+
<div class="method-heading">
|
304
|
+
<a href="#M000092" class="method-signature">
|
305
|
+
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
|
306
|
+
</a>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
<div class="method-description">
|
310
|
+
<p><a class="source-toggle" href="#"
|
311
|
+
onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
|
312
|
+
<div class="method-source-code" id="M000092-source">
|
313
|
+
<pre>
|
314
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 56</span>
|
315
|
+
<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>)
|
316
|
+
<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>
|
317
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@initialized</span>
|
318
|
+
<span class="ruby-identifier">switch_to_expr</span>(<span class="ruby-identifier">src</span>)
|
319
|
+
<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">text</span>) <span class="ruby-operator"><<</span> <span class="ruby-value str">"'"</span>
|
320
|
+
<span class="ruby-keyword kw">else</span>
|
321
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"_buf = '"</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>) <span class="ruby-operator"><<</span> <span class="ruby-value str">"';"</span>
|
322
|
+
<span class="ruby-ivar">@initialized</span> = <span class="ruby-keyword kw">true</span>
|
323
|
+
<span class="ruby-keyword kw">end</span>
|
324
|
+
<span class="ruby-keyword kw">end</span>
|
325
|
+
</pre>
|
326
|
+
</div>
|
327
|
+
</div>
|
328
|
+
</div>
|
329
|
+
|
330
|
+
<div id="method-M000087" class="method-detail">
|
331
|
+
<a name="M000087"></a>
|
332
|
+
|
333
|
+
<div class="method-heading">
|
334
|
+
<a href="#M000087" class="method-signature">
|
335
|
+
<span class="method-name">escape_text</span><span class="method-args">(text)</span>
|
336
|
+
</a>
|
337
|
+
</div>
|
338
|
+
|
339
|
+
<div class="method-description">
|
340
|
+
<p><a class="source-toggle" href="#"
|
341
|
+
onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
|
342
|
+
<div class="method-source-code" id="M000087-source">
|
343
|
+
<pre>
|
344
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 30</span>
|
345
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
|
346
|
+
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/['\\]/</span>, <span class="ruby-value str">'\\\\\&'</span>) <span class="ruby-comment cmt"># "'" => "\\'", '\\' => '\\\\'</span>
|
347
|
+
<span class="ruby-keyword kw">end</span>
|
348
|
+
</pre>
|
349
|
+
</div>
|
350
|
+
</div>
|
351
|
+
</div>
|
352
|
+
|
353
|
+
<div id="method-M000088" class="method-detail">
|
354
|
+
<a name="M000088"></a>
|
355
|
+
|
356
|
+
<div class="method-heading">
|
357
|
+
<a href="#M000088" class="method-signature">
|
358
|
+
<span class="method-name">escaped_expr</span><span class="method-args">(code)</span>
|
359
|
+
</a>
|
360
|
+
</div>
|
361
|
+
|
362
|
+
<div class="method-description">
|
363
|
+
<p><a class="source-toggle" href="#"
|
364
|
+
onclick="toggleCode('M000088-source');return false;">[Source]</a></p>
|
365
|
+
<div class="method-source-code" id="M000088-source">
|
366
|
+
<pre>
|
367
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 34</span>
|
368
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>)
|
369
|
+
<span class="ruby-ivar">@escapefunc</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'Erubis::XmlHelper.escape_xml'</span>
|
370
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-node">"#{@escapefunc}(#{code})"</span>
|
371
|
+
<span class="ruby-keyword kw">end</span>
|
372
|
+
</pre>
|
373
|
+
</div>
|
374
|
+
</div>
|
375
|
+
</div>
|
376
|
+
|
377
|
+
<div id="method-M000089" class="method-detail">
|
378
|
+
<a name="M000089"></a>
|
379
|
+
|
380
|
+
<div class="method-heading">
|
381
|
+
<a href="#M000089" class="method-signature">
|
382
|
+
<span class="method-name">switch_to_expr</span><span class="method-args">(src)</span>
|
383
|
+
</a>
|
384
|
+
</div>
|
385
|
+
|
386
|
+
<div class="method-description">
|
387
|
+
<p><a class="source-toggle" href="#"
|
388
|
+
onclick="toggleCode('M000089-source');return false;">[Source]</a></p>
|
389
|
+
<div class="method-source-code" id="M000089-source">
|
390
|
+
<pre>
|
391
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 39</span>
|
392
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">switch_to_expr</span>(<span class="ruby-identifier">src</span>)
|
393
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@prev_is_expr</span>
|
394
|
+
<span class="ruby-ivar">@prev_is_expr</span> = <span class="ruby-keyword kw">true</span>
|
395
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">' _buf'</span>
|
396
|
+
<span class="ruby-keyword kw">end</span>
|
397
|
+
</pre>
|
398
|
+
</div>
|
399
|
+
</div>
|
400
|
+
</div>
|
401
|
+
|
402
|
+
<div id="method-M000090" class="method-detail">
|
403
|
+
<a name="M000090"></a>
|
404
|
+
|
405
|
+
<div class="method-heading">
|
406
|
+
<a href="#M000090" class="method-signature">
|
407
|
+
<span class="method-name">switch_to_stmt</span><span class="method-args">(src)</span>
|
408
|
+
</a>
|
409
|
+
</div>
|
410
|
+
|
411
|
+
<div class="method-description">
|
412
|
+
<p><a class="source-toggle" href="#"
|
413
|
+
onclick="toggleCode('M000090-source');return false;">[Source]</a></p>
|
414
|
+
<div class="method-source-code" id="M000090-source">
|
415
|
+
<pre>
|
416
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 45</span>
|
417
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">switch_to_stmt</span>(<span class="ruby-identifier">src</span>)
|
418
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@prev_is_expr</span>
|
419
|
+
<span class="ruby-ivar">@prev_is_expr</span> = <span class="ruby-keyword kw">false</span>
|
420
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">';'</span>
|
421
|
+
<span class="ruby-keyword kw">end</span>
|
422
|
+
</pre>
|
423
|
+
</div>
|
424
|
+
</div>
|
425
|
+
</div>
|
426
|
+
|
427
|
+
|
428
|
+
</div>
|
429
|
+
|
430
|
+
|
431
|
+
</div>
|
432
|
+
|
433
|
+
|
434
|
+
<div id="validator-badges">
|
435
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
436
|
+
</div>
|
437
|
+
|
438
|
+
</body>
|
439
|
+
</html>
|
@@ -95,7 +95,7 @@ code
|
|
95
95
|
<h3 class="section-bar">Methods</h3>
|
96
96
|
|
97
97
|
<div class="name-list">
|
98
|
-
<a href="#
|
98
|
+
<a href="#M000178">add_expr_debug</a>
|
99
99
|
</div>
|
100
100
|
</div>
|
101
101
|
|
@@ -124,21 +124,21 @@ code
|
|
124
124
|
<div id="methods">
|
125
125
|
<h3 class="section-bar">Public Instance methods</h3>
|
126
126
|
|
127
|
-
<div id="method-
|
128
|
-
<a name="
|
127
|
+
<div id="method-M000178" class="method-detail">
|
128
|
+
<a name="M000178"></a>
|
129
129
|
|
130
130
|
<div class="method-heading">
|
131
|
-
<a href="#
|
131
|
+
<a href="#M000178" class="method-signature">
|
132
132
|
<span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
|
133
133
|
</a>
|
134
134
|
</div>
|
135
135
|
|
136
136
|
<div class="method-description">
|
137
137
|
<p><a class="source-toggle" href="#"
|
138
|
-
onclick="toggleCode('
|
139
|
-
<div class="method-source-code" id="
|
138
|
+
onclick="toggleCode('M000178-source');return false;">[Source]</a></p>
|
139
|
+
<div class="method-source-code" id="M000178-source">
|
140
140
|
<pre>
|
141
|
-
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line
|
141
|
+
<span class="ruby-comment cmt"># File erubis/engine/optimized.rb, line 121</span>
|
142
142
|
<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>)
|
143
143
|
<span class="ruby-identifier">switch_to_stmt</span>(<span class="ruby-identifier">src</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">indicator</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'==='</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@initialized</span>
|
144
144
|
<span class="ruby-keyword kw">super</span>
|