erubis 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{ChangeLog → CHANGES} +139 -6
- data/MIT-LICENSE +20 -0
- data/README.txt +20 -5
- data/benchmark/erubybench.rb +465 -229
- data/benchmark/erubybench.rhtml +39 -15
- data/benchmark/erubybench.yaml +126 -46
- data/bin/erubis +2 -2
- data/bin/notext +3 -3
- data/contrib/action_view_base_rb.patch +23 -0
- data/contrib/erubis +466 -308
- data/contrib/inline-require +2 -2
- data/doc-api/classes/ERB.html +101 -0
- data/doc-api/classes/Erubis.html +59 -6
- data/doc-api/classes/Erubis/ArrayEnhancer.html +12 -12
- data/doc-api/classes/Erubis/Basic/Converter.html +61 -57
- data/doc-api/classes/Erubis/BiPatternEnhancer.html +14 -14
- data/doc-api/classes/Erubis/CGenerator.html +60 -60
- data/doc-api/classes/Erubis/Context.html +125 -29
- data/doc-api/classes/Erubis/Converter.html +73 -22
- data/doc-api/classes/Erubis/Engine.html +55 -39
- data/doc-api/classes/Erubis/EscapeEnhancer.html +6 -6
- data/doc-api/classes/Erubis/Evaluator.html +19 -19
- data/doc-api/classes/Erubis/Generator.html +16 -10
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +14 -14
- data/doc-api/classes/Erubis/{Helper.html → Helpers.html} +5 -6
- data/doc-api/classes/Erubis/Helpers/RailsHelper.html +296 -0
- data/doc-api/classes/Erubis/JavaGenerator.html +54 -54
- data/doc-api/classes/Erubis/JavascriptGenerator.html +60 -60
- data/doc-api/classes/Erubis/Main.html +42 -30
- data/doc-api/classes/Erubis/NoCodeEnhancer.html +5 -5
- data/doc-api/classes/Erubis/NoTextEnhancer.html +7 -7
- data/doc-api/classes/Erubis/OptimizedEruby.html +6 -6
- data/doc-api/classes/Erubis/OptimizedGenerator.html +72 -72
- data/doc-api/classes/Erubis/OptimizedXmlEruby.html +6 -6
- data/doc-api/classes/Erubis/PI/Converter.html +28 -81
- data/doc-api/classes/Erubis/PI/Ec.html +6 -6
- data/doc-api/classes/Erubis/PI/Ejava.html +6 -6
- data/doc-api/classes/Erubis/PI/Ejavascript.html +6 -6
- data/doc-api/classes/Erubis/PI/Eperl.html +6 -6
- data/doc-api/classes/Erubis/PI/Ephp.html +6 -6
- data/doc-api/classes/Erubis/PI/Eruby.html +7 -7
- data/doc-api/classes/Erubis/PI/Escheme.html +6 -6
- data/doc-api/classes/Erubis/PI/TinyEruby.html +66 -79
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +8 -8
- data/doc-api/classes/Erubis/PerlGenerator.html +54 -54
- data/doc-api/classes/Erubis/PhpGenerator.html +54 -54
- data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +21 -21
- data/doc-api/classes/Erubis/PrintOutEnhancer.html +30 -30
- data/doc-api/classes/Erubis/RubyEvaluator.html +12 -12
- data/doc-api/classes/Erubis/RubyGenerator.html +9 -9
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +7 -6
- data/doc-api/classes/Erubis/StdoutEnhancer.html +12 -12
- data/doc-api/classes/Erubis/StringBufferEnhancer.html +13 -13
- data/doc-api/classes/Erubis/TinyEruby.html +56 -68
- data/doc-api/classes/Erubis/XmlHelper.html +20 -23
- data/doc-api/created.rid +1 -1
- data/doc-api/files/{__/README_txt.html → README_txt.html} +35 -20
- data/doc-api/files/erubis/context_rb.html +2 -2
- data/doc-api/files/erubis/converter_rb.html +2 -2
- data/doc-api/files/erubis/engine/ec_rb.html +2 -2
- data/doc-api/files/erubis/engine/ejava_rb.html +2 -2
- data/doc-api/files/erubis/engine/ejavascript_rb.html +2 -2
- data/doc-api/files/erubis/engine/enhanced_rb.html +2 -2
- data/doc-api/files/erubis/engine/eperl_rb.html +2 -2
- data/doc-api/files/erubis/engine/ephp_rb.html +2 -2
- data/doc-api/files/erubis/engine/eruby_rb.html +2 -3
- data/doc-api/files/erubis/engine/escheme_rb.html +2 -2
- data/doc-api/files/erubis/engine/optimized_rb.html +2 -2
- data/doc-api/files/erubis/engine_rb.html +2 -2
- data/doc-api/files/erubis/enhancer_rb.html +2 -2
- data/doc-api/files/erubis/error_rb.html +2 -2
- data/doc-api/files/erubis/evaluator_rb.html +2 -2
- data/doc-api/files/erubis/generator_rb.html +2 -2
- data/doc-api/files/erubis/helper_rb.html +2 -2
- data/doc-api/files/erubis/{helper/rails_rb.html → helpers/rails_helper_rb.html} +6 -31
- data/doc-api/files/erubis/local-setting_rb.html +2 -2
- data/doc-api/files/erubis/main_rb.html +4 -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 +3 -3
- data/doc-api/fr_file_index.html +2 -2
- data/doc-api/fr_method_index.html +142 -147
- data/doc-api/index.html +1 -1
- data/doc/users-guide.html +387 -218
- data/lib/erubis.rb +21 -25
- data/lib/erubis/context.rb +34 -4
- data/lib/erubis/converter.rb +159 -115
- data/lib/erubis/engine.rb +29 -12
- data/lib/erubis/engine/ec.rb +2 -2
- data/lib/erubis/engine/ejava.rb +2 -2
- data/lib/erubis/engine/ejavascript.rb +2 -2
- data/lib/erubis/engine/enhanced.rb +2 -2
- data/lib/erubis/engine/eperl.rb +2 -2
- data/lib/erubis/engine/ephp.rb +2 -2
- data/lib/erubis/engine/eruby.rb +5 -6
- data/lib/erubis/engine/escheme.rb +2 -2
- data/lib/erubis/engine/optimized.rb +2 -2
- data/lib/erubis/enhancer.rb +33 -7
- data/lib/erubis/error.rb +2 -2
- data/lib/erubis/evaluator.rb +2 -2
- data/lib/erubis/generator.rb +6 -3
- data/lib/erubis/helper.rb +6 -23
- data/lib/erubis/helpers/rails_helper.rb +202 -0
- data/lib/erubis/local-setting.rb +4 -4
- data/lib/erubis/main.rb +90 -35
- data/lib/erubis/tiny.rb +57 -52
- data/test/assert-text-equal.rb +2 -2
- data/test/test-engines.rb +5 -5
- data/test/test-erubis.rb +173 -63
- data/test/test-main.rb +135 -27
- data/test/test-notext.rb +2 -2
- data/test/test.rb +2 -2
- data/test/testutil.rb +2 -2
- metadata +16 -16
- data/LGPL +0 -504
- data/doc-api/classes/Erubis/Helper/CachedRailsTemplate.html +0 -198
- data/doc-api/classes/Erubis/Helper/RailsTemplate.html +0 -366
- data/lib/erubis/helper/rails.rb +0 -159
data/test/test-erubis.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
##
|
|
2
|
-
## $Rev:
|
|
3
|
-
## $Release: 2.
|
|
4
|
-
## copyright(c) 2006 kuwata-lab all rights reserved.
|
|
2
|
+
## $Rev: 60 $
|
|
3
|
+
## $Release: 2.2.0 $
|
|
4
|
+
## copyright(c) 2006-2007 kuwata-lab all rights reserved.
|
|
5
5
|
##
|
|
6
6
|
|
|
7
7
|
require "#{File.dirname(__FILE__)}/test.rb"
|
|
@@ -41,20 +41,22 @@ class ErubisTest < Test::Unit::TestCase
|
|
|
41
41
|
end
|
|
42
42
|
end if @chomp
|
|
43
43
|
|
|
44
|
-
if @testopt
|
|
45
|
-
if @klass == Erubis::TinyEruby
|
|
46
|
-
eruby = @klass.new(@input)
|
|
47
|
-
else
|
|
48
|
-
eruby = @klass.new(@input, @options)
|
|
49
|
-
end
|
|
50
|
-
else
|
|
44
|
+
if @testopt == 'load_file'
|
|
51
45
|
filename = "tmp.#{@name}.eruby"
|
|
52
46
|
begin
|
|
53
47
|
File.open(filename, 'w') { |f| f.write(@input) }
|
|
54
48
|
eruby = @klass.load_file(filename, @options)
|
|
55
49
|
ensure
|
|
50
|
+
cachename = filename + '.cache'
|
|
51
|
+
File.unlink(cachename) if test(?f, cachename)
|
|
56
52
|
File.unlink(filename) if test(?f, filename)
|
|
57
53
|
end
|
|
54
|
+
else
|
|
55
|
+
if @klass == Erubis::TinyEruby
|
|
56
|
+
eruby = @klass.new(@input)
|
|
57
|
+
else
|
|
58
|
+
eruby = @klass.new(@input, @options)
|
|
59
|
+
end
|
|
58
60
|
end
|
|
59
61
|
assert_text_equal(@src, eruby.src)
|
|
60
62
|
|
|
@@ -96,6 +98,62 @@ class ErubisTest < Test::Unit::TestCase
|
|
|
96
98
|
end
|
|
97
99
|
end
|
|
98
100
|
|
|
101
|
+
|
|
102
|
+
def test_load_file_cache1
|
|
103
|
+
@input = <<END
|
|
104
|
+
<ul>
|
|
105
|
+
<% for item in @list %>
|
|
106
|
+
<li><%= item %></li>
|
|
107
|
+
<% end %>
|
|
108
|
+
</ul>
|
|
109
|
+
END
|
|
110
|
+
@src = <<END
|
|
111
|
+
_buf = ''; _buf << '<ul>
|
|
112
|
+
'; for item in @list
|
|
113
|
+
_buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
114
|
+
'; end
|
|
115
|
+
_buf << '</ul>
|
|
116
|
+
';
|
|
117
|
+
_buf.to_s
|
|
118
|
+
END
|
|
119
|
+
@klass = Erubis::Eruby
|
|
120
|
+
filename = 'tmp.load_file_timestamp1'
|
|
121
|
+
cachename = filename + '.cache'
|
|
122
|
+
begin
|
|
123
|
+
File.open(filename, 'w') { |f| f.write(@input) }
|
|
124
|
+
assert_block() { !test(?f, cachename) }
|
|
125
|
+
engine = @klass.load_file(filename)
|
|
126
|
+
assert_block() { test(?f, cachename) }
|
|
127
|
+
assert_block() { File.mtime(filename) <= File.mtime(cachename) }
|
|
128
|
+
assert_text_equal(@src, engine.src)
|
|
129
|
+
#
|
|
130
|
+
input2 = @input.gsub(/ul>/, 'ol>')
|
|
131
|
+
src2 = @src.gsub(/ul>/, 'ol>')
|
|
132
|
+
mtime = File.mtime(filename)
|
|
133
|
+
File.open(filename, 'w') { |f| f.write(input2) }
|
|
134
|
+
t1 = Time.now()
|
|
135
|
+
sleep(1)
|
|
136
|
+
t2 = Time.now()
|
|
137
|
+
File.utime(t1, t1, filename)
|
|
138
|
+
File.utime(t2, t2, cachename)
|
|
139
|
+
assert_block('cache should be newer') { File.mtime(filename) < File.mtime(cachename) }
|
|
140
|
+
engine = @klass.load_file(filename)
|
|
141
|
+
assert_block('cache should be newer') { File.mtime(filename) < File.mtime(cachename) }
|
|
142
|
+
assert_text_equal(@src, engine.src)
|
|
143
|
+
#
|
|
144
|
+
File.utime(t2, t2, filename)
|
|
145
|
+
File.utime(t1, t1, cachename)
|
|
146
|
+
assert_block('cache should be older') { File.mtime(filename) > File.mtime(cachename) }
|
|
147
|
+
engine = @klass.load_file(filename)
|
|
148
|
+
assert_block('cache should be newer') { File.mtime(filename) <= File.mtime(cachename) }
|
|
149
|
+
assert_text_equal(src2, engine.src)
|
|
150
|
+
ensure
|
|
151
|
+
File.unlink(cachename) if File.file?(cachename)
|
|
152
|
+
File.unlink(filename) if File.file?(filename)
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
|
|
99
157
|
end
|
|
100
158
|
|
|
101
159
|
__END__
|
|
@@ -106,14 +164,14 @@ __END__
|
|
|
106
164
|
<li><%= item %></li>
|
|
107
165
|
<% end %>
|
|
108
166
|
</ul>
|
|
109
|
-
src: |
|
|
110
|
-
_buf =
|
|
167
|
+
src: &basic1_src|
|
|
168
|
+
_buf = ''; _buf << '<ul>
|
|
111
169
|
'; for item in list
|
|
112
170
|
_buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
113
171
|
'; end
|
|
114
172
|
_buf << '</ul>
|
|
115
173
|
';
|
|
116
|
-
_buf.
|
|
174
|
+
_buf.to_s
|
|
117
175
|
output: &basic1_output|
|
|
118
176
|
<ul>
|
|
119
177
|
<li><aaa></li>
|
|
@@ -133,7 +191,7 @@ __END__
|
|
|
133
191
|
<% end %>
|
|
134
192
|
</ul>
|
|
135
193
|
src: |
|
|
136
|
-
_buf =
|
|
194
|
+
_buf = ''; _buf << '<ul>
|
|
137
195
|
'; i = 0
|
|
138
196
|
for item in list
|
|
139
197
|
i += 1
|
|
@@ -142,7 +200,7 @@ __END__
|
|
|
142
200
|
'; end
|
|
143
201
|
_buf << '</ul>
|
|
144
202
|
';
|
|
145
|
-
_buf.
|
|
203
|
+
_buf.to_s
|
|
146
204
|
output: *basic1_output
|
|
147
205
|
# <ul>
|
|
148
206
|
# <li><aaa></li>
|
|
@@ -158,12 +216,12 @@ __END__
|
|
|
158
216
|
i += 1 %><li><%= item %></li><% end %>
|
|
159
217
|
</ul>
|
|
160
218
|
src: |
|
|
161
|
-
_buf =
|
|
219
|
+
_buf = ''; _buf << '<ul>'; i = 0
|
|
162
220
|
for item in list
|
|
163
221
|
i += 1 ; _buf << '<li>'; _buf << ( item ).to_s; _buf << '</li>'; end ; _buf << '
|
|
164
222
|
'; _buf << '</ul>
|
|
165
223
|
';
|
|
166
|
-
_buf.
|
|
224
|
+
_buf.to_s
|
|
167
225
|
output: |
|
|
168
226
|
<ul><li><aaa></li><li>b&b</li><li>"ccc"</li>
|
|
169
227
|
</ul>
|
|
@@ -178,13 +236,13 @@ __END__
|
|
|
178
236
|
<% end %>
|
|
179
237
|
</ul>
|
|
180
238
|
src: |
|
|
181
|
-
_buf =
|
|
239
|
+
_buf = ''; _buf << '<ul>
|
|
182
240
|
'; for item in @list
|
|
183
241
|
_buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
184
242
|
'; end
|
|
185
243
|
_buf << '</ul>
|
|
186
244
|
';
|
|
187
|
-
_buf.
|
|
245
|
+
_buf.to_s
|
|
188
246
|
output: *basic1_output
|
|
189
247
|
|
|
190
248
|
##
|
|
@@ -201,7 +259,7 @@ __END__
|
|
|
201
259
|
<% end %>
|
|
202
260
|
</ul>
|
|
203
261
|
src: |
|
|
204
|
-
_buf =
|
|
262
|
+
_buf = ''; _buf << '<ul>
|
|
205
263
|
';
|
|
206
264
|
for item in list
|
|
207
265
|
|
|
@@ -212,7 +270,7 @@ __END__
|
|
|
212
270
|
'; end
|
|
213
271
|
_buf << '</ul>
|
|
214
272
|
';
|
|
215
|
-
_buf.
|
|
273
|
+
_buf.to_s
|
|
216
274
|
output: |
|
|
217
275
|
<ul>
|
|
218
276
|
<li> : <aaa> </li>
|
|
@@ -229,13 +287,26 @@ __END__
|
|
|
229
287
|
b = "\""
|
|
230
288
|
c = '\''
|
|
231
289
|
src: |
|
|
232
|
-
_buf =
|
|
290
|
+
_buf = ''; _buf << 'a = "\'"
|
|
233
291
|
b = "\\""
|
|
234
292
|
c = \'\\\'\'
|
|
235
293
|
';
|
|
236
|
-
_buf.
|
|
294
|
+
_buf.to_s
|
|
237
295
|
output: *quotation1_input
|
|
238
296
|
|
|
297
|
+
##
|
|
298
|
+
- name: minus1
|
|
299
|
+
desc: '<%- -%>'
|
|
300
|
+
class: Eruby
|
|
301
|
+
input: |
|
|
302
|
+
<ul>
|
|
303
|
+
<%- for item in list -%>
|
|
304
|
+
<li><%= item -%></li>
|
|
305
|
+
<% end -%>
|
|
306
|
+
</ul>
|
|
307
|
+
src: *basic1_src
|
|
308
|
+
output: *basic1_output
|
|
309
|
+
|
|
239
310
|
##
|
|
240
311
|
- name: pattern1
|
|
241
312
|
options:
|
|
@@ -247,13 +318,13 @@ __END__
|
|
|
247
318
|
[@ end @]
|
|
248
319
|
</ul>
|
|
249
320
|
src: |
|
|
250
|
-
_buf =
|
|
321
|
+
_buf = ''; _buf << '<ul>
|
|
251
322
|
'; for item in list
|
|
252
323
|
_buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
253
324
|
'; end
|
|
254
325
|
_buf << '</ul>
|
|
255
326
|
';
|
|
256
|
-
_buf.
|
|
327
|
+
_buf.to_s
|
|
257
328
|
output: *basic1_output
|
|
258
329
|
# <ul>
|
|
259
330
|
# <li><aaa></li>
|
|
@@ -272,13 +343,13 @@ __END__
|
|
|
272
343
|
<!--% end %-->
|
|
273
344
|
</ul>
|
|
274
345
|
src: |
|
|
275
|
-
_buf =
|
|
346
|
+
_buf = ''; _buf << '<ul>
|
|
276
347
|
'; for item in list
|
|
277
348
|
_buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
278
349
|
'; end
|
|
279
350
|
_buf << '</ul>
|
|
280
351
|
';
|
|
281
|
-
_buf.
|
|
352
|
+
_buf.to_s
|
|
282
353
|
output: *basic1_output
|
|
283
354
|
# <ul>
|
|
284
355
|
# <li><aaa></li>
|
|
@@ -297,13 +368,13 @@ __END__
|
|
|
297
368
|
# <% end %>
|
|
298
369
|
# </ul>
|
|
299
370
|
src: |
|
|
300
|
-
_buf =
|
|
371
|
+
_buf = ''; _buf << '<ul>
|
|
301
372
|
'; _buf << ' '; for item in list ; _buf << '
|
|
302
373
|
'; _buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
303
374
|
'; _buf << ' '; end ; _buf << '
|
|
304
375
|
'; _buf << '</ul>
|
|
305
376
|
';
|
|
306
|
-
_buf.
|
|
377
|
+
_buf.to_s
|
|
307
378
|
output: |
|
|
308
379
|
<ul>
|
|
309
380
|
^
|
|
@@ -349,7 +420,7 @@ __END__
|
|
|
349
420
|
# _buf << "</ul>\n"
|
|
350
421
|
# _buf
|
|
351
422
|
src:
|
|
352
|
-
"_buf =
|
|
423
|
+
"_buf = ''; _buf << '<ul>\r\n'; for item in list \r\n _buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>\r\n'; end \r\n _buf << '</ul>\r\n';\n_buf.to_s\n"
|
|
353
424
|
#output: |
|
|
354
425
|
# <ul>
|
|
355
426
|
# <li><aaa></li>
|
|
@@ -368,11 +439,11 @@ __END__
|
|
|
368
439
|
<li>foo</li>
|
|
369
440
|
</ul>
|
|
370
441
|
src: |
|
|
371
|
-
_buf =
|
|
442
|
+
_buf = ''; _buf << '<ul>
|
|
372
443
|
<li>foo</li>
|
|
373
444
|
</ul>
|
|
374
445
|
';
|
|
375
|
-
_buf.
|
|
446
|
+
_buf.to_s
|
|
376
447
|
output: *nomatch1
|
|
377
448
|
|
|
378
449
|
##
|
|
@@ -383,11 +454,11 @@ __END__
|
|
|
383
454
|
<%= str %>
|
|
384
455
|
<%== str %>
|
|
385
456
|
src: |
|
|
386
|
-
_buf =
|
|
457
|
+
_buf = ''; str = '<>&"'
|
|
387
458
|
_buf << Erubis::XmlHelper.escape_xml( str ); _buf << '
|
|
388
459
|
'; _buf << ( str ).to_s; _buf << '
|
|
389
460
|
';
|
|
390
|
-
_buf.
|
|
461
|
+
_buf.to_s
|
|
391
462
|
output: |
|
|
392
463
|
<>&"
|
|
393
464
|
<>&"
|
|
@@ -403,14 +474,14 @@ __END__
|
|
|
403
474
|
<% end %>
|
|
404
475
|
</pre>
|
|
405
476
|
src: |
|
|
406
|
-
_buf =
|
|
477
|
+
_buf = ''; _buf << '<pre>
|
|
407
478
|
'; for item in list
|
|
408
479
|
_buf << ' '; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '
|
|
409
480
|
'; _buf << ' '; _buf << ( item ).to_s; _buf << '
|
|
410
481
|
'; end
|
|
411
482
|
_buf << '</pre>
|
|
412
483
|
';
|
|
413
|
-
_buf.
|
|
484
|
+
_buf.to_s
|
|
414
485
|
output: |
|
|
415
486
|
<pre>
|
|
416
487
|
<aaa>
|
|
@@ -433,13 +504,13 @@ __END__
|
|
|
433
504
|
<%==== item["var#{n}"] %>
|
|
434
505
|
<% end %>
|
|
435
506
|
src: |
|
|
436
|
-
_buf =
|
|
507
|
+
_buf = ''; for item in list
|
|
437
508
|
_buf << ' '; _buf << Erubis::XmlHelper.escape_xml( item["var#{n}"] ); _buf << '
|
|
438
509
|
'; _buf << ' '; _buf << ( item["var#{n}"] ).to_s; _buf << '
|
|
439
510
|
'; _buf << ' '; $stderr.puts("*** debug: item[\"var\#{n}\"]=#{(item["var#{n}"]).inspect}"); _buf << '
|
|
440
511
|
'; _buf << ' '; _buf << '
|
|
441
512
|
'; end
|
|
442
|
-
_buf.
|
|
513
|
+
_buf.to_s
|
|
443
514
|
output: |
|
|
444
515
|
|
|
445
516
|
##
|
|
@@ -466,13 +537,13 @@ __END__
|
|
|
466
537
|
<% end %>
|
|
467
538
|
</ul>
|
|
468
539
|
src: |
|
|
469
|
-
@_buf = _buf =
|
|
540
|
+
@_buf = _buf = ''; _buf << '<ul>
|
|
470
541
|
'; for item in list
|
|
471
542
|
_buf << ' <li>'; print item ; _buf << '</li>
|
|
472
543
|
'; end
|
|
473
544
|
_buf << '</ul>
|
|
474
545
|
';
|
|
475
|
-
_buf.
|
|
546
|
+
_buf.to_s
|
|
476
547
|
output: *basic1_output
|
|
477
548
|
# <ul>
|
|
478
549
|
# <li><aaa></li>
|
|
@@ -536,6 +607,19 @@ __END__
|
|
|
536
607
|
- "</ul>\n"
|
|
537
608
|
|
|
538
609
|
##
|
|
610
|
+
- name: arraybuffer1
|
|
611
|
+
class: ArrayBufferEruby
|
|
612
|
+
input: *basic1_input
|
|
613
|
+
src: |
|
|
614
|
+
_buf = []; _buf << '<ul>
|
|
615
|
+
'; for item in list
|
|
616
|
+
_buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
617
|
+
'; end
|
|
618
|
+
_buf << '</ul>
|
|
619
|
+
';
|
|
620
|
+
_buf.join
|
|
621
|
+
output: *basic1_output
|
|
622
|
+
|
|
539
623
|
- name: stringbuffer1
|
|
540
624
|
class: StringBufferEruby
|
|
541
625
|
input: *basic1_input
|
|
@@ -551,7 +635,7 @@ __END__
|
|
|
551
635
|
'; end
|
|
552
636
|
_buf << '</ul>
|
|
553
637
|
';
|
|
554
|
-
_buf
|
|
638
|
+
_buf.to_s
|
|
555
639
|
output: *basic1_output
|
|
556
640
|
# <ul>
|
|
557
641
|
# <li><aaa></li>
|
|
@@ -564,14 +648,15 @@ __END__
|
|
|
564
648
|
class: NoTextEruby
|
|
565
649
|
input: *basic1_input
|
|
566
650
|
src: |
|
|
567
|
-
_buf =
|
|
651
|
+
_buf = '';
|
|
568
652
|
for item in list
|
|
569
653
|
_buf << ( item ).to_s;
|
|
570
654
|
end
|
|
571
655
|
|
|
572
|
-
_buf.
|
|
656
|
+
_buf.to_s
|
|
573
657
|
output: '<aaa>b&b"ccc"'
|
|
574
658
|
|
|
659
|
+
|
|
575
660
|
##
|
|
576
661
|
- name: nocode1
|
|
577
662
|
class: NoCodeEruby
|
|
@@ -597,7 +682,7 @@ __END__
|
|
|
597
682
|
<% end %>
|
|
598
683
|
</ul>
|
|
599
684
|
src: |
|
|
600
|
-
_buf =
|
|
685
|
+
_buf = ''; _buf << '<ul>
|
|
601
686
|
'; for item in list ; _buf << '
|
|
602
687
|
<li>
|
|
603
688
|
'; _buf << ( item ).to_s; _buf << '
|
|
@@ -605,7 +690,7 @@ __END__
|
|
|
605
690
|
'; end ; _buf << '
|
|
606
691
|
</ul>
|
|
607
692
|
';
|
|
608
|
-
_buf.
|
|
693
|
+
_buf.to_s
|
|
609
694
|
output: |
|
|
610
695
|
<ul>
|
|
611
696
|
^
|
|
@@ -633,11 +718,11 @@ __END__
|
|
|
633
718
|
[= item =] = [== item =]
|
|
634
719
|
<% end %>
|
|
635
720
|
src: |
|
|
636
|
-
_buf =
|
|
721
|
+
_buf = ''; for item in list
|
|
637
722
|
_buf << ' '; _buf << ( item ).to_s; _buf << ' % '; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '
|
|
638
723
|
'; _buf << ' '; _buf << ( item ).to_s; _buf << ' = '; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '
|
|
639
724
|
'; end
|
|
640
|
-
_buf.
|
|
725
|
+
_buf.to_s
|
|
641
726
|
output: |4
|
|
642
727
|
<aaa> % <aaa>
|
|
643
728
|
<aaa> = <aaa>
|
|
@@ -656,11 +741,11 @@ __END__
|
|
|
656
741
|
${item} = ${=item}
|
|
657
742
|
<% end %>
|
|
658
743
|
src: |
|
|
659
|
-
_buf =
|
|
744
|
+
_buf = ''; for item in list
|
|
660
745
|
_buf << ' '; _buf << (item).to_s; _buf << ' % '; _buf << Erubis::XmlHelper.escape_xml(item); _buf << '
|
|
661
746
|
'; _buf << ' '; _buf << (item).to_s; _buf << ' = '; _buf << Erubis::XmlHelper.escape_xml(item); _buf << '
|
|
662
747
|
'; end
|
|
663
|
-
_buf.
|
|
748
|
+
_buf.to_s
|
|
664
749
|
output: |4
|
|
665
750
|
<aaa> % <aaa>
|
|
666
751
|
<aaa> = <aaa>
|
|
@@ -687,7 +772,7 @@ __END__
|
|
|
687
772
|
% spaced percent
|
|
688
773
|
</pre>
|
|
689
774
|
src: |
|
|
690
|
-
_buf =
|
|
775
|
+
_buf = ''; _buf << '<table>
|
|
691
776
|
'; for item in list
|
|
692
777
|
_buf << ' <tr>
|
|
693
778
|
<td>'; _buf << ( item ).to_s; _buf << '</td>
|
|
@@ -700,7 +785,7 @@ __END__
|
|
|
700
785
|
'; _buf << ' % spaced percent
|
|
701
786
|
</pre>
|
|
702
787
|
';
|
|
703
|
-
_buf.
|
|
788
|
+
_buf.to_s
|
|
704
789
|
output: |
|
|
705
790
|
<table>
|
|
706
791
|
<tr>
|
|
@@ -740,13 +825,13 @@ __END__
|
|
|
740
825
|
|
|
741
826
|
def ordered_list(list)
|
|
742
827
|
|
|
743
|
-
_buf =
|
|
828
|
+
_buf = ''; _buf << '<ol>
|
|
744
829
|
'; for item in list
|
|
745
830
|
_buf << ' <li>'; _buf << Erubis::XmlHelper.escape_xml(item); _buf << '</li>
|
|
746
831
|
'; end
|
|
747
832
|
_buf << '</ol>
|
|
748
833
|
';
|
|
749
|
-
_buf.
|
|
834
|
+
_buf.to_s
|
|
750
835
|
end
|
|
751
836
|
output: |
|
|
752
837
|
<ol>
|
|
@@ -888,13 +973,13 @@ __END__
|
|
|
888
973
|
<% end %>
|
|
889
974
|
</ul>
|
|
890
975
|
src: |
|
|
891
|
-
_buf =
|
|
976
|
+
_buf = ''; _buf << '<ul>
|
|
892
977
|
'; for item in list ; _buf << '
|
|
893
978
|
<li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
894
979
|
'; end ; _buf << '
|
|
895
980
|
</ul>
|
|
896
981
|
';
|
|
897
|
-
_buf.
|
|
982
|
+
_buf.to_s
|
|
898
983
|
output: |
|
|
899
984
|
<ul>
|
|
900
985
|
^
|
|
@@ -917,13 +1002,13 @@ __END__
|
|
|
917
1002
|
<% end %>
|
|
918
1003
|
</ul>
|
|
919
1004
|
src: |
|
|
920
|
-
_buf =
|
|
1005
|
+
_buf = ''; _buf << '<ul>
|
|
921
1006
|
'; for item in @list ; _buf << '
|
|
922
1007
|
<li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
923
1008
|
'; end ; _buf << '
|
|
924
1009
|
</ul>
|
|
925
1010
|
';
|
|
926
|
-
_buf.
|
|
1011
|
+
_buf.to_s
|
|
927
1012
|
output: |
|
|
928
1013
|
<ul>
|
|
929
1014
|
^
|
|
@@ -947,14 +1032,14 @@ __END__
|
|
|
947
1032
|
<?rb end ?>
|
|
948
1033
|
</ul>
|
|
949
1034
|
src: &src_pi1|
|
|
950
|
-
_buf =
|
|
1035
|
+
_buf = ''; _buf << '<ul>
|
|
951
1036
|
'; for item in @list
|
|
952
1037
|
_buf << ' <li>'; _buf << Erubis::XmlHelper.escape_xml(item); _buf << ' / '; _buf << (item).to_s; _buf << '</li>
|
|
953
1038
|
<li>'; _buf << ( item ).to_s; _buf << ' / '; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << '</li>
|
|
954
1039
|
'; end
|
|
955
1040
|
_buf << '</ul>
|
|
956
1041
|
';
|
|
957
|
-
_buf.
|
|
1042
|
+
_buf.to_s
|
|
958
1043
|
output: &output_pi1|
|
|
959
1044
|
<ul>
|
|
960
1045
|
<li><aaa> / <aaa></li>
|
|
@@ -972,14 +1057,14 @@ __END__
|
|
|
972
1057
|
testopt: evaluate
|
|
973
1058
|
input: *input_pi1
|
|
974
1059
|
src: |
|
|
975
|
-
_buf =
|
|
1060
|
+
_buf = ''; _buf << '<ul>
|
|
976
1061
|
'; for item in @list
|
|
977
1062
|
_buf << ' <li>'; _buf << (item).to_s; _buf << ' / '; _buf << Erubis::XmlHelper.escape_xml(item); _buf << '</li>
|
|
978
1063
|
<li>'; _buf << Erubis::XmlHelper.escape_xml( item ); _buf << ' / '; _buf << ( item ).to_s; _buf << '</li>
|
|
979
1064
|
'; end
|
|
980
1065
|
_buf << '</ul>
|
|
981
1066
|
';
|
|
982
|
-
_buf.
|
|
1067
|
+
_buf.to_s
|
|
983
1068
|
output: |
|
|
984
1069
|
<ul>
|
|
985
1070
|
<li><aaa> / <aaa></li>
|
|
@@ -1029,7 +1114,7 @@ __END__
|
|
|
1029
1114
|
|
|
1030
1115
|
def show(list)
|
|
1031
1116
|
|
|
1032
|
-
_buf =
|
|
1117
|
+
_buf = ''; _buf << '<ul>
|
|
1033
1118
|
'; for item in list
|
|
1034
1119
|
_buf << ( item
|
|
1035
1120
|
).to_s; end
|
|
@@ -1039,7 +1124,7 @@ __END__
|
|
|
1039
1124
|
|
|
1040
1125
|
_buf << '</ul>
|
|
1041
1126
|
';
|
|
1042
|
-
_buf.
|
|
1127
|
+
_buf.to_s
|
|
1043
1128
|
|
|
1044
1129
|
end
|
|
1045
1130
|
show(@list)
|
|
@@ -1048,3 +1133,28 @@ __END__
|
|
|
1048
1133
|
<ul>
|
|
1049
1134
|
<aaa>b&b"ccc"</ul>
|
|
1050
1135
|
|
|
1136
|
+
|
|
1137
|
+
- name: pitiny1
|
|
1138
|
+
class: PI::TinyEruby
|
|
1139
|
+
testopt: evaluate
|
|
1140
|
+
input: |
|
|
1141
|
+
<ul>
|
|
1142
|
+
<?rb for item in @list ?>
|
|
1143
|
+
<li>@{item}@ / @!{item}@</li>
|
|
1144
|
+
<?rb end ?>
|
|
1145
|
+
</ul>
|
|
1146
|
+
src: |
|
|
1147
|
+
_buf = ''; _buf << '<ul>
|
|
1148
|
+
'; for item in @list
|
|
1149
|
+
_buf << ' <li>'; _buf << Erubis::XmlHelper.escape_xml(item); _buf << ' / '; _buf << (item).to_s; _buf << '</li>
|
|
1150
|
+
'; end
|
|
1151
|
+
_buf << '</ul>
|
|
1152
|
+
';
|
|
1153
|
+
_buf.to_s
|
|
1154
|
+
output: |
|
|
1155
|
+
<ul>
|
|
1156
|
+
<li><aaa> / <aaa></li>
|
|
1157
|
+
<li>b&b / b&b</li>
|
|
1158
|
+
<li>"ccc" / "ccc"</li>
|
|
1159
|
+
</ul>
|
|
1160
|
+
|