erubis 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +62 -2
- data/README.txt +1 -1
- data/benchmark/bench.rb +18 -10
- data/bin/erubis +1 -1
- data/contrib/erubis +2 -3318
- data/contrib/inline-require +1 -1
- data/doc-api/classes/ActionView.html +105 -0
- data/doc-api/classes/ActionView/TemplateHandlers/Erubis.html +202 -0
- data/doc-api/classes/Erubis.html +7 -1
- data/doc-api/classes/Erubis/ArrayBufferEnhancer.html +12 -12
- data/doc-api/classes/Erubis/ArrayEnhancer.html +12 -12
- data/doc-api/classes/Erubis/Basic/Converter.html +34 -30
- data/doc-api/classes/Erubis/BiPatternEnhancer.html +12 -12
- data/doc-api/classes/Erubis/CGenerator.html +60 -60
- data/doc-api/classes/Erubis/Context.html +42 -42
- data/doc-api/classes/Erubis/Converter.html +27 -27
- data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +6 -6
- data/doc-api/classes/Erubis/Engine.html +40 -37
- data/doc-api/classes/Erubis/ErboutEnhancer.html +12 -12
- 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 +60 -60
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +12 -12
- data/doc-api/classes/Erubis/Helpers/RailsFormHelper.html +201 -176
- data/doc-api/classes/Erubis/Helpers/RailsHelper.html +58 -58
- data/doc-api/classes/Erubis/Helpers/RailsHelper/{PreprocessingEruby.html → TemplateConverter.html} +24 -37
- data/doc-api/classes/Erubis/InterpolationEnhancer.html +36 -35
- 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 +19 -19
- data/doc-api/classes/Erubis/NoCodeEnhancer.html +30 -30
- data/doc-api/classes/Erubis/NoTextEnhancer.html +6 -6
- 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 +21 -21
- 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 +6 -6
- data/doc-api/classes/Erubis/PI/Escheme.html +6 -6
- data/doc-api/classes/Erubis/PI/TinyEruby.html +24 -24
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +6 -6
- data/doc-api/classes/Erubis/PerlGenerator.html +54 -54
- data/doc-api/classes/Erubis/PhpGenerator.html +54 -54
- data/doc-api/classes/Erubis/PreprocessingEruby.html +183 -0
- data/doc-api/classes/Erubis/PreprocessingHelper.html +212 -0
- data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +20 -20
- data/doc-api/classes/Erubis/PrintOutEnhancer.html +30 -30
- data/doc-api/classes/Erubis/RubyEvaluator.html +18 -18
- data/doc-api/classes/Erubis/RubyGenerator.html +48 -48
- data/doc-api/classes/Erubis/SchemeGenerator.html +60 -60
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +7 -7
- data/doc-api/classes/Erubis/StdoutEnhancer.html +12 -12
- data/doc-api/classes/Erubis/StringBufferEnhancer.html +12 -12
- data/doc-api/classes/Erubis/TinyEruby.html +24 -24
- data/doc-api/classes/Erubis/XmlHelper.html +30 -30
- data/doc-api/created.rid +1 -1
- data/doc-api/files/README_txt.html +2 -2
- 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 +2 -2
- 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 +1 -1
- 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 +2 -2
- data/doc-api/files/erubis/helpers/rails_helper_rb.html +3 -3
- data/doc-api/files/erubis/local-setting_rb.html +1 -1
- data/doc-api/files/erubis/main_rb.html +1 -1
- data/doc-api/files/erubis/preprocessing_rb.html +114 -0
- data/doc-api/files/erubis/tiny_rb.html +1 -1
- data/doc-api/files/erubis_rb.html +1 -1
- data/doc-api/fr_class_index.html +5 -1
- data/doc-api/fr_file_index.html +1 -0
- data/doc-api/fr_method_index.html +223 -213
- data/doc/users-guide.html +75 -6
- data/lib/erubis.rb +2 -2
- data/lib/erubis/context.rb +1 -1
- data/lib/erubis/converter.rb +11 -7
- data/lib/erubis/engine.rb +9 -6
- 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 +4 -3
- data/lib/erubis/error.rb +1 -1
- data/lib/erubis/evaluator.rb +1 -1
- data/lib/erubis/generator.rb +1 -1
- data/lib/erubis/helper.rb +1 -1
- data/lib/erubis/helpers/rails_form_helper.rb +18 -10
- data/lib/erubis/helpers/rails_helper.rb +100 -98
- data/lib/erubis/local-setting.rb +1 -1
- data/lib/erubis/main.rb +1 -1
- data/lib/erubis/preprocessing.rb +59 -0
- data/lib/erubis/tiny.rb +1 -1
- data/test/assert-text-equal.rb +1 -1
- data/test/data/users-guide/stderr.log +3 -0
- data/test/data/users-guide/tail_260.result +4 -0
- data/test/data/users-guide/tailnewline.rhtml +3 -0
- data/test/test-engines.rb +1 -1
- data/test/test-enhancers.rb +1 -1
- data/test/test-erubis.rb +44 -2
- data/test/test-main.rb +2 -2
- data/test/test-users-guide.rb +1 -1
- data/test/test.rb +1 -1
- data/test/testutil.rb +1 -1
- metadata +15 -5
- data/contrib/action_view_base_rb.patch +0 -23
data/lib/erubis/local-setting.rb
CHANGED
data/lib/erubis/main.rb
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
###
|
2
|
+
### $Rev: 102 $
|
3
|
+
### $Release: 2.6.0 $
|
4
|
+
### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
|
5
|
+
###
|
6
|
+
|
7
|
+
require 'cgi'
|
8
|
+
|
9
|
+
|
10
|
+
module Erubis
|
11
|
+
|
12
|
+
|
13
|
+
##
|
14
|
+
## for preprocessing
|
15
|
+
##
|
16
|
+
class PreprocessingEruby < Erubis::Eruby
|
17
|
+
|
18
|
+
def initialize(input, params={})
|
19
|
+
params = params.dup
|
20
|
+
params[:pattern] ||= '\[% %\]' # use '[%= %]' instead of '<%= %>'
|
21
|
+
#params[:escape] = true # transport '[%= %]' and '[%== %]'
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_expr_escaped(src, code)
|
26
|
+
add_expr_literal(src, "_decode((#{code}))")
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
##
|
33
|
+
## helper methods for preprocessing
|
34
|
+
##
|
35
|
+
module PreprocessingHelper
|
36
|
+
|
37
|
+
module_function
|
38
|
+
|
39
|
+
def _p(arg)
|
40
|
+
return "<%=#{arg}%>"
|
41
|
+
end
|
42
|
+
|
43
|
+
def _P(arg)
|
44
|
+
return "<%=h(#{arg})%>"
|
45
|
+
end
|
46
|
+
|
47
|
+
alias _? _p
|
48
|
+
|
49
|
+
def _decode(arg)
|
50
|
+
arg = arg.to_s
|
51
|
+
arg.gsub!(/%3C%25(?:=|%3D)(.*?)%25%3E/) { "<%=#{CGI.unescape($1)}%>" }
|
52
|
+
arg.gsub!(/<%=(.*?)%>/) { "<%=#{CGI.unescapeHTML($1)}%>" }
|
53
|
+
return arg
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
end
|
data/lib/erubis/tiny.rb
CHANGED
data/test/assert-text-equal.rb
CHANGED
data/test/test-engines.rb
CHANGED
data/test/test-enhancers.rb
CHANGED
data/test/test-erubis.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
|
-
## $Rev:
|
3
|
-
## $Release: 2.
|
2
|
+
## $Rev: 104 $
|
3
|
+
## $Release: 2.6.0 $
|
4
4
|
## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
|
5
5
|
##
|
6
6
|
|
@@ -516,6 +516,48 @@ __END__
|
|
516
516
|
<>&"
|
517
517
|
<>&"
|
518
518
|
|
519
|
+
##
|
520
|
+
- name: tailch1
|
521
|
+
options:
|
522
|
+
input: |
|
523
|
+
<p>
|
524
|
+
<% str = '<>&"' %>
|
525
|
+
<%= str %>
|
526
|
+
<%= str =%>
|
527
|
+
<%= str -%>
|
528
|
+
</p>
|
529
|
+
src: |
|
530
|
+
_buf = ''; _buf << '<p>
|
531
|
+
'; str = '<>&"'
|
532
|
+
_buf << ' '; _buf << ( str ).to_s; _buf << '
|
533
|
+
'; _buf << ' '; _buf << ( str ).to_s; _buf << ' '; _buf << ( str ).to_s; _buf << '</p>
|
534
|
+
';
|
535
|
+
_buf.to_s
|
536
|
+
output: |
|
537
|
+
<p>
|
538
|
+
<>&"
|
539
|
+
<>&" <>&"</p>
|
540
|
+
|
541
|
+
##
|
542
|
+
- name: doublepercent1
|
543
|
+
options:
|
544
|
+
input: |
|
545
|
+
<% x1 = 10 %>
|
546
|
+
<%% x2 = 20 %>
|
547
|
+
<%= x1 %>
|
548
|
+
<%%= x2 %>
|
549
|
+
src: |
|
550
|
+
_buf = ''; x1 = 10
|
551
|
+
_buf << '<% x2 = 20 %>
|
552
|
+
'; _buf << ( x1 ).to_s; _buf << '
|
553
|
+
'; _buf << '<%= x2 %>
|
554
|
+
';
|
555
|
+
_buf.to_s
|
556
|
+
output: |
|
557
|
+
<% x2 = 20 %>
|
558
|
+
10
|
559
|
+
<%= x2 %>
|
560
|
+
|
519
561
|
##
|
520
562
|
- name: optimized1
|
521
563
|
class: OptimizedEruby
|
data/test/test-main.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##
|
2
2
|
## $Rev: 87 $
|
3
|
-
## $Release: 2.
|
3
|
+
## $Release: 2.6.0 $
|
4
4
|
## $Date: 2007-07-12 05:01:24 +0900 (Thu, 12 Jul 2007) $
|
5
5
|
##
|
6
6
|
|
@@ -178,7 +178,7 @@ END
|
|
178
178
|
|
179
179
|
def test_version # -v
|
180
180
|
@options = '-v'
|
181
|
-
@expected = (("$Release: 2.
|
181
|
+
@expected = (("$Release: 2.6.0 $" =~ /[.\d]+/) && $&) + "\n"
|
182
182
|
@filename = false
|
183
183
|
_test()
|
184
184
|
end
|
data/test/test-users-guide.rb
CHANGED
data/test/test.rb
CHANGED
data/test/testutil.rb
CHANGED
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.
|
4
|
+
version: 2.6.0
|
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-
|
12
|
+
date: 2008-05-05 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- lib/erubis/helpers/rails_helper.rb
|
55
55
|
- lib/erubis/local-setting.rb
|
56
56
|
- lib/erubis/main.rb
|
57
|
+
- lib/erubis/preprocessing.rb
|
57
58
|
- lib/erubis/tiny.rb
|
58
59
|
- lib/erubis.rb
|
59
60
|
- bin/erubis
|
@@ -175,8 +176,11 @@ files:
|
|
175
176
|
- test/data/users-guide/printenabled-example.rb
|
176
177
|
- test/data/users-guide/printstatement_example.result
|
177
178
|
- test/data/users-guide/simplify_example.result
|
179
|
+
- test/data/users-guide/stderr.log
|
178
180
|
- test/data/users-guide/stdout_exmple.result
|
179
181
|
- test/data/users-guide/stringbuffer_example.result
|
182
|
+
- test/data/users-guide/tail_260.result
|
183
|
+
- test/data/users-guide/tailnewline.rhtml
|
180
184
|
- test/data/users-guide/template1.rhtml
|
181
185
|
- test/data/users-guide/template2.rhtml
|
182
186
|
- test/test-engines.rb
|
@@ -192,7 +196,6 @@ files:
|
|
192
196
|
- CHANGES.txt
|
193
197
|
- MIT-LICENSE
|
194
198
|
- setup.rb
|
195
|
-
- contrib/action_view_base_rb.patch
|
196
199
|
- contrib/erubis
|
197
200
|
- contrib/erubis-run.rb
|
198
201
|
- contrib/inline-require
|
@@ -206,6 +209,10 @@ files:
|
|
206
209
|
- benchmark/templates/bench_erubis.rhtml
|
207
210
|
- benchmark/templates/bench_eruby.rhtml
|
208
211
|
- doc-api/classes
|
212
|
+
- doc-api/classes/ActionView
|
213
|
+
- doc-api/classes/ActionView/TemplateHandlers
|
214
|
+
- doc-api/classes/ActionView/TemplateHandlers/Erubis.html
|
215
|
+
- doc-api/classes/ActionView.html
|
209
216
|
- doc-api/classes/ERB.html
|
210
217
|
- doc-api/classes/Erubis
|
211
218
|
- doc-api/classes/Erubis/ArrayBufferEnhancer.html
|
@@ -251,7 +258,7 @@ files:
|
|
251
258
|
- doc-api/classes/Erubis/Helpers
|
252
259
|
- doc-api/classes/Erubis/Helpers/RailsFormHelper.html
|
253
260
|
- doc-api/classes/Erubis/Helpers/RailsHelper
|
254
|
-
- doc-api/classes/Erubis/Helpers/RailsHelper/
|
261
|
+
- doc-api/classes/Erubis/Helpers/RailsHelper/TemplateConverter.html
|
255
262
|
- doc-api/classes/Erubis/Helpers/RailsHelper.html
|
256
263
|
- doc-api/classes/Erubis/Helpers.html
|
257
264
|
- doc-api/classes/Erubis/InterpolationEnhancer.html
|
@@ -283,6 +290,8 @@ files:
|
|
283
290
|
- doc-api/classes/Erubis/PI/Escheme.html
|
284
291
|
- doc-api/classes/Erubis/PI/TinyEruby.html
|
285
292
|
- doc-api/classes/Erubis/PI.html
|
293
|
+
- doc-api/classes/Erubis/PreprocessingEruby.html
|
294
|
+
- doc-api/classes/Erubis/PreprocessingHelper.html
|
286
295
|
- doc-api/classes/Erubis/PrintEnabledEnhancer.html
|
287
296
|
- doc-api/classes/Erubis/PrintEnabledEruby.html
|
288
297
|
- doc-api/classes/Erubis/PrintOutEnhancer.html
|
@@ -329,6 +338,7 @@ files:
|
|
329
338
|
- doc-api/files/erubis/helpers/rails_helper_rb.html
|
330
339
|
- doc-api/files/erubis/local-setting_rb.html
|
331
340
|
- doc-api/files/erubis/main_rb.html
|
341
|
+
- doc-api/files/erubis/preprocessing_rb.html
|
332
342
|
- doc-api/files/erubis/tiny_rb.html
|
333
343
|
- doc-api/files/erubis_rb.html
|
334
344
|
- doc-api/files/README_txt.html
|
@@ -359,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
359
369
|
requirements: []
|
360
370
|
|
361
371
|
rubyforge_project: erubis
|
362
|
-
rubygems_version: 1.
|
372
|
+
rubygems_version: 1.1.1
|
363
373
|
signing_key:
|
364
374
|
specification_version: 2
|
365
375
|
summary: a fast and extensible eRuby implementation which supports multi-language
|
@@ -1,23 +0,0 @@
|
|
1
|
-
--- action_view/base.rb (original)
|
2
|
-
+++ action_view/base.rb (working copy)
|
3
|
-
@@ -445,6 +445,11 @@
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
+ # convert template into ruby code
|
8
|
-
+ def convert_template_into_ruby_code(template)
|
9
|
-
+ ERB.new(template, nil, @@erb_trim_mode).src
|
10
|
-
+ end
|
11
|
-
+
|
12
|
-
# Create source code for given template
|
13
|
-
def create_template_source(extension, template, render_symbol, locals)
|
14
|
-
if template_requires_setup?(extension)
|
15
|
-
@@ -458,7 +463,7 @@
|
16
|
-
"update_page do |page|\n#{template}\nend"
|
17
|
-
end
|
18
|
-
else
|
19
|
-
- body = ERB.new(template, nil, @@erb_trim_mode).src
|
20
|
-
+ body = convert_template_into_ruby_code(template)
|
21
|
-
end
|
22
|
-
|
23
|
-
@@template_args[render_symbol] ||= {}
|