erubis 2.3.1 → 2.7.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.
Files changed (163) hide show
  1. data/{CHANGES → CHANGES.txt} +373 -3
  2. data/MIT-LICENSE +1 -1
  3. data/README.txt +6 -5
  4. data/benchmark/bench.rb +18 -11
  5. data/bin/erubis +3 -4
  6. data/contrib/erubis +3462 -5
  7. data/contrib/inline-require +54 -28
  8. data/doc/docstyle.css +25 -4
  9. data/doc/users-guide.html +814 -110
  10. data/doc-api/classes/ActionView/TemplateHandlers/ErubisHandler.html +209 -0
  11. data/doc-api/classes/ActionView.html +105 -0
  12. data/doc-api/classes/Erubis/ArrayBufferEnhancer.html +14 -14
  13. data/doc-api/classes/Erubis/ArrayEnhancer.html +16 -16
  14. data/doc-api/classes/Erubis/Basic/Converter.html +36 -31
  15. data/doc-api/classes/Erubis/BiPatternEnhancer.html +16 -13
  16. data/doc-api/classes/Erubis/CGenerator.html +70 -70
  17. data/doc-api/classes/Erubis/Context.html +49 -49
  18. data/doc-api/classes/Erubis/Converter.html +30 -29
  19. data/doc-api/classes/Erubis/CppGenerator.html +382 -0
  20. data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +7 -7
  21. data/doc-api/classes/Erubis/Ecpp.html +126 -0
  22. data/doc-api/classes/Erubis/Engine.html +46 -43
  23. data/doc-api/classes/Erubis/ErboutEnhancer.html +16 -16
  24. data/doc-api/classes/Erubis/EscapeEnhancer.html +7 -7
  25. data/doc-api/classes/Erubis/EscapedEcpp.html +120 -0
  26. data/doc-api/classes/Erubis/Evaluator.html +22 -22
  27. data/doc-api/classes/Erubis/Generator.html +70 -70
  28. data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +18 -15
  29. data/doc-api/classes/Erubis/Helpers/RailsFormHelper.html +787 -0
  30. data/doc-api/classes/Erubis/Helpers/RailsHelper/TemplateConverter.html +213 -0
  31. data/doc-api/classes/Erubis/Helpers/RailsHelper.html +103 -54
  32. data/doc-api/classes/Erubis/Helpers.html +6 -1
  33. data/doc-api/classes/Erubis/InterpolationEnhancer.html +42 -41
  34. data/doc-api/classes/Erubis/JavaGenerator.html +69 -69
  35. data/doc-api/classes/Erubis/JavascriptGenerator.html +79 -74
  36. data/doc-api/classes/Erubis/Main.html +49 -48
  37. data/doc-api/classes/Erubis/NoCodeEnhancer.html +35 -35
  38. data/doc-api/classes/Erubis/NoTextEnhancer.html +7 -7
  39. data/doc-api/classes/Erubis/OptimizedEruby.html +7 -7
  40. data/doc-api/classes/Erubis/OptimizedGenerator.html +84 -84
  41. data/doc-api/classes/Erubis/OptimizedXmlEruby.html +7 -7
  42. data/doc-api/classes/Erubis/PI/Converter.html +23 -22
  43. data/doc-api/classes/Erubis/PI/Ec.html +7 -7
  44. data/doc-api/classes/Erubis/PI/Ecpp.html +166 -0
  45. data/doc-api/classes/Erubis/PI/Ejava.html +7 -7
  46. data/doc-api/classes/Erubis/PI/Ejavascript.html +7 -7
  47. data/doc-api/classes/Erubis/PI/Eperl.html +7 -7
  48. data/doc-api/classes/Erubis/PI/Ephp.html +7 -7
  49. data/doc-api/classes/Erubis/PI/Eruby.html +6 -6
  50. data/doc-api/classes/Erubis/PI/Escheme.html +7 -7
  51. data/doc-api/classes/Erubis/PI/TinyEruby.html +28 -27
  52. data/doc-api/classes/Erubis/PI.html +1 -0
  53. data/doc-api/classes/Erubis/PercentLineEnhancer.html +18 -29
  54. data/doc-api/classes/Erubis/PerlGenerator.html +63 -63
  55. data/doc-api/classes/Erubis/PhpGenerator.html +63 -63
  56. data/doc-api/classes/Erubis/PrefixedLineEnhancer.html +210 -0
  57. data/doc-api/classes/Erubis/PrefixedLineEruby.html +120 -0
  58. data/doc-api/classes/Erubis/PreprocessingEruby.html +183 -0
  59. data/doc-api/classes/Erubis/PreprocessingHelper.html +212 -0
  60. data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +23 -23
  61. data/doc-api/classes/Erubis/PrintOutEnhancer.html +38 -38
  62. data/doc-api/classes/Erubis/RubyEvaluator.html +59 -22
  63. data/doc-api/classes/Erubis/RubyGenerator.html +53 -52
  64. data/doc-api/classes/Erubis/SchemeGenerator.html +70 -70
  65. data/doc-api/classes/Erubis/SimplifyEnhancer.html +10 -9
  66. data/doc-api/classes/Erubis/StdoutEnhancer.html +3 -3
  67. data/doc-api/classes/Erubis/StringBufferEnhancer.html +16 -16
  68. data/doc-api/classes/Erubis/TinyEruby.html +33 -33
  69. data/doc-api/classes/Erubis/XmlHelper.html +80 -15
  70. data/doc-api/classes/Erubis.html +25 -1
  71. data/doc-api/classes/Kernel.html +155 -0
  72. data/doc-api/created.rid +1 -1
  73. data/doc-api/files/README_txt.html +8 -8
  74. data/doc-api/files/erubis/context_rb.html +2 -2
  75. data/doc-api/files/erubis/converter_rb.html +3 -3
  76. data/doc-api/files/erubis/engine/ec_rb.html +2 -2
  77. data/doc-api/files/erubis/engine/ecpp_rb.html +115 -0
  78. data/doc-api/files/erubis/engine/ejava_rb.html +2 -2
  79. data/doc-api/files/erubis/engine/ejavascript_rb.html +2 -2
  80. data/doc-api/files/erubis/engine/enhanced_rb.html +2 -2
  81. data/doc-api/files/erubis/engine/eperl_rb.html +2 -2
  82. data/doc-api/files/erubis/engine/ephp_rb.html +2 -2
  83. data/doc-api/files/erubis/engine/eruby_rb.html +2 -2
  84. data/doc-api/files/erubis/engine/escheme_rb.html +2 -2
  85. data/doc-api/files/erubis/engine/optimized_rb.html +2 -2
  86. data/doc-api/files/erubis/engine_rb.html +2 -2
  87. data/doc-api/files/erubis/enhancer_rb.html +2 -2
  88. data/doc-api/files/erubis/error_rb.html +2 -2
  89. data/doc-api/files/erubis/evaluator_rb.html +2 -2
  90. data/doc-api/files/erubis/generator_rb.html +3 -3
  91. data/doc-api/files/erubis/helper_rb.html +2 -2
  92. data/doc-api/files/erubis/helpers/rails_form_helper_rb.html +107 -0
  93. data/doc-api/files/erubis/helpers/rails_helper_rb.html +3 -2
  94. data/doc-api/files/erubis/local-setting_rb.html +2 -2
  95. data/doc-api/files/erubis/main_rb.html +4 -2
  96. data/doc-api/files/erubis/preprocessing_rb.html +114 -0
  97. data/doc-api/files/erubis/tiny_rb.html +2 -2
  98. data/doc-api/files/erubis/util_rb.html +107 -0
  99. data/doc-api/files/erubis_rb.html +2 -2
  100. data/doc-api/fr_class_index.html +13 -0
  101. data/doc-api/fr_file_index.html +4 -0
  102. data/doc-api/fr_method_index.html +237 -179
  103. data/examples/basic/Makefile +7 -2
  104. data/examples/basic/example.ecpp +33 -0
  105. data/lib/erubis/context.rb +2 -3
  106. data/lib/erubis/converter.rb +17 -11
  107. data/lib/erubis/engine/ec.rb +2 -3
  108. data/lib/erubis/engine/ecpp.rb +113 -0
  109. data/lib/erubis/engine/ejava.rb +9 -10
  110. data/lib/erubis/engine/ejavascript.rb +14 -9
  111. data/lib/erubis/engine/enhanced.rb +7 -3
  112. data/lib/erubis/engine/eperl.rb +2 -3
  113. data/lib/erubis/engine/ephp.rb +2 -3
  114. data/lib/erubis/engine/eruby.rb +8 -8
  115. data/lib/erubis/engine/escheme.rb +2 -3
  116. data/lib/erubis/engine/optimized.rb +2 -3
  117. data/lib/erubis/engine.rb +13 -11
  118. data/lib/erubis/enhancer.rb +101 -34
  119. data/lib/erubis/error.rb +2 -3
  120. data/lib/erubis/evaluator.rb +27 -10
  121. data/lib/erubis/generator.rb +3 -4
  122. data/lib/erubis/helper.rb +14 -3
  123. data/lib/erubis/helpers/rails_form_helper.rb +197 -0
  124. data/lib/erubis/helpers/rails_helper.rb +219 -77
  125. data/lib/erubis/local-setting.rb +2 -3
  126. data/lib/erubis/main.rb +85 -60
  127. data/lib/erubis/preprocessing.rb +58 -0
  128. data/lib/erubis/tiny.rb +9 -9
  129. data/lib/erubis/util.rb +22 -0
  130. data/lib/erubis.rb +4 -4
  131. data/test/assert-text-equal.rb +2 -3
  132. data/test/data/users-guide/bufvar-example.rb +10 -0
  133. data/test/data/users-guide/bufvar-example.result +17 -0
  134. data/test/data/users-guide/def_method.rb +14 -0
  135. data/test/data/users-guide/def_method.result +3 -0
  136. data/test/data/users-guide/example.ecpp +30 -0
  137. data/test/data/users-guide/example1.rb +1 -0
  138. data/test/data/users-guide/example_c.result +22 -19
  139. data/test/data/users-guide/fasteruby-example.rb +8 -0
  140. data/test/data/users-guide/fasteruby-example.result +18 -0
  141. data/test/data/users-guide/main_program1.rb +8 -0
  142. data/test/data/users-guide/main_program1.result +6 -0
  143. data/test/data/users-guide/main_program2.rb +8 -0
  144. data/test/data/users-guide/main_program2.result +6 -0
  145. data/test/data/users-guide/percentline-example.rhtml +3 -1
  146. data/test/data/users-guide/percentline_example.result +5 -3
  147. data/test/data/users-guide/prefixedline-example.rb +9 -0
  148. data/test/data/users-guide/prefixedline-example.rhtml +6 -0
  149. data/test/data/users-guide/prefixedline_example.result +9 -0
  150. data/test/data/users-guide/tail_260.result +4 -0
  151. data/test/data/users-guide/tailnewline.rhtml +3 -0
  152. data/test/data/users-guide/template1.rhtml +4 -0
  153. data/test/data/users-guide/template2.rhtml +4 -0
  154. data/test/test-engines.rb +88 -5
  155. data/test/test-enhancers.rb +83 -6
  156. data/test/test-erubis.rb +115 -11
  157. data/test/test-index-cgi.rb +191 -0
  158. data/test/test-main.rb +143 -31
  159. data/test/test-users-guide.rb +20 -3
  160. data/test/test.rb +18 -3
  161. data/test/testutil.rb +44 -8
  162. metadata +104 -67
  163. data/contrib/action_view_base_rb.patch +0 -23
@@ -1,6 +1,376 @@
1
- # $Rev: 83 $
2
- # $Release: 2.3.1 $
3
- # copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
1
+ # -*- coding: utf-8 -*-
2
+ # $Release: 2.7.0 $
3
+ # copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
4
+
5
+ - release: 2.7.0
6
+ date: 2011-04-01
7
+ enhancements:
8
+
9
+ - |
10
+ New option ':bufvar' supported to specify buffer variable name.
11
+
12
+ ex:
13
+ input = "Hello <%= name %>!"
14
+ eruby = Erubis::Eruby.new(input)
15
+ puts eruby.src
16
+ #=> _buf = ''; _buf << "Hello "; _buf << ( name ).to_s; _buf << '!';
17
+
18
+ eruby = Erubis::Eruby.new(input, :bufvar=>'@_out')
19
+ puts eruby.src
20
+ #=> @_out = ''; @_out << 'Hello '; @_out << ( name ).to_s; @_out << '!';
21
+
22
+ - |
23
+ New enhancer 'PrefixedLineEnhancer' which is a customizable version
24
+ of PercentLineEnhancer.
25
+ The difference between PrefixedLineEnhancer and PercentLineEnhancer is:
26
+ * You can indent Ruby statetment lines starting with '%'
27
+ * You can specify prefix character by :prefixchar option.
28
+
29
+ ex:
30
+ class MyEruby < Erubis::Eruby
31
+ include Erubis::PrefixedLineEnhancer
32
+ end
33
+ input = <<END
34
+ <ul>
35
+ % for item in @items
36
+ <li><%= item %></li>
37
+ % end
38
+ %% you can indent '%' lines
39
+ </ul>
40
+ END
41
+ eruby = MyEruby.new(input, :prefixchar=>'%') # default '%'
42
+ puts eruby.src
43
+
44
+ output:
45
+ _buf = ''; _buf << '<ul>
46
+ '; for item in @items
47
+ _buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
48
+ '; end
49
+ % you can indent '%' lines
50
+ _buf << '</ul>
51
+ ';
52
+ _buf.to_s
53
+
54
+ - |
55
+ Add helper CGI script. See 'public_html/README.txt' for details.
56
+
57
+ - |
58
+ Rubinius is supported as first-class Ruby implementation.
59
+
60
+ - |
61
+ C++ support. Try '-l cpp' command-line option.
62
+
63
+
64
+ changes:
65
+
66
+ - |
67
+ Remove dependency to 'abstract' library.
68
+ You don't need to install 'abstract' gem.
69
+
70
+ - |
71
+ Erubis::Eruby#load_file() now sets cache file timestamp to the same
72
+ value as original eRuby file. For example, if you restore eRuby files
73
+ from backup, Erubis::Eruby#load_file() can detect it and generate
74
+ cache file again.
75
+
76
+ ## generates cache file (A.rhtml.cache).
77
+ eruby = Erubis::Eruby.load_file('A.rhtml')
78
+ p File.mtime('A.rhtml') == File.mtime('A.rhtml.cache') #=> true
79
+
80
+
81
+
82
+ - release: 2.6.6
83
+ date: 2010-06-27
84
+ bugfixes:
85
+
86
+ - |
87
+ Fixed a bug around InterporationEnhancer and FastEruby to escape back-quote. (thanks to Andrew R Jackson)
88
+
89
+
90
+ - release: 2.6.5
91
+ date: 2009-07-20
92
+ bugfixes:
93
+
94
+ - |
95
+ Fixed bug around '-z' option.
96
+
97
+
98
+ - release: 2.6.4
99
+ date: 2009-02-18
100
+ enhancements:
101
+
102
+ - |
103
+ Rails 2.2 and 2.3 support.
104
+
105
+
106
+
107
+ - release: 2.6.3
108
+ date: 2009-02-07
109
+ bugfixes:
110
+
111
+ - Enhancer name was not displayed in Ruby 1.9.1 when it was missing.
112
+
113
+ - Command option argument name was not displayed correctly as a part of error message.
114
+
115
+ - MethoNotFound error was raised when invalid option was specified.
116
+
117
+
118
+ - release: 2.6.2
119
+ date: 2008-06-12
120
+ enhancements:
121
+
122
+ - |
123
+ Ruby 1.9 support.
124
+
125
+ bugfixes:
126
+
127
+ - |
128
+ Fixed installation problem on Windows (Thanks to Tim Morgan and Allen).
129
+
130
+
131
+ - release: 2.6.1
132
+ date: 2008-06-06
133
+ enhancements:
134
+
135
+ - |
136
+ Rails 2.1 support. (special thanks José Valim)
137
+
138
+
139
+
140
+ - release: 2.6.0
141
+ date: 2008-05-05
142
+ enhancements:
143
+
144
+ - |
145
+ Improved support of Ruby on Rails 2.0.2.
146
+ New class ActionView::TemplateHandlers::Erubis is defined and
147
+ registered as default handler of *.html.erb and *.rhtml.
148
+
149
+ - |
150
+ '<%% %>' and '<%%= %>' are converted into '<% %>' and '<%= %>' respectively.
151
+ This is for compatibility with ERB.
152
+
153
+ ex1.rhtml:
154
+ <ul>
155
+ <%% for item in @list %>
156
+ <li><%%= item %></li>
157
+ <%% end %>
158
+ </ul>
159
+
160
+ result:
161
+ $ erubis ex1.rhtml
162
+ <ul>
163
+ <% for item in @list %>
164
+ <li><%= item %></li>
165
+ <% end %>
166
+ </ul>
167
+
168
+ - |
169
+ '<%= -%>' removes tail spaces and newlines.
170
+ This is for compatibiliy with ERB when trim mode is '-'.
171
+ '<%= =%>' also removes tail spaces and newlines, and this is
172
+ Erubis-original enhancement (cooler than '<%= -%>', isn't it?).
173
+
174
+ ex2.rhtml:
175
+ <div>
176
+ <%= @var -%> # or <%= @var =%>
177
+ </div>
178
+
179
+ result (version 2.6.0):
180
+ $ erubis -c '{var: "AAA\n"}' ex2.rhtml
181
+ <div>
182
+ AAA
183
+ </div>
184
+
185
+ result (version 2.5.0):
186
+ $ erubis -c '{var: "AAA\n"}' ex2.rhtml
187
+ <div>
188
+ AAA
189
+
190
+ </div>
191
+
192
+ - |
193
+ Erubis::Eruby.load_file() now allows you to change cache filename.
194
+
195
+ ex.
196
+ eruby = Erubis::Eruby.load_file("ex3.rhtml",
197
+ :cachename=>'ex3.rhtml.cache')
198
+
199
+
200
+ - release: 2.5.0
201
+ date: 2008-01-30
202
+ enhancements:
203
+
204
+ - |
205
+ Ruby on Rails 2.0 support.
206
+ If you are using preprocessing, notice that _?('foo.id') will be NG
207
+ because it contains period ('.') character.
208
+
209
+ --------------------
210
+ <!-- NG in Rails 2.0 -->
211
+ [%= link_to 'Edit', edit_user_path(_?('@user.id')) %]
212
+ [%= link_to 'Show', @user %]
213
+ [%= link_to 'Delete', @user, :confirm=>'OK?', :method=>:delete %]
214
+
215
+ <!-- OK in Rails 2.0 -->
216
+ <%= user_id = @user.id %>
217
+ [%= link_to 'Edit', edit_user_path(_?('user_id')) %]
218
+ [%= link_to 'Show', :action=>'show', :id=>_?('user_id') %]
219
+ [%= link_to 'Delete', {:action=>'destroy', :id=>_?('user_id')},
220
+ {:confirm=>'OK?', :method=>:delete} %]
221
+ --------------------
222
+
223
+ - |
224
+ (experimental)
225
+ Rails form helper methods for preprocessing are added.
226
+ These helper methos are available with preprocessing.
227
+
228
+ ex. _form.rhtml
229
+ --------------------
230
+ Name: <%= text_field :user, :name %>
231
+ Name: [%= pp_text_field :user, :name %]
232
+ --------------------
233
+
234
+ preprocessed:
235
+ --------------------
236
+ Name: <%= text_field :user, :name %>
237
+ Name: <input id="stock_name" name="stock[name]" size="30" type="text" value="<%=h @stock.name%>" />
238
+ --------------------
239
+
240
+ Ruby code:
241
+ --------------------
242
+ _buf << '
243
+ Name: '; _buf << ( text_field :stock, :name ).to_s; _buf << '
244
+ Name: <input id="stock_name" name="stock[name]" size="30" type="text" value="'; _buf << (h @stock.name).to_s; _buf << '" />
245
+ ';
246
+ --------------------
247
+
248
+ This shows that text_filed() is called every time when rendering,
249
+ but pp_text_filed() is called only once when loading template,
250
+ so pp_text_field() with prepocessing is much faster than text_field().
251
+
252
+ See User's guide for details.
253
+ http://www.kuwata-lab.com/erubis/users-guide.05.html#rails-formhelpers
254
+
255
+ #
256
+ - release: 2.4.1
257
+ date: 2007-09-25
258
+ enhancements:
259
+
260
+ - |
261
+ Add new section 'evaluate(context) v.s. result(binding)' to user's guide.
262
+ This section describes why Erubis::Eruby#evaluate(context) is recommended
263
+ rather than Erubis::Eruby#result(binding).
264
+ User's Guide > Other Topics > evaluate(context) v.s. result(binding)
265
+ http://www.kuwata-lab.com/erubis/users-guide.06.html#topics-context-vs-binding
266
+
267
+ - |
268
+ Add new command-line property '--docwrite={true|false}' to
269
+ Erubis::Ejavascript.
270
+ If this property is true then 'document.write(_buf.join(""));' is used
271
+ as postamble and if it is false then '_buf.join("")' is used.
272
+ Default is true for compatibility reason but it will be false in the
273
+ future release.
274
+ (This feature was proposed by D.Dribin. Thank you.)
275
+
276
+ bugfix:
277
+
278
+ - |
279
+ When using Erubis::Eruby#evaluate(), changing local variables in
280
+ templates have affected to variables accessible with TOPLEVEL_BINDING.
281
+ It means that if you change variables in templates, it is possible to
282
+ change variables in main program.
283
+ This was a bug and is now fixed not to affect to variables in main
284
+ program.
285
+
286
+ ex. template.rhtml
287
+ --------------------
288
+ <% for x in @items %>
289
+ item = <%= x %>
290
+ <% end %>
291
+ --------------------
292
+
293
+ ex. main-program.rb
294
+ --------------------
295
+ require 'erubis'
296
+ x = 10
297
+ items = ['foo', 'bar', 'baz']
298
+ eruby = Erubis::Eruby.new(File.read('template.rhtml'))
299
+ s = eruby.evaluate(:items=>items)
300
+ print s
301
+ $stderr.puts "*** debug: x=#{x.inspect}" #=> x="baz" (2.4.0)
302
+ #=> x=10 (2.4.1)
303
+ --------------------
304
+
305
+ - |
306
+ PercentLineEnhancer was very slow. Now performance problem is solved.
307
+
308
+
309
+ #
310
+ - release: 2.4.0
311
+ date: 2007-07-19
312
+ enhancements:
313
+
314
+ - |
315
+ Preprocessing is supported by Ruby on Rails helper.
316
+ Preprocessing makes Ruby on Rails application about 20-40 percent faster.
317
+
318
+ For example,
319
+
320
+ [%= link_to 'Show', :action=>'show', :id=>_?('@user.id') %]
321
+
322
+ is evaluate by preprocessor and expanded into the following
323
+ when template file is loaded.
324
+
325
+ <a href="/users/show/<%=@user.id%>">Show</a>
326
+
327
+ It means that link_to() is not called when template is rendered
328
+ and rendering speed will be much faster in the result.
329
+
330
+ See User's Guide for details.
331
+
332
+ - |
333
+ Erubis::Eruby#evaluate() (or Erubis::RubyEvaluator#evaluate()) now
334
+ creates Proc object from @src and eval it.
335
+
336
+ def evaluate(context=Context.new)
337
+ context = Context.new(context) if context.is_a?(Hash)
338
+ @_proc ||= eval("proc { #{@src} }", TOPLEVEL_BINDING, @filename || '(erubis)')
339
+ return context.instance_eval(&@_proc)
340
+ end
341
+
342
+ This makes evaluate() much faster when eruby object is reused.
343
+
344
+ - |
345
+ Erubis::Eruby#def_method() is supported.
346
+ This method defines ruby code as instance method or singleton metod.
347
+
348
+ require 'erubis'
349
+ s = "hello <%= name %>"
350
+ eruby = Erubis::Eruby.new(s)
351
+ filename = 'hello.rhtml'
352
+
353
+ ## define instance method to Dummy class (or module)
354
+ class Dummy; end
355
+ eruby.def_method(Dummy, 'render(name)', filename) # filename is optional
356
+ p Dummy.new.render('world') #=> "hello world"
357
+
358
+ ## define singleton method to an object
359
+ obj = Object.new
360
+ eruby.def_method(obj, 'render(name)', filename) # filename is optional
361
+ p obj.render('world') #=> "hello world"
362
+
363
+ This is equivarent to ERB#def_method().
364
+
365
+ - |
366
+ Erubis::XmlHelper.url_escape() and u() which is alias of url_escape()
367
+ are added.
368
+ This is equivarent to ERB#Util.url_escape().
369
+
370
+
371
+ bugfix:
372
+ - Help message was not shown when '-h' is specified. Fixed.
373
+ - 'def method()' was not availabe in template file. Fixed.
4
374
 
5
375
 
6
376
  #
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
1
+ copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  = README
2
2
 
3
- release:: 2.3.1
4
- copyright:: copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
3
+ release:: 2.7.0
4
+ copyright:: copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
5
5
 
6
6
 
7
7
 
@@ -20,6 +20,7 @@ Erubis is an implementation of eRuby. It has the following features.
20
20
  * Ruby on Rails support
21
21
 
22
22
  Erubis is implemented in pure Ruby. It requires Ruby 1.8 or higher.
23
+ Erubis now supports Ruby 1.9.
23
24
 
24
25
  See doc/users-guide.html for details.
25
26
 
@@ -27,9 +28,9 @@ See doc/users-guide.html for details.
27
28
 
28
29
  == Installation
29
30
 
30
- * If you have installed RubyGems, just type <tt>gem install --remote erubis</tt>.
31
+ * If you have installed RubyGems, just type <tt>gem install erubis</tt>.
31
32
 
32
- $ sudo gem install --remote erubis
33
+ $ sudo gem install erubis
33
34
 
34
35
  * Else install abstract[http://rubyforge.org/projects/abstract/] at first,
35
36
  and download erubis_X.X.X.tar.bz2 and install it by setup.rb.
@@ -62,7 +63,7 @@ and restart web server.
62
63
  require 'erubis/helpers/rails_helper'
63
64
  #Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby
64
65
  #Erubis::Helpers::RailsHelper.init_properties = {}
65
- #Erubis::Helpers::RailsHelper.show_src = false
66
+ #Erubis::Helpers::RailsHelper.show_src = nil
66
67
 
67
68
  If Erubis::Helpers::RailsHelper.show_src is ture, Erubis prints converted Ruby code
68
69
  into log file ('log/development.log' or so). It is useful for debug.
data/benchmark/bench.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  ###
4
- ### $Rev: 77 $
5
- ### $Release: 2.3.1 $
6
- ### copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
4
+ ### $Release: 2.7.0 $
5
+ ### copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
7
6
  ###
8
7
 
9
8
  require 'erb'
@@ -93,7 +92,8 @@ class BenchmarkApplication
93
92
 
94
93
  def execute_eruby(filename, context)
95
94
  return unless ERuby
96
- eval context2code(context)
95
+ #eval context2code(context)
96
+ list = context['list']
97
97
  @ntimes.times do
98
98
  ERuby.import(filename)
99
99
  end
@@ -101,7 +101,8 @@ class BenchmarkApplication
101
101
  end
102
102
 
103
103
  def execute_erb(filename, context)
104
- eval context2code(context)
104
+ #eval context2code(context)
105
+ list = context['list']
105
106
  output = nil
106
107
  @ntimes.times do
107
108
  eruby = ERB.new(File.read(filename))
@@ -112,7 +113,8 @@ class BenchmarkApplication
112
113
  end
113
114
 
114
115
  def execute_erb_cached(filename, context)
115
- eval context2code(context)
116
+ #eval context2code(context)
117
+ list = context['list']
116
118
  output = nil
117
119
  cachefile = filename + '.cache'
118
120
  File.unlink(cachefile) if test(?f, cachefile)
@@ -135,7 +137,8 @@ class BenchmarkApplication
135
137
  for klass in %w[Eruby FastEruby TinyEruby ArrayBufferEruby PrintOutEruby StdoutEruby] do
136
138
  s = <<-END
137
139
  def execute_erubis_#{klass.downcase}(filename, context)
138
- eval context2code(context)
140
+ #eval context2code(context)
141
+ list = context['list']
139
142
  output = nil
140
143
  @ntimes.times do
141
144
  eruby = Erubis::#{klass}.new(File.read(filename))
@@ -152,7 +155,8 @@ class BenchmarkApplication
152
155
  for klass in %w[Eruby FastEruby] do
153
156
  s = <<-END
154
157
  def execute_erubis_#{klass.downcase}_cached(filename, context)
155
- eval context2code(context)
158
+ #eval context2code(context)
159
+ list = context['list']
156
160
  cachefile = filename + '.cache'
157
161
  File.unlink(cachefile) if test(?f, cachefile)
158
162
  output = nil
@@ -173,7 +177,8 @@ class BenchmarkApplication
173
177
 
174
178
  def convert_eruby(filename, context)
175
179
  return unless ERuby
176
- eval context2code(context)
180
+ #eval context2code(context)
181
+ list = context['list']
177
182
  output = nil
178
183
  @ntimes.times do
179
184
  output = ERuby::Compiler.new.compile_string(File.read(filename))
@@ -182,7 +187,8 @@ class BenchmarkApplication
182
187
  end
183
188
 
184
189
  def convert_erb(filename, context)
185
- eval context2code(context)
190
+ #eval context2code(context)
191
+ list = context['list']
186
192
  output = nil
187
193
  @ntimes.times do
188
194
  eruby = ERB.new(File.read(filename))
@@ -194,7 +200,8 @@ class BenchmarkApplication
194
200
  for klass in %w[Eruby FastEruby TinyEruby]
195
201
  s = <<-END
196
202
  def convert_erubis_#{klass.downcase}(filename, context)
197
- eval context2code(context)
203
+ #eval context2code(context)
204
+ list = context['list']
198
205
  output = nil
199
206
  @ntimes.times do
200
207
  eruby = Erubis::#{klass}.new(File.read(filename))
data/bin/erubis CHANGED
@@ -1,9 +1,8 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  ###
4
- ### $Rev: 77 $
5
- ### $Release: 2.3.1 $
6
- ### copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
4
+ ### $Release: 2.7.0 $
5
+ ### copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
7
6
  ###
8
7
 
9
8
  require 'erubis/main'