erubis 2.6.1 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +16 -2
- data/README.txt +2 -1
- data/benchmark/bench.rb +1 -1
- data/bin/erubis +1 -1
- data/contrib/erubis +1 -1
- data/contrib/inline-require +1 -1
- data/doc-api/classes/Erubis.html +1 -1
- data/doc-api/classes/Erubis/Basic/Converter.html +3 -2
- data/doc-api/classes/Erubis/BiPatternEnhancer.html +6 -3
- data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +1 -1
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +6 -3
- data/doc-api/classes/Erubis/InterpolationEnhancer.html +7 -6
- data/doc-api/classes/Erubis/Main.html +26 -26
- data/doc-api/classes/Erubis/PI/Converter.html +5 -4
- data/doc-api/classes/Erubis/PI/TinyEruby.html +6 -5
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +3 -2
- data/doc-api/classes/Erubis/RubyEvaluator.html +18 -13
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +2 -1
- data/doc-api/classes/Erubis/TinyEruby.html +4 -3
- data/doc-api/created.rid +1 -1
- data/doc-api/files/README_txt.html +4 -3
- data/doc-api/files/erubis/context_rb.html +1 -1
- data/doc-api/files/erubis/converter_rb.html +2 -2
- data/doc-api/files/erubis/engine/ec_rb.html +1 -1
- data/doc-api/files/erubis/engine/ejava_rb.html +1 -1
- data/doc-api/files/erubis/engine/ejavascript_rb.html +1 -1
- data/doc-api/files/erubis/engine/enhanced_rb.html +1 -1
- data/doc-api/files/erubis/engine/eperl_rb.html +1 -1
- data/doc-api/files/erubis/engine/ephp_rb.html +1 -1
- data/doc-api/files/erubis/engine/eruby_rb.html +1 -1
- data/doc-api/files/erubis/engine/escheme_rb.html +1 -1
- data/doc-api/files/erubis/engine/optimized_rb.html +1 -1
- data/doc-api/files/erubis/engine_rb.html +1 -1
- data/doc-api/files/erubis/enhancer_rb.html +2 -2
- data/doc-api/files/erubis/error_rb.html +1 -1
- data/doc-api/files/erubis/evaluator_rb.html +2 -2
- data/doc-api/files/erubis/generator_rb.html +1 -1
- data/doc-api/files/erubis/helper_rb.html +1 -1
- data/doc-api/files/erubis/helpers/rails_form_helper_rb.html +1 -1
- data/doc-api/files/erubis/helpers/rails_helper_rb.html +1 -1
- data/doc-api/files/erubis/local-setting_rb.html +1 -1
- data/doc-api/files/erubis/main_rb.html +2 -2
- data/doc-api/files/erubis/preprocessing_rb.html +1 -1
- data/doc-api/files/erubis/tiny_rb.html +2 -2
- data/doc-api/files/erubis_rb.html +1 -1
- data/doc/users-guide.html +13 -11
- data/lib/erubis.rb +2 -2
- data/lib/erubis/context.rb +1 -1
- data/lib/erubis/converter.rb +6 -4
- data/lib/erubis/engine.rb +1 -1
- data/lib/erubis/engine/ec.rb +1 -1
- data/lib/erubis/engine/ejava.rb +1 -1
- data/lib/erubis/engine/ejavascript.rb +1 -1
- data/lib/erubis/engine/enhanced.rb +1 -1
- data/lib/erubis/engine/eperl.rb +1 -1
- data/lib/erubis/engine/ephp.rb +1 -1
- data/lib/erubis/engine/eruby.rb +1 -1
- data/lib/erubis/engine/escheme.rb +1 -1
- data/lib/erubis/engine/optimized.rb +1 -1
- data/lib/erubis/enhancer.rb +16 -7
- data/lib/erubis/error.rb +1 -1
- data/lib/erubis/evaluator.rb +17 -12
- data/lib/erubis/generator.rb +1 -1
- data/lib/erubis/helper.rb +1 -1
- data/lib/erubis/helpers/rails_form_helper.rb +1 -1
- data/lib/erubis/helpers/rails_helper.rb +1 -1
- data/lib/erubis/local-setting.rb +1 -1
- data/lib/erubis/main.rb +32 -31
- data/lib/erubis/preprocessing.rb +1 -1
- data/lib/erubis/tiny.rb +6 -4
- data/test/assert-text-equal.rb +1 -1
- data/test/assert-text-equal.rbc +0 -0
- data/test/data/users-guide/example1.rb +1 -0
- data/test/data/users-guide/main_program2.result +1 -1
- data/test/hoge.rb +5 -0
- data/test/test-engines.rb +5 -2
- data/test/test-engines.rbc +0 -0
- data/test/test-enhancers.rb +4 -2
- data/test/test-erubis.rb +11 -5
- data/test/test-erubis.rbc +0 -0
- data/test/test-main.rb +27 -6
- data/test/test-users-guide.rb +4 -2
- data/test/test-users-guide.rbc +0 -0
- data/test/test.rb +1 -1
- data/test/test.rbc +0 -0
- data/test/testutil.rb +29 -3
- data/test/testutil.rbc +0 -0
- metadata +9 -4
- data/lib/erubis/converter.rb: +0 -0
- data/test/data/users-guide/stderr.log +0 -3
Binary file
|
@@ -8,6 +8,7 @@ puts eruby.src # print script source
|
|
8
8
|
puts "---------- result ----------"
|
9
9
|
list = ['aaa', 'bbb', 'ccc']
|
10
10
|
puts eruby.result(binding()) # get result
|
11
|
+
## or puts eruby.result(:list=>list) # or pass Hash instead of Binding
|
11
12
|
|
12
13
|
## # or
|
13
14
|
## eruby = Erubis::Eruby.new
|
data/test/hoge.rb
ADDED
data/test/test-engines.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
|
-
## $Rev:
|
3
|
-
## $Release: 2.6.
|
2
|
+
## $Rev: 115 $
|
3
|
+
## $Release: 2.6.2 $
|
4
4
|
## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
|
5
5
|
##
|
6
6
|
|
@@ -29,6 +29,9 @@ class EnginesTest < Test::Unit::TestCase
|
|
29
29
|
assert_text_equal(@expected, actual)
|
30
30
|
end
|
31
31
|
|
32
|
+
|
33
|
+
self.post_definition()
|
34
|
+
|
32
35
|
end
|
33
36
|
|
34
37
|
__END__
|
Binary file
|
data/test/test-enhancers.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
|
-
## $Rev:
|
3
|
-
## $Release: 2.6.
|
2
|
+
## $Rev: 115 $
|
3
|
+
## $Release: 2.6.2 $
|
4
4
|
## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
|
5
5
|
##
|
6
6
|
|
@@ -98,6 +98,8 @@ class EnhancersTest < Test::Unit::TestCase
|
|
98
98
|
end
|
99
99
|
|
100
100
|
|
101
|
+
self.post_definition()
|
102
|
+
|
101
103
|
end
|
102
104
|
|
103
105
|
__END__
|
data/test/test-erubis.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
|
-
## $Rev:
|
3
|
-
## $Release: 2.6.
|
2
|
+
## $Rev: 115 $
|
3
|
+
## $Release: 2.6.2 $
|
4
4
|
## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
|
5
5
|
##
|
6
6
|
|
@@ -157,12 +157,16 @@ END
|
|
157
157
|
class Dummy
|
158
158
|
end
|
159
159
|
|
160
|
+
def _class_has_instance_method(klass, method)
|
161
|
+
return klass.instance_methods.collect{|m| m.to_s}.include?(method.to_s)
|
162
|
+
end
|
163
|
+
|
160
164
|
def test_def_method1
|
161
165
|
s = "<%for i in list%>i=<%=i%>\n<%end%>"
|
162
166
|
eruby = Erubis::Eruby.new(s)
|
163
|
-
assert(! Dummy
|
167
|
+
assert(! _class_has_instance_method(Dummy, 'render'))
|
164
168
|
eruby.def_method(Dummy, 'render(list)', 'foo.rhtml')
|
165
|
-
assert(Dummy
|
169
|
+
assert(_class_has_instance_method(Dummy, 'render'))
|
166
170
|
actual = Dummy.new().render(%w[1 2 3])
|
167
171
|
assert_equal("i=1\ni=2\ni=3\n", actual)
|
168
172
|
end
|
@@ -175,7 +179,7 @@ END
|
|
175
179
|
assert eruby.respond_to?(:render)
|
176
180
|
actual = eruby.render([1, 2, 3])
|
177
181
|
assert_equal("i=1\ni=2\ni=3\n", actual)
|
178
|
-
assert
|
182
|
+
assert(! _class_has_instance_method(eruby.class, 'render'))
|
179
183
|
end
|
180
184
|
|
181
185
|
def test_evaluate_creates_proc
|
@@ -203,6 +207,8 @@ END
|
|
203
207
|
# puts "*** actual=#{actual.inspect}, x=#{_x.inspect}, y=#{_y.inspect}"
|
204
208
|
#end
|
205
209
|
|
210
|
+
self.post_definition()
|
211
|
+
|
206
212
|
end
|
207
213
|
|
208
214
|
x = 10
|
Binary file
|
data/test/test-main.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
##
|
2
|
-
## $Rev:
|
3
|
-
## $Release: 2.6.
|
4
|
-
## $Date:
|
2
|
+
## $Rev: 116 $
|
3
|
+
## $Release: 2.6.2 $
|
4
|
+
## $Date: 2008-06-12 21:08:47 +0900 (Thu, 12 Jun 2008) $
|
5
5
|
##
|
6
6
|
|
7
7
|
require "#{File.dirname(__FILE__)}/test.rb"
|
@@ -22,6 +22,9 @@ class StringWriter < String
|
|
22
22
|
def write(arg)
|
23
23
|
self << arg
|
24
24
|
end
|
25
|
+
def flush(*args)
|
26
|
+
# pass
|
27
|
+
end
|
25
28
|
end
|
26
29
|
|
27
30
|
class Erubis::Main
|
@@ -144,6 +147,7 @@ END
|
|
144
147
|
end
|
145
148
|
if @filename.nil?
|
146
149
|
method = (caller[0] =~ /in `(.*)'/) && $1 #'
|
150
|
+
method =~ /block in (.*)/ and method = $1 # for Ruby 1.9
|
147
151
|
@filename = "tmp.#{method}"
|
148
152
|
end
|
149
153
|
File.open(@filename, 'w') { |f| f.write(@input) } if @filename
|
@@ -178,7 +182,7 @@ END
|
|
178
182
|
|
179
183
|
def test_version # -v
|
180
184
|
@options = '-v'
|
181
|
-
@expected = (("$Release: 2.6.
|
185
|
+
@expected = (("$Release: 2.6.2 $" =~ /[.\d]+/) && $&) + "\n"
|
182
186
|
@filename = false
|
183
187
|
_test()
|
184
188
|
end
|
@@ -227,7 +231,21 @@ END
|
|
227
231
|
basename = 'tmp.test_syntax2_%d.rhtml'
|
228
232
|
filenames = [ basename % 0, basename % 1 ]
|
229
233
|
errmsgs = []
|
230
|
-
|
234
|
+
if ruby19?
|
235
|
+
errmsgs << <<'END'
|
236
|
+
3: syntax error, unexpected ']', expecting ')'
|
237
|
+
_buf << ' <li>'; _buf << ( item[:name]] ).to_s; _buf << '</li>
|
238
|
+
^
|
239
|
+
-:4: syntax error, unexpected keyword_end, expecting ')'
|
240
|
+
'; end
|
241
|
+
^
|
242
|
+
-:7: syntax error, unexpected $end, expecting ')'
|
243
|
+
END
|
244
|
+
errmsgs << <<'END'
|
245
|
+
7: syntax error, unexpected $end, expecting keyword_end or keyword_endfor
|
246
|
+
END
|
247
|
+
else
|
248
|
+
errmsgs << <<'END'
|
231
249
|
3: syntax error, unexpected ']', expecting ')'
|
232
250
|
_buf << ' <li>'; _buf << ( item[:name]] ).to_s; _buf << '</li>
|
233
251
|
^
|
@@ -236,9 +254,10 @@ END
|
|
236
254
|
^
|
237
255
|
-:7: syntax error, unexpected $end, expecting ')'
|
238
256
|
END
|
239
|
-
|
257
|
+
errmsgs << <<'END'
|
240
258
|
7: syntax error, unexpected $end, expecting kEND
|
241
259
|
END
|
260
|
+
end
|
242
261
|
#
|
243
262
|
max = inputs.length
|
244
263
|
(0...max).each do |i|
|
@@ -650,4 +669,6 @@ END
|
|
650
669
|
end
|
651
670
|
|
652
671
|
|
672
|
+
self.post_definition()
|
673
|
+
|
653
674
|
end
|
data/test/test-users-guide.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
###
|
2
|
-
### $Rev:
|
3
|
-
### $Release: 2.6.
|
2
|
+
### $Rev: 115 $
|
3
|
+
### $Release: 2.6.2 $
|
4
4
|
### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
|
5
5
|
###
|
6
6
|
|
@@ -53,4 +53,6 @@ class KwarkUsersGuideTest < Test::Unit::TestCase
|
|
53
53
|
end
|
54
54
|
|
55
55
|
|
56
|
+
self.post_definition()
|
57
|
+
|
56
58
|
end
|
Binary file
|
data/test/test.rb
CHANGED
data/test/test.rbc
ADDED
Binary file
|
data/test/testutil.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
###
|
2
|
-
### $Rev:
|
3
|
-
### $Release: 2.6.
|
2
|
+
### $Rev: 116 $
|
3
|
+
### $Release: 2.6.2 $
|
4
4
|
### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
|
5
5
|
###
|
6
6
|
|
@@ -9,6 +9,21 @@ require 'yaml'
|
|
9
9
|
require 'test/unit/testcase'
|
10
10
|
|
11
11
|
|
12
|
+
|
13
|
+
def _ruby_ver_str # :nodoc:
|
14
|
+
return /\d+\.\d+/.match(RUBY_VERSION)[0]
|
15
|
+
end
|
16
|
+
|
17
|
+
def ruby18? # :nodoc:
|
18
|
+
_ruby_ver_str() == "1.8"
|
19
|
+
end
|
20
|
+
|
21
|
+
def ruby19? # :nodoc:
|
22
|
+
_ruby_ver_str() > "1.8"
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
|
12
27
|
class Test::Unit::TestCase
|
13
28
|
|
14
29
|
|
@@ -21,7 +36,7 @@ class Test::Unit::TestCase
|
|
21
36
|
end
|
22
37
|
# untabify
|
23
38
|
unless options[:tabify] == false
|
24
|
-
s = s.inject('') do |sb, line|
|
39
|
+
s = s.split(/^/).inject('') do |sb, line|
|
25
40
|
sb << line.gsub(/([^\t]{8})|([^\t]*)\t/n) { [$+].pack("A8") }
|
26
41
|
end
|
27
42
|
end
|
@@ -72,4 +87,15 @@ class Test::Unit::TestCase
|
|
72
87
|
end
|
73
88
|
|
74
89
|
|
90
|
+
def self.post_definition
|
91
|
+
if ENV['TEST']
|
92
|
+
target = "test_#{ENV['TEST']}"
|
93
|
+
self.instance_methods.each do |method_name|
|
94
|
+
m = method_name.to_s
|
95
|
+
private m if m =~ /\Atest_/ && m != target
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
|
75
101
|
end
|
data/test/testutil.rbc
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erubis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- makoto kuwata
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-06-
|
12
|
+
date: 2008-06-13 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -33,7 +33,6 @@ files:
|
|
33
33
|
- lib/erubis
|
34
34
|
- lib/erubis/context.rb
|
35
35
|
- lib/erubis/converter.rb
|
36
|
-
- "lib/erubis/converter.rb:"
|
37
36
|
- lib/erubis/engine
|
38
37
|
- lib/erubis/engine/ec.rb
|
39
38
|
- lib/erubis/engine/ejava.rb
|
@@ -78,6 +77,7 @@ files:
|
|
78
77
|
- examples/pi/example.escheme
|
79
78
|
- examples/pi/Makefile
|
80
79
|
- test/assert-text-equal.rb
|
80
|
+
- test/assert-text-equal.rbc
|
81
81
|
- test/data
|
82
82
|
- test/data/users-guide
|
83
83
|
- test/data/users-guide/array_example.result
|
@@ -177,20 +177,25 @@ files:
|
|
177
177
|
- test/data/users-guide/printenabled-example.rb
|
178
178
|
- test/data/users-guide/printstatement_example.result
|
179
179
|
- test/data/users-guide/simplify_example.result
|
180
|
-
- test/data/users-guide/stderr.log
|
181
180
|
- test/data/users-guide/stdout_exmple.result
|
182
181
|
- test/data/users-guide/stringbuffer_example.result
|
183
182
|
- test/data/users-guide/tail_260.result
|
184
183
|
- test/data/users-guide/tailnewline.rhtml
|
185
184
|
- test/data/users-guide/template1.rhtml
|
186
185
|
- test/data/users-guide/template2.rhtml
|
186
|
+
- test/hoge.rb
|
187
187
|
- test/test-engines.rb
|
188
|
+
- test/test-engines.rbc
|
188
189
|
- test/test-enhancers.rb
|
189
190
|
- test/test-erubis.rb
|
191
|
+
- test/test-erubis.rbc
|
190
192
|
- test/test-main.rb
|
191
193
|
- test/test-users-guide.rb
|
194
|
+
- test/test-users-guide.rbc
|
192
195
|
- test/test.rb
|
196
|
+
- test/test.rbc
|
193
197
|
- test/testutil.rb
|
198
|
+
- test/testutil.rbc
|
194
199
|
- doc/docstyle.css
|
195
200
|
- doc/users-guide.html
|
196
201
|
- README.txt
|
data/lib/erubis/converter.rb:
DELETED
File without changes
|