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,382 @@
|
|
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::SchemeGenerator</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::SchemeGenerator</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/erubis/engine/escheme_rb.html">
|
59
|
+
erubis/engine/escheme.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="#M000027">add_expr_debug</a>
|
84
|
+
<a href="#M000026">add_expr_escaped</a>
|
85
|
+
<a href="#M000025">add_expr_literal</a>
|
86
|
+
<a href="#M000028">add_postamble</a>
|
87
|
+
<a href="#M000020">add_preamble</a>
|
88
|
+
<a href="#M000024">add_stmt</a>
|
89
|
+
<a href="#M000023">add_text</a>
|
90
|
+
<a href="#M000021">escape_text</a>
|
91
|
+
<a href="#M000022">escaped_expr</a>
|
92
|
+
<a href="#M000019">init_generator</a>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
<div id="includes">
|
101
|
+
<h3 class="section-bar">Included Modules</h3>
|
102
|
+
|
103
|
+
<div id="includes-list">
|
104
|
+
<span class="include-name"><a href="Generator.html">Generator</a></span>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
<div id="section">
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<!-- if method_list -->
|
118
|
+
<div id="methods">
|
119
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
120
|
+
|
121
|
+
<div id="method-M000027" class="method-detail">
|
122
|
+
<a name="M000027"></a>
|
123
|
+
|
124
|
+
<div class="method-heading">
|
125
|
+
<a href="#M000027" class="method-signature">
|
126
|
+
<span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
|
127
|
+
</a>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
<div class="method-description">
|
131
|
+
<p><a class="source-toggle" href="#"
|
132
|
+
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
133
|
+
<div class="method-source-code" id="M000027-source">
|
134
|
+
<pre>
|
135
|
+
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 72</span>
|
136
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_debug</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|
137
|
+
<span class="ruby-identifier">s</span> = (<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">code</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\"/</span>, <span class="ruby-value str">'\\"'</span>)
|
138
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"(display \"*** debug: #{s}=\")(display #{code.strip})(display \"\\n\")"</span>
|
139
|
+
<span class="ruby-keyword kw">end</span>
|
140
|
+
</pre>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
<div id="method-M000026" class="method-detail">
|
146
|
+
<a name="M000026"></a>
|
147
|
+
|
148
|
+
<div class="method-heading">
|
149
|
+
<a href="#M000026" class="method-signature">
|
150
|
+
<span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
|
151
|
+
</a>
|
152
|
+
</div>
|
153
|
+
|
154
|
+
<div class="method-description">
|
155
|
+
<p><a class="source-toggle" href="#"
|
156
|
+
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
157
|
+
<div class="method-source-code" id="M000026-source">
|
158
|
+
<pre>
|
159
|
+
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 68</span>
|
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>)
|
161
|
+
<span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>))
|
162
|
+
<span class="ruby-keyword kw">end</span>
|
163
|
+
</pre>
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div id="method-M000025" class="method-detail">
|
169
|
+
<a name="M000025"></a>
|
170
|
+
|
171
|
+
<div class="method-heading">
|
172
|
+
<a href="#M000025" class="method-signature">
|
173
|
+
<span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
|
174
|
+
</a>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
<div class="method-description">
|
178
|
+
<p><a class="source-toggle" href="#"
|
179
|
+
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
180
|
+
<div class="method-source-code" id="M000025-source">
|
181
|
+
<pre>
|
182
|
+
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 63</span>
|
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>)
|
184
|
+
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
|
185
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"(#{@func} #{code})"</span>
|
186
|
+
<span class="ruby-keyword kw">end</span>
|
187
|
+
</pre>
|
188
|
+
</div>
|
189
|
+
</div>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
<div id="method-M000028" class="method-detail">
|
193
|
+
<a name="M000028"></a>
|
194
|
+
|
195
|
+
<div class="method-heading">
|
196
|
+
<a href="#M000028" class="method-signature">
|
197
|
+
<span class="method-name">add_postamble</span><span class="method-args">(src)</span>
|
198
|
+
</a>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
<div class="method-description">
|
202
|
+
<p><a class="source-toggle" href="#"
|
203
|
+
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
204
|
+
<div class="method-source-code" id="M000028-source">
|
205
|
+
<pre>
|
206
|
+
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 77</span>
|
207
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
|
208
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@func</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'_add'</span>
|
209
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"\n"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
|
210
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">" (reverse _buf))\n"</span>
|
211
|
+
<span class="ruby-keyword kw">end</span>
|
212
|
+
</pre>
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div id="method-M000020" class="method-detail">
|
218
|
+
<a name="M000020"></a>
|
219
|
+
|
220
|
+
<div class="method-heading">
|
221
|
+
<a href="#M000020" class="method-signature">
|
222
|
+
<span class="method-name">add_preamble</span><span class="method-args">(src)</span>
|
223
|
+
</a>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
<div class="method-description">
|
227
|
+
<p><a class="source-toggle" href="#"
|
228
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
229
|
+
<div class="method-source-code" id="M000020-source">
|
230
|
+
<pre>
|
231
|
+
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 29</span>
|
232
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
|
233
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@func</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'_add'</span>
|
234
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"(let ((_buf '())) "</span> <span class="ruby-operator">+</span> \
|
235
|
+
<span class="ruby-value str">"(define (_add x) (set! _buf (cons x _buf))) "</span>
|
236
|
+
<span class="ruby-comment cmt">#src << "(let* ((_buf '())" + # " (_add (lambda (x) (set! _buf (cons x _buf))))) "</span>
|
237
|
+
<span class="ruby-keyword kw">end</span>
|
238
|
+
</pre>
|
239
|
+
</div>
|
240
|
+
</div>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
<div id="method-M000024" class="method-detail">
|
244
|
+
<a name="M000024"></a>
|
245
|
+
|
246
|
+
<div class="method-heading">
|
247
|
+
<a href="#M000024" class="method-signature">
|
248
|
+
<span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
|
249
|
+
</a>
|
250
|
+
</div>
|
251
|
+
|
252
|
+
<div class="method-description">
|
253
|
+
<p><a class="source-toggle" href="#"
|
254
|
+
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
255
|
+
<div class="method-source-code" id="M000024-source">
|
256
|
+
<pre>
|
257
|
+
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 59</span>
|
258
|
+
<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>)
|
259
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">code</span>
|
260
|
+
<span class="ruby-keyword kw">end</span>
|
261
|
+
</pre>
|
262
|
+
</div>
|
263
|
+
</div>
|
264
|
+
</div>
|
265
|
+
|
266
|
+
<div id="method-M000023" class="method-detail">
|
267
|
+
<a name="M000023"></a>
|
268
|
+
|
269
|
+
<div class="method-heading">
|
270
|
+
<a href="#M000023" class="method-signature">
|
271
|
+
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
|
272
|
+
</a>
|
273
|
+
</div>
|
274
|
+
|
275
|
+
<div class="method-description">
|
276
|
+
<p><a class="source-toggle" href="#"
|
277
|
+
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
278
|
+
<div class="method-source-code" id="M000023-source">
|
279
|
+
<pre>
|
280
|
+
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 48</span>
|
281
|
+
<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>)
|
282
|
+
<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>
|
283
|
+
<span class="ruby-identifier">t</span> = <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
|
284
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">t</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
|
285
|
+
<span class="ruby-identifier">t</span>[<span class="ruby-value">-1</span>, <span class="ruby-value">1</span>] = <span class="ruby-value str">''</span>
|
286
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"(#{@func} \""</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">t</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"\\n\")\n"</span>
|
287
|
+
<span class="ruby-keyword kw">else</span>
|
288
|
+
<span class="ruby-identifier">src</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"(#{@func} \""</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">t</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'")'</span>
|
289
|
+
<span class="ruby-keyword kw">end</span>
|
290
|
+
<span class="ruby-keyword kw">end</span>
|
291
|
+
</pre>
|
292
|
+
</div>
|
293
|
+
</div>
|
294
|
+
</div>
|
295
|
+
|
296
|
+
<div id="method-M000021" class="method-detail">
|
297
|
+
<a name="M000021"></a>
|
298
|
+
|
299
|
+
<div class="method-heading">
|
300
|
+
<a href="#M000021" class="method-signature">
|
301
|
+
<span class="method-name">escape_text</span><span class="method-args">(text)</span>
|
302
|
+
</a>
|
303
|
+
</div>
|
304
|
+
|
305
|
+
<div class="method-description">
|
306
|
+
<p><a class="source-toggle" href="#"
|
307
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
308
|
+
<div class="method-source-code" id="M000021-source">
|
309
|
+
<pre>
|
310
|
+
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 37</span>
|
311
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
|
312
|
+
<span class="ruby-ivar">@table_</span> <span class="ruby-operator">||=</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> }
|
313
|
+
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/["\\]/</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>] }
|
314
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">text</span>
|
315
|
+
<span class="ruby-keyword kw">end</span>
|
316
|
+
</pre>
|
317
|
+
</div>
|
318
|
+
</div>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
<div id="method-M000022" class="method-detail">
|
322
|
+
<a name="M000022"></a>
|
323
|
+
|
324
|
+
<div class="method-heading">
|
325
|
+
<a href="#M000022" class="method-signature">
|
326
|
+
<span class="method-name">escaped_expr</span><span class="method-args">(code)</span>
|
327
|
+
</a>
|
328
|
+
</div>
|
329
|
+
|
330
|
+
<div class="method-description">
|
331
|
+
<p><a class="source-toggle" href="#"
|
332
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
333
|
+
<div class="method-source-code" id="M000022-source">
|
334
|
+
<pre>
|
335
|
+
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 43</span>
|
336
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>)
|
337
|
+
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
|
338
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-node">"(#{@escapefunc} #{code})"</span>
|
339
|
+
<span class="ruby-keyword kw">end</span>
|
340
|
+
</pre>
|
341
|
+
</div>
|
342
|
+
</div>
|
343
|
+
</div>
|
344
|
+
|
345
|
+
<div id="method-M000019" class="method-detail">
|
346
|
+
<a name="M000019"></a>
|
347
|
+
|
348
|
+
<div class="method-heading">
|
349
|
+
<a href="#M000019" class="method-signature">
|
350
|
+
<span class="method-name">init_generator</span><span class="method-args">(properties={})</span>
|
351
|
+
</a>
|
352
|
+
</div>
|
353
|
+
|
354
|
+
<div class="method-description">
|
355
|
+
<p><a class="source-toggle" href="#"
|
356
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
357
|
+
<div class="method-source-code" id="M000019-source">
|
358
|
+
<pre>
|
359
|
+
<span class="ruby-comment cmt"># File erubis/engine/escheme.rb, line 23</span>
|
360
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
|
361
|
+
<span class="ruby-keyword kw">super</span>
|
362
|
+
<span class="ruby-ivar">@escapefunc</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'escape'</span>
|
363
|
+
<span class="ruby-ivar">@func</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:func</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'_add'</span> <span class="ruby-comment cmt"># or 'display'</span>
|
364
|
+
<span class="ruby-keyword kw">end</span>
|
365
|
+
</pre>
|
366
|
+
</div>
|
367
|
+
</div>
|
368
|
+
</div>
|
369
|
+
|
370
|
+
|
371
|
+
</div>
|
372
|
+
|
373
|
+
|
374
|
+
</div>
|
375
|
+
|
376
|
+
|
377
|
+
<div id="validator-badges">
|
378
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
379
|
+
</div>
|
380
|
+
|
381
|
+
</body>
|
382
|
+
</html>
|
@@ -74,7 +74,7 @@
|
|
74
74
|
|
75
75
|
<div id="description">
|
76
76
|
<p>
|
77
|
-
get
|
77
|
+
get convert faster, but spaces around ’<%…%>’ are
|
78
78
|
not trimmed.
|
79
79
|
</p>
|
80
80
|
<p>
|
@@ -90,7 +90,7 @@ this is language-independent.
|
|
90
90
|
<h3 class="section-bar">Methods</h3>
|
91
91
|
|
92
92
|
<div class="name-list">
|
93
|
-
<a href="#
|
93
|
+
<a href="#M000018">convert</a>
|
94
94
|
</div>
|
95
95
|
</div>
|
96
96
|
|
@@ -110,10 +110,10 @@ this is language-independent.
|
|
110
110
|
<tr class="top-aligned-row context-row">
|
111
111
|
<td class="context-item-name">SIMPLE_REGEXP</td>
|
112
112
|
<td>=</td>
|
113
|
-
<td class="context-item-value"
|
113
|
+
<td class="context-item-value">/<%(=+|\#)?(.*?)-?%>/m</td>
|
114
114
|
<td width="3em"> </td>
|
115
115
|
<td class="context-item-desc">
|
116
|
-
DEFAULT_REGEXP = /(
|
116
|
+
DEFAULT_REGEXP = /(^[ \t]*)?<%(=+|\#)?(.*?)-?%>([ \t]*\r?\n)?/m
|
117
117
|
|
118
118
|
</td>
|
119
119
|
</tr>
|
@@ -130,26 +130,30 @@ DEFAULT_REGEXP = /(.*?)(^[ \t]*)?<%(=+|\#)?(.*?)-?%>([ \t]*\r?\n)?/m
|
|
130
130
|
<div id="methods">
|
131
131
|
<h3 class="section-bar">Public Instance methods</h3>
|
132
132
|
|
133
|
-
<div id="method-
|
134
|
-
<a name="
|
133
|
+
<div id="method-M000018" class="method-detail">
|
134
|
+
<a name="M000018"></a>
|
135
135
|
|
136
136
|
<div class="method-heading">
|
137
|
-
<a href="#
|
138
|
-
<span class="method-name">
|
137
|
+
<a href="#M000018" class="method-signature">
|
138
|
+
<span class="method-name">convert</span><span class="method-args">(input)</span>
|
139
139
|
</a>
|
140
140
|
</div>
|
141
141
|
|
142
142
|
<div class="method-description">
|
143
143
|
<p><a class="source-toggle" href="#"
|
144
|
-
onclick="toggleCode('
|
145
|
-
<div class="method-source-code" id="
|
144
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
145
|
+
<div class="method-source-code" id="M000018-source">
|
146
146
|
<pre>
|
147
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
148
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">
|
147
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 320</span>
|
148
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
|
149
149
|
<span class="ruby-identifier">src</span> = <span class="ruby-value str">""</span>
|
150
150
|
<span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
|
151
151
|
<span class="ruby-comment cmt">#regexp = pattern_regexp(@pattern)</span>
|
152
|
-
<span class="ruby-identifier">
|
152
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
|
153
|
+
<span class="ruby-identifier">input</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-constant">SIMPLE_REGEXP</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">indicator</span>, <span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
|
154
|
+
<span class="ruby-identifier">index</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>)
|
155
|
+
<span class="ruby-identifier">text</span> = <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">index</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">pos</span>]
|
156
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">index</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$&</span>.<span class="ruby-identifier">length</span>()
|
153
157
|
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
|
154
158
|
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">indicator</span> <span class="ruby-comment cmt"># <% %></span>
|
155
159
|
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
|