erubis 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/CHANGES.txt +62 -2
  2. data/README.txt +1 -1
  3. data/benchmark/bench.rb +18 -10
  4. data/bin/erubis +1 -1
  5. data/contrib/erubis +2 -3318
  6. data/contrib/inline-require +1 -1
  7. data/doc-api/classes/ActionView.html +105 -0
  8. data/doc-api/classes/ActionView/TemplateHandlers/Erubis.html +202 -0
  9. data/doc-api/classes/Erubis.html +7 -1
  10. data/doc-api/classes/Erubis/ArrayBufferEnhancer.html +12 -12
  11. data/doc-api/classes/Erubis/ArrayEnhancer.html +12 -12
  12. data/doc-api/classes/Erubis/Basic/Converter.html +34 -30
  13. data/doc-api/classes/Erubis/BiPatternEnhancer.html +12 -12
  14. data/doc-api/classes/Erubis/CGenerator.html +60 -60
  15. data/doc-api/classes/Erubis/Context.html +42 -42
  16. data/doc-api/classes/Erubis/Converter.html +27 -27
  17. data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +6 -6
  18. data/doc-api/classes/Erubis/Engine.html +40 -37
  19. data/doc-api/classes/Erubis/ErboutEnhancer.html +12 -12
  20. data/doc-api/classes/Erubis/EscapeEnhancer.html +6 -6
  21. data/doc-api/classes/Erubis/Evaluator.html +19 -19
  22. data/doc-api/classes/Erubis/Generator.html +60 -60
  23. data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +12 -12
  24. data/doc-api/classes/Erubis/Helpers/RailsFormHelper.html +201 -176
  25. data/doc-api/classes/Erubis/Helpers/RailsHelper.html +58 -58
  26. data/doc-api/classes/Erubis/Helpers/RailsHelper/{PreprocessingEruby.html → TemplateConverter.html} +24 -37
  27. data/doc-api/classes/Erubis/InterpolationEnhancer.html +36 -35
  28. data/doc-api/classes/Erubis/JavaGenerator.html +54 -54
  29. data/doc-api/classes/Erubis/JavascriptGenerator.html +60 -60
  30. data/doc-api/classes/Erubis/Main.html +19 -19
  31. data/doc-api/classes/Erubis/NoCodeEnhancer.html +30 -30
  32. data/doc-api/classes/Erubis/NoTextEnhancer.html +6 -6
  33. data/doc-api/classes/Erubis/OptimizedEruby.html +6 -6
  34. data/doc-api/classes/Erubis/OptimizedGenerator.html +72 -72
  35. data/doc-api/classes/Erubis/OptimizedXmlEruby.html +6 -6
  36. data/doc-api/classes/Erubis/PI/Converter.html +21 -21
  37. data/doc-api/classes/Erubis/PI/Ec.html +6 -6
  38. data/doc-api/classes/Erubis/PI/Ejava.html +6 -6
  39. data/doc-api/classes/Erubis/PI/Ejavascript.html +6 -6
  40. data/doc-api/classes/Erubis/PI/Eperl.html +6 -6
  41. data/doc-api/classes/Erubis/PI/Ephp.html +6 -6
  42. data/doc-api/classes/Erubis/PI/Eruby.html +6 -6
  43. data/doc-api/classes/Erubis/PI/Escheme.html +6 -6
  44. data/doc-api/classes/Erubis/PI/TinyEruby.html +24 -24
  45. data/doc-api/classes/Erubis/PercentLineEnhancer.html +6 -6
  46. data/doc-api/classes/Erubis/PerlGenerator.html +54 -54
  47. data/doc-api/classes/Erubis/PhpGenerator.html +54 -54
  48. data/doc-api/classes/Erubis/PreprocessingEruby.html +183 -0
  49. data/doc-api/classes/Erubis/PreprocessingHelper.html +212 -0
  50. data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +20 -20
  51. data/doc-api/classes/Erubis/PrintOutEnhancer.html +30 -30
  52. data/doc-api/classes/Erubis/RubyEvaluator.html +18 -18
  53. data/doc-api/classes/Erubis/RubyGenerator.html +48 -48
  54. data/doc-api/classes/Erubis/SchemeGenerator.html +60 -60
  55. data/doc-api/classes/Erubis/SimplifyEnhancer.html +7 -7
  56. data/doc-api/classes/Erubis/StdoutEnhancer.html +12 -12
  57. data/doc-api/classes/Erubis/StringBufferEnhancer.html +12 -12
  58. data/doc-api/classes/Erubis/TinyEruby.html +24 -24
  59. data/doc-api/classes/Erubis/XmlHelper.html +30 -30
  60. data/doc-api/created.rid +1 -1
  61. data/doc-api/files/README_txt.html +2 -2
  62. data/doc-api/files/erubis/context_rb.html +1 -1
  63. data/doc-api/files/erubis/converter_rb.html +2 -2
  64. data/doc-api/files/erubis/engine/ec_rb.html +1 -1
  65. data/doc-api/files/erubis/engine/ejava_rb.html +1 -1
  66. data/doc-api/files/erubis/engine/ejavascript_rb.html +1 -1
  67. data/doc-api/files/erubis/engine/enhanced_rb.html +1 -1
  68. data/doc-api/files/erubis/engine/eperl_rb.html +1 -1
  69. data/doc-api/files/erubis/engine/ephp_rb.html +1 -1
  70. data/doc-api/files/erubis/engine/eruby_rb.html +1 -1
  71. data/doc-api/files/erubis/engine/escheme_rb.html +1 -1
  72. data/doc-api/files/erubis/engine/optimized_rb.html +1 -1
  73. data/doc-api/files/erubis/engine_rb.html +2 -2
  74. data/doc-api/files/erubis/enhancer_rb.html +2 -2
  75. data/doc-api/files/erubis/error_rb.html +1 -1
  76. data/doc-api/files/erubis/evaluator_rb.html +1 -1
  77. data/doc-api/files/erubis/generator_rb.html +1 -1
  78. data/doc-api/files/erubis/helper_rb.html +1 -1
  79. data/doc-api/files/erubis/helpers/rails_form_helper_rb.html +2 -2
  80. data/doc-api/files/erubis/helpers/rails_helper_rb.html +3 -3
  81. data/doc-api/files/erubis/local-setting_rb.html +1 -1
  82. data/doc-api/files/erubis/main_rb.html +1 -1
  83. data/doc-api/files/erubis/preprocessing_rb.html +114 -0
  84. data/doc-api/files/erubis/tiny_rb.html +1 -1
  85. data/doc-api/files/erubis_rb.html +1 -1
  86. data/doc-api/fr_class_index.html +5 -1
  87. data/doc-api/fr_file_index.html +1 -0
  88. data/doc-api/fr_method_index.html +223 -213
  89. data/doc/users-guide.html +75 -6
  90. data/lib/erubis.rb +2 -2
  91. data/lib/erubis/context.rb +1 -1
  92. data/lib/erubis/converter.rb +11 -7
  93. data/lib/erubis/engine.rb +9 -6
  94. data/lib/erubis/engine/ec.rb +1 -1
  95. data/lib/erubis/engine/ejava.rb +1 -1
  96. data/lib/erubis/engine/ejavascript.rb +1 -1
  97. data/lib/erubis/engine/enhanced.rb +1 -1
  98. data/lib/erubis/engine/eperl.rb +1 -1
  99. data/lib/erubis/engine/ephp.rb +1 -1
  100. data/lib/erubis/engine/eruby.rb +1 -1
  101. data/lib/erubis/engine/escheme.rb +1 -1
  102. data/lib/erubis/engine/optimized.rb +1 -1
  103. data/lib/erubis/enhancer.rb +4 -3
  104. data/lib/erubis/error.rb +1 -1
  105. data/lib/erubis/evaluator.rb +1 -1
  106. data/lib/erubis/generator.rb +1 -1
  107. data/lib/erubis/helper.rb +1 -1
  108. data/lib/erubis/helpers/rails_form_helper.rb +18 -10
  109. data/lib/erubis/helpers/rails_helper.rb +100 -98
  110. data/lib/erubis/local-setting.rb +1 -1
  111. data/lib/erubis/main.rb +1 -1
  112. data/lib/erubis/preprocessing.rb +59 -0
  113. data/lib/erubis/tiny.rb +1 -1
  114. data/test/assert-text-equal.rb +1 -1
  115. data/test/data/users-guide/stderr.log +3 -0
  116. data/test/data/users-guide/tail_260.result +4 -0
  117. data/test/data/users-guide/tailnewline.rhtml +3 -0
  118. data/test/test-engines.rb +1 -1
  119. data/test/test-enhancers.rb +1 -1
  120. data/test/test-erubis.rb +44 -2
  121. data/test/test-main.rb +2 -2
  122. data/test/test-users-guide.rb +1 -1
  123. data/test/test.rb +1 -1
  124. data/test/testutil.rb +1 -1
  125. metadata +15 -5
  126. data/contrib/action_view_base_rb.patch +0 -23
@@ -1,6 +1,6 @@
1
1
  ##
2
2
  ## $Rev: 77 $
3
- ## $Release: 2.5.0 $
3
+ ## $Release: 2.6.0 $
4
4
  ## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ##
6
6
 
@@ -1,6 +1,6 @@
1
1
  ###
2
2
  ### $Rev: 91 $
3
- ### $Release: 2.5.0 $
3
+ ### $Release: 2.6.0 $
4
4
  ### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ###
6
6
 
@@ -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!(/&lt;%=(.*?)%&gt;/) { "<%=#{CGI.unescapeHTML($1)}%>" }
53
+ return arg
54
+ end
55
+
56
+ end
57
+
58
+
59
+ end
@@ -1,6 +1,6 @@
1
1
  ##
2
2
  ## $Rev: 77 $
3
- ## $Release: 2.5.0 $
3
+ ## $Release: 2.6.0 $
4
4
  ## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ##
6
6
 
@@ -1,6 +1,6 @@
1
1
  ###
2
2
  ### $Rev: 77 $
3
- ### $Release: 2.5.0 $
3
+ ### $Release: 2.6.0 $
4
4
  ### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ###
6
6
 
@@ -0,0 +1,3 @@
1
+ *** debug: item="<aaa>"
2
+ *** debug: item="b&b"
3
+ *** debug: item="\"ccc\""
@@ -0,0 +1,4 @@
1
+ $ erubis -c '{var: "AAA\n"}' tailnewline.rhtml
2
+ <div>
3
+ AAA
4
+ </div>
@@ -0,0 +1,3 @@
1
+ <div>
2
+ <%= @var -%>
3
+ </div>
@@ -1,6 +1,6 @@
1
1
  ##
2
2
  ## $Rev: 95 $
3
- ## $Release: 2.5.0 $
3
+ ## $Release: 2.6.0 $
4
4
  ## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ##
6
6
 
@@ -1,6 +1,6 @@
1
1
  ##
2
2
  ## $Rev: 93 $
3
- ## $Release: 2.5.0 $
3
+ ## $Release: 2.6.0 $
4
4
  ## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ##
6
6
 
@@ -1,6 +1,6 @@
1
1
  ##
2
- ## $Rev: 94 $
3
- ## $Release: 2.5.0 $
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
  &lt;&gt;&amp;&quot;
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
@@ -1,6 +1,6 @@
1
1
  ##
2
2
  ## $Rev: 87 $
3
- ## $Release: 2.5.0 $
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.5.0 $" =~ /[.\d]+/) && $&) + "\n"
181
+ @expected = (("$Release: 2.6.0 $" =~ /[.\d]+/) && $&) + "\n"
182
182
  @filename = false
183
183
  _test()
184
184
  end
@@ -1,6 +1,6 @@
1
1
  ###
2
2
  ### $Rev: 77 $
3
- ### $Release: 2.5.0 $
3
+ ### $Release: 2.6.0 $
4
4
  ### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ###
6
6
 
@@ -1,6 +1,6 @@
1
1
  ##
2
2
  ## $Rev: 77 $
3
- ## $Release: 2.5.0 $
3
+ ## $Release: 2.6.0 $
4
4
  ## copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ##
6
6
 
@@ -1,6 +1,6 @@
1
1
  ###
2
2
  ### $Rev: 77 $
3
- ### $Release: 2.5.0 $
3
+ ### $Release: 2.6.0 $
4
4
  ### copyright(c) 2006-2008 kuwata-lab.com all rights reserved.
5
5
  ###
6
6
 
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.5.0
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-01-30 00:00:00 +09:00
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/PreprocessingEruby.html
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.0.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] ||= {}