brakeman 7.1.2 → 8.0.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.
- checksums.yaml +4 -4
- data/CHANGES.md +11 -0
- data/README.md +1 -1
- data/bundle/load.rb +2 -2
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/CHANGELOG +111 -0
- data/bundle/ruby/3.2.0/gems/{erubis-2.7.0 → erubi-1.13.1}/MIT-LICENSE +1 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/README.rdoc +151 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/lib/erubi/capture_block.rb +91 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/lib/erubi/capture_end.rb +58 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/lib/erubi.rb +299 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/asciidoc.rb +12 -5
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/babel.rb +5 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/builder.rb +4 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/coffee.rb +14 -4
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/commonmarker.rb +41 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/csv.rb +63 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/erb.rb +130 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/erubi.rb +41 -8
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/etanni.rb +7 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/haml.rb +67 -1
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/kramdown.rb +59 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/liquid.rb +93 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/livescript.rb +11 -4
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/mapping.rb +8 -8
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/markaby.rb +11 -2
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/nokogiri.rb +13 -2
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/pandoc.rb +81 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/pipeline.rb +6 -1
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/plain.rb +5 -1
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/prawn.rb +17 -6
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/radius.rb +96 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/rdiscount.rb +82 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/rdoc.rb +33 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/redcarpet.rb +73 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/redcloth.rb +40 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/rst-pandoc.rb +33 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/sass.rb +16 -3
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/slim.rb +18 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/string.rb +10 -2
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/template.rb +5 -5
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/typescript.rb +5 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/yajl.rb +91 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt.rb +1 -2
- data/lib/brakeman/app_tree.rb +7 -2
- data/lib/brakeman/checks/check_model_attributes.rb +1 -1
- data/lib/brakeman/checks/check_render.rb +1 -27
- data/lib/brakeman/checks/check_render_rce.rb +43 -0
- data/lib/brakeman/checks/check_session_settings.rb +1 -1
- data/lib/brakeman/checks.rb +31 -25
- data/lib/brakeman/commandline.rb +6 -1
- data/lib/brakeman/file_parser.rb +3 -2
- data/lib/brakeman/logger.rb +264 -0
- data/lib/brakeman/options.rb +0 -9
- data/lib/brakeman/parsers/rails_erubi.rb +82 -0
- data/lib/brakeman/parsers/template_parser.rb +7 -15
- data/lib/brakeman/processor.rb +2 -2
- data/lib/brakeman/processors/controller_alias_processor.rb +1 -1
- data/lib/brakeman/processors/controller_processor.rb +3 -3
- data/lib/brakeman/processors/{erubis_template_processor.rb → erubi_template_procesor.rb} +3 -3
- data/lib/brakeman/processors/lib/rails2_config_processor.rb +4 -3
- data/lib/brakeman/processors/lib/rails2_route_processor.rb +1 -1
- data/lib/brakeman/processors/lib/render_helper.rb +1 -1
- data/lib/brakeman/processors/lib/render_path.rb +1 -1
- data/lib/brakeman/processors/model_processor.rb +1 -1
- data/lib/brakeman/report/ignore/config.rb +1 -1
- data/lib/brakeman/scanner.rb +25 -49
- data/lib/brakeman/tracker/collection.rb +12 -2
- data/lib/brakeman/tracker/config.rb +17 -13
- data/lib/brakeman/tracker/constants.rb +17 -2
- data/lib/brakeman/tracker/controller.rb +1 -1
- data/lib/brakeman/tracker.rb +7 -15
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman.rb +89 -49
- metadata +51 -80
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/CHANGES.txt +0 -828
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/README.txt +0 -102
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/contrib/erubis +0 -3468
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/contrib/erubis-run.rb +0 -132
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/contrib/inline-require +0 -179
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/context.rb +0 -83
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/converter.rb +0 -357
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ec.rb +0 -117
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ecpp.rb +0 -113
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ejava.rb +0 -110
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ejavascript.rb +0 -119
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/enhanced.rb +0 -126
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/eperl.rb +0 -95
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb +0 -99
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/eruby.rb +0 -125
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/escheme.rb +0 -114
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/optimized.rb +0 -127
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine.rb +0 -120
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/enhancer.rb +0 -723
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/error.rb +0 -23
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/evaluator.rb +0 -88
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/generator.rb +0 -85
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/helper.rb +0 -47
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/helpers/rails_form_helper.rb +0 -197
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/helpers/rails_helper.rb +0 -353
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/local-setting.rb +0 -9
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/main.rb +0 -516
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/preprocessing.rb +0 -58
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/tiny.rb +0 -144
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/util.rb +0 -22
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis.rb +0 -73
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/setup.rb +0 -1331
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/creole.rb +0 -16
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/csv.rb +0 -53
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/erb.rb +0 -65
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/kramdown.rb +0 -13
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/liquid.rb +0 -37
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/pandoc.rb +0 -39
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/radius.rb +0 -41
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/rdiscount.rb +0 -23
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/rdoc.rb +0 -11
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/redcarpet.rb +0 -31
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/redcloth.rb +0 -13
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/rst-pandoc.rb +0 -10
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/slim.rb +0 -5
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/yajl.rb +0 -81
- data/lib/brakeman/parsers/erubis_patch.rb +0 -11
- data/lib/brakeman/parsers/rails2_erubis.rb +0 -9
- data/lib/brakeman/parsers/rails2_xss_plugin_erubis.rb +0 -52
- data/lib/brakeman/parsers/rails3_erubis.rb +0 -85
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/COPYING +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/_emacs_org.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/_handlebars.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/_jbuilder.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/_org.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/cli.rb +0 -0
|
@@ -1,828 +0,0 @@
|
|
|
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.
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
#
|
|
377
|
-
- release: 2.3.1
|
|
378
|
-
date: 2007-05-26
|
|
379
|
-
bugfix:
|
|
380
|
-
- A serious bug in 'helpers/rails_helper.rb' is fixed.
|
|
381
|
-
You must be update if you are using Erubis with Ruby on Rails.
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
#
|
|
385
|
-
- release: 2.3.0
|
|
386
|
-
date: 2007-05-23
|
|
387
|
-
enhancements:
|
|
388
|
-
- |
|
|
389
|
-
New class 'Erubis::FastEruby' is added.
|
|
390
|
-
It is a subclass of Erubis::Eruby and includes InterpolationEnhancer.
|
|
391
|
-
Erubis::FastEruby is compatible with and faster than Erubis::Eruby.
|
|
392
|
-
|
|
393
|
-
- |
|
|
394
|
-
New enhancer 'InterpolationEnhancer' is added.
|
|
395
|
-
This enhancer uses expression interpolation to eliminate method call
|
|
396
|
-
of String#<<. In the result, this enhancer makes Eruby a little faster.
|
|
397
|
-
|
|
398
|
-
--------------------
|
|
399
|
-
## Assume that input is '<a href="<%=url%>"><%=name%></a>'.
|
|
400
|
-
## Eruby convert input into the following code. String#<< is called 5 times.
|
|
401
|
-
_buf << '<a href="'; _buf << (url).to_s; _buf << '">'; _buf << (name).to_s; _buf << '</a>';
|
|
402
|
-
|
|
403
|
-
## When InterpolationEnhancer is used, String#<< is called only once.
|
|
404
|
-
_buf << %Q`<a href="#{url}">#{name}</a>`;
|
|
405
|
-
--------------------
|
|
406
|
-
|
|
407
|
-
- |
|
|
408
|
-
New enhancer 'ErboutEnhancer' is added.
|
|
409
|
-
ErboutEnhancer set '_erbout' as well as '_buf' to be compatible with ERB.
|
|
410
|
-
|
|
411
|
-
ex.
|
|
412
|
-
====================
|
|
413
|
-
$ cat ex.rhtml
|
|
414
|
-
<p>Hello</p>
|
|
415
|
-
$ erubis -x ex.rhtml
|
|
416
|
-
_buf = ''; _buf << '<p>Hello</p>
|
|
417
|
-
';
|
|
418
|
-
_buf.to_s
|
|
419
|
-
$ erubis -xE Erbout ex.rhtml
|
|
420
|
-
_erbout = _buf = ''; _buf << '<p>Hello</p>
|
|
421
|
-
';
|
|
422
|
-
_buf.to_s
|
|
423
|
-
====================
|
|
424
|
-
|
|
425
|
-
- |
|
|
426
|
-
[experimental]
|
|
427
|
-
New enhancer 'DeleteIndentEnhancer' is added.
|
|
428
|
-
This enhancer deletes indentation of HTML file.
|
|
429
|
-
|
|
430
|
-
ex.
|
|
431
|
-
====================
|
|
432
|
-
$ cat ex.rhtml
|
|
433
|
-
<div>
|
|
434
|
-
<ul>
|
|
435
|
-
<% for item in ['AAA', 'BBB', 'CCC'] %>
|
|
436
|
-
<li><%= item %></li>
|
|
437
|
-
<% end %>
|
|
438
|
-
</ul>
|
|
439
|
-
</div>
|
|
440
|
-
$ erubis ex.rhtml
|
|
441
|
-
<div>
|
|
442
|
-
<ul>
|
|
443
|
-
<li>AAA</li>
|
|
444
|
-
<li>BBB</li>
|
|
445
|
-
<li>CCC</li>
|
|
446
|
-
</ul>
|
|
447
|
-
</div>
|
|
448
|
-
$ erubis -E DeleteIndent ex.rhtml
|
|
449
|
-
<div>
|
|
450
|
-
<ul>
|
|
451
|
-
<li>AAA</li>
|
|
452
|
-
<li>BBB</li>
|
|
453
|
-
<li>CCC</li>
|
|
454
|
-
</ul>
|
|
455
|
-
</div>
|
|
456
|
-
====================
|
|
457
|
-
|
|
458
|
-
- |
|
|
459
|
-
Mod_ruby is supported (very thanks to Andrew R Jackson!).
|
|
460
|
-
See users-guide and 'contrib/erubis-run.rb' for details.
|
|
461
|
-
|
|
462
|
-
- |
|
|
463
|
-
New command-line option '-X', '-N', '-U', and '-C' are added.
|
|
464
|
-
These are intended to be a replacement of 'notext' command.
|
|
465
|
-
'-X' shows only ruby statements and expressions.
|
|
466
|
-
'-N' adds line numbers.
|
|
467
|
-
'-U' compress empty lines into a line.
|
|
468
|
-
'-C' removes empty lines.
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
changes:
|
|
472
|
-
|
|
473
|
-
- |
|
|
474
|
-
'helpers/rails_helper.rb' is changed to use ErboutEnhancer.
|
|
475
|
-
The following is an examle to use Erubis with Ruby on Rails.
|
|
476
|
-
|
|
477
|
-
File 'config/environment.rb':
|
|
478
|
-
----------------------------------------
|
|
479
|
-
require 'erubis/helpers/rails_helper'
|
|
480
|
-
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby
|
|
481
|
-
#Erubis::Helpers::RailsHelper.init_properties = {}
|
|
482
|
-
#Erubis::Helpers::RailsHelper.show_src = false # set true for debugging
|
|
483
|
-
----------------------------------------
|
|
484
|
-
|
|
485
|
-
- |
|
|
486
|
-
Command 'notext' has been removed. Use '-X', '-N', '-U', and '-C'
|
|
487
|
-
instead.
|
|
488
|
-
|
|
489
|
-
- |
|
|
490
|
-
Tab characters in YAML file are expaneded automatically.
|
|
491
|
-
If you want not to expand tab characters, add command-line optio '-T'.
|
|
492
|
-
|
|
493
|
-
- |
|
|
494
|
-
Benchmark scripts (benchmark/bench.*) are rewrited.
|
|
495
|
-
|
|
496
|
-
- |
|
|
497
|
-
Users-guide (doc/users-guide.html) is updated.
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
#
|
|
502
|
-
- release: 2.2.0
|
|
503
|
-
date: 2007-02-11
|
|
504
|
-
enhancements:
|
|
505
|
-
- |
|
|
506
|
-
Performance tuned up. Release 2.2.0 works about 8 percent faster
|
|
507
|
-
than 2.1.0.
|
|
508
|
-
As a result, Erubis works more than 10 percent faster than eruby.
|
|
509
|
-
(eruby is the extension module of eRuby written in C.)
|
|
510
|
-
|
|
511
|
-
- |
|
|
512
|
-
Support of Ruby on Rails improved.
|
|
513
|
-
If you want to use Erubis with Ruby on Rails, add the following code
|
|
514
|
-
into your 'config/environment.rb' and restart web server.
|
|
515
|
-
This will set Erubis as eRuby compiler in Ruby on Rails instead of ERB.
|
|
516
|
-
|
|
517
|
-
--------------------
|
|
518
|
-
require 'erubis/helpers/rails_helper'
|
|
519
|
-
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby
|
|
520
|
-
#Erubis::Helpers::RailsHelper.init_properties = {}
|
|
521
|
-
#Erubis::Helpers::RailsHelper.show_src = true
|
|
522
|
-
--------------------
|
|
523
|
-
|
|
524
|
-
Methods 'capture()' and 'content_for()' of ActionView::Helpers::CaptureHelper
|
|
525
|
-
are available. Methd ActionView::Helpers::TextHelper#concat() is also available.
|
|
526
|
-
|
|
527
|
-
If Erubis::Helpers::RailsHelper.show_src is ture, Erubis prints converted
|
|
528
|
-
Ruby code into log file (such as 'log/development.log').
|
|
529
|
-
|
|
530
|
-
- |
|
|
531
|
-
Erubis::Engine.load_file(filename) creates cache file (filename +
|
|
532
|
-
'.cache') automatically if cache file is old or not exist.
|
|
533
|
-
Caching makes Erubis about 40-50 percent faster.
|
|
534
|
-
|
|
535
|
-
ex.
|
|
536
|
-
--------------------
|
|
537
|
-
require 'erubis'
|
|
538
|
-
eruby = Erubis::Eruby.load_file('example.rhtml')
|
|
539
|
-
## cache file 'example.rhtml.cache' is created automatically
|
|
540
|
-
--------------------
|
|
541
|
-
|
|
542
|
-
- |
|
|
543
|
-
Command-line option '-f datafile' can take Ruby script ('*.rb')
|
|
544
|
-
as well as YAML file ('*.yaml' or '*.yml').
|
|
545
|
-
|
|
546
|
-
ex.
|
|
547
|
-
====================
|
|
548
|
-
$ cat context.rb
|
|
549
|
-
@title = 'Example'
|
|
550
|
-
@list = %w[AAA BBB CCC]
|
|
551
|
-
$ cat example.rhtml
|
|
552
|
-
<h1><%= @title %></h1>
|
|
553
|
-
<ul>
|
|
554
|
-
<% for item in @list %>
|
|
555
|
-
<li><%= item %></li>
|
|
556
|
-
<% end %>
|
|
557
|
-
</ul>
|
|
558
|
-
$ erubis -f context.rb example.rhtml
|
|
559
|
-
<h1>Example</h1>
|
|
560
|
-
<ul>
|
|
561
|
-
<li>AAA</li>
|
|
562
|
-
<li>BBB</li>
|
|
563
|
-
<li>CCC</li>
|
|
564
|
-
</ul>
|
|
565
|
-
====================
|
|
566
|
-
|
|
567
|
-
- |
|
|
568
|
-
New command-line option '-c context' support. It takes context string
|
|
569
|
-
in YAML inline style or Ruby code style.
|
|
570
|
-
|
|
571
|
-
ex. YAML inline style
|
|
572
|
-
====================
|
|
573
|
-
$ erubis -c '{title: Example, list: [AAA, BBB, CCC]}' example.rhtml
|
|
574
|
-
====================
|
|
575
|
-
|
|
576
|
-
ex. Ruby style
|
|
577
|
-
====================
|
|
578
|
-
$ erubis -c '@title="Example"; @list=%w[AAA BBB CCC]' example.rhtml
|
|
579
|
-
====================
|
|
580
|
-
|
|
581
|
-
- |
|
|
582
|
-
New command-line option '-z' (syntax checking) support. It is similar
|
|
583
|
-
to 'erubis -x file.rhtml | ruby -wc', but it can take several filenames.
|
|
584
|
-
|
|
585
|
-
ex.
|
|
586
|
-
====================
|
|
587
|
-
$ erubis -z app/views/*/*.rhtml
|
|
588
|
-
Syntax OK
|
|
589
|
-
====================
|
|
590
|
-
|
|
591
|
-
- |
|
|
592
|
-
New constant Erubis::VERSION added.
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
changes:
|
|
596
|
-
- |
|
|
597
|
-
Class Erubis::Eruby changed to include Erubis::StringBufferEnhancer
|
|
598
|
-
instead of Erubis::ArrayBufferEnhancer.
|
|
599
|
-
This is for Ruby on Rails support.
|
|
600
|
-
|
|
601
|
-
ex.
|
|
602
|
-
====================
|
|
603
|
-
$ cat example.rhtml
|
|
604
|
-
<ul>
|
|
605
|
-
<% for item in @list %>
|
|
606
|
-
<li><%= item %></li>
|
|
607
|
-
<% end %>
|
|
608
|
-
</ul>
|
|
609
|
-
$ erubis -x example.rhtml
|
|
610
|
-
_buf = ''; _buf << '<ul>
|
|
611
|
-
'; for item in @list
|
|
612
|
-
_buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
|
|
613
|
-
'; end
|
|
614
|
-
_buf << '</ul>
|
|
615
|
-
';
|
|
616
|
-
_buf.to_s
|
|
617
|
-
====================
|
|
618
|
-
|
|
619
|
-
- |
|
|
620
|
-
Erubis::StringBufferEnhancer#add_postamble() prints "_buf.to_s"
|
|
621
|
-
instead of "_buf".
|
|
622
|
-
This is useful for 'erubis -x file.rhtml | ruby -wc'.
|
|
623
|
-
|
|
624
|
-
- |
|
|
625
|
-
Command-line option '-T' is removed. Use '--trim=false' instead.
|
|
626
|
-
|
|
627
|
-
- |
|
|
628
|
-
License is changed to MIT License.
|
|
629
|
-
|
|
630
|
-
- |
|
|
631
|
-
Embedded pattern '<%- -%>' can be handled.
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
#
|
|
635
|
-
- release: 2.1.0
|
|
636
|
-
date: 2006-09-23
|
|
637
|
-
enhancements:
|
|
638
|
-
- |
|
|
639
|
-
Ruby on Rails support. Add the following code to
|
|
640
|
-
your 'app/controllers/application.rb' and restart web server.
|
|
641
|
-
|
|
642
|
-
--------------------
|
|
643
|
-
require 'erubis/helper/rails'
|
|
644
|
-
suffix = 'erubis'
|
|
645
|
-
ActionView::Base.register_template_handler(suffix, Erubis::Helper::RailsTemplate)
|
|
646
|
-
#Erubis::Helper::RailsTemplate.engine_class = Erubis::EscapedEruby ## or Erubis::PI::Eruby
|
|
647
|
-
#Erubis::Helper::RailsTemplate.default_properties = { :escape=>true, :escapefunc=>'h' }
|
|
648
|
-
--------------------
|
|
649
|
-
|
|
650
|
-
And rename your view template as 'xxx.erubis'.
|
|
651
|
-
If you got the "(eval):10:in `render': no block given" error,
|
|
652
|
-
use '@content_for_layout' instead 'yield' in your layout template.
|
|
653
|
-
|
|
654
|
-
- |
|
|
655
|
-
Another eRuby engine (PIEngine) support. This engine doesn't
|
|
656
|
-
break HTML design because it uses Processing Instructions (PI)
|
|
657
|
-
'<?rb .. ?>' as embedded pattern instead of '<% .. %>'.
|
|
658
|
-
|
|
659
|
-
example.rhtml
|
|
660
|
-
--------------------
|
|
661
|
-
<table>
|
|
662
|
-
<?rb @list.each_with_index do |item, i| ?>
|
|
663
|
-
<?rb klass = i % 2 == 0 ? 'odd' : 'even' ?>
|
|
664
|
-
<tr class="@{klass}@">
|
|
665
|
-
<td>@!{item}@</td>
|
|
666
|
-
</tr>
|
|
667
|
-
<?rb end ?>
|
|
668
|
-
</table>
|
|
669
|
-
--------------------
|
|
670
|
-
|
|
671
|
-
compile:
|
|
672
|
-
====================
|
|
673
|
-
$ erubis -x --pi example.rhtml
|
|
674
|
-
_buf = []; _buf << '<table>
|
|
675
|
-
'; @list.each_with_index do |item, i|
|
|
676
|
-
klass = i % 2 == 0 ? 'odd' : 'even'
|
|
677
|
-
_buf << ' <tr class="'; _buf << Erubis::XmlHelper.escape_xml(klass); _buf << '">
|
|
678
|
-
<td>'; _buf << (item).to_s; _buf << '</td>
|
|
679
|
-
</tr>
|
|
680
|
-
'; end
|
|
681
|
-
_buf << '</table>
|
|
682
|
-
';
|
|
683
|
-
_buf.join
|
|
684
|
-
====================
|
|
685
|
-
|
|
686
|
-
- |
|
|
687
|
-
Add new command 'notext' which remove text part from eRuby
|
|
688
|
-
script and leaves only Ruby code.
|
|
689
|
-
This is very useful for debug of eRuby script.
|
|
690
|
-
|
|
691
|
-
example2.rhtml
|
|
692
|
-
--------------------
|
|
693
|
-
<html>
|
|
694
|
-
<body>
|
|
695
|
-
<table>
|
|
696
|
-
<% @list.each_with_index do |item, i| %>
|
|
697
|
-
<% klass = i % 2 == 0 ? 'odd' : 'even' %>
|
|
698
|
-
<tr class="<%= klass %>">
|
|
699
|
-
<td><%== item %></td>
|
|
700
|
-
</tr>
|
|
701
|
-
<% end %>
|
|
702
|
-
</table>
|
|
703
|
-
</body>
|
|
704
|
-
</html>
|
|
705
|
-
--------------------
|
|
706
|
-
|
|
707
|
-
command line example:
|
|
708
|
-
====================
|
|
709
|
-
$ notext example2.rhtml
|
|
710
|
-
_buf = [];
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
@list.each_with_index do |item, i| ;
|
|
714
|
-
klass = i % 2 == 0 ? 'odd' : 'even' ;
|
|
715
|
-
_buf << ( klass ).to_s;
|
|
716
|
-
_buf << Erubis::XmlHelper.escape_xml( item );
|
|
717
|
-
|
|
718
|
-
end ;
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
_buf.join
|
|
723
|
-
$ notext -nc example2.rhtml
|
|
724
|
-
1: _buf = [];
|
|
725
|
-
4: @list.each_with_index do |item, i| ;
|
|
726
|
-
5: klass = i % 2 == 0 ? 'odd' : 'even' ;
|
|
727
|
-
6: _buf << ( klass ).to_s;
|
|
728
|
-
7: _buf << Erubis::XmlHelper.escape_xml( item );
|
|
729
|
-
9: end ;
|
|
730
|
-
13: _buf.join
|
|
731
|
-
====================
|
|
732
|
-
|
|
733
|
-
- |
|
|
734
|
-
Add new enhance 'NoCode' which removes ruby code from
|
|
735
|
-
eRuby script and leaves only HTML text part.
|
|
736
|
-
It is very useful to validate HTML of eRuby script.
|
|
737
|
-
|
|
738
|
-
command-line example:
|
|
739
|
-
====================
|
|
740
|
-
$ erubis -x -E NoCode example2.rhtml
|
|
741
|
-
<html>
|
|
742
|
-
<body>
|
|
743
|
-
<table>
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
<tr class="">
|
|
747
|
-
<td></td>
|
|
748
|
-
</tr>
|
|
749
|
-
|
|
750
|
-
</table>
|
|
751
|
-
</body>
|
|
752
|
-
</html>
|
|
753
|
-
====================
|
|
754
|
-
|
|
755
|
-
changes:
|
|
756
|
-
- License is changed to LGPL.
|
|
757
|
-
- Command-line property '--escape=name' is renamed to
|
|
758
|
-
'--escapefunc=name'.
|
|
759
|
-
- When command-line option '-l perl' is specified, function
|
|
760
|
-
'encode_entities()' is used ad escaping function which is
|
|
761
|
-
available wth HTML::Entities module.
|
|
762
|
-
|
|
763
|
-
bugfix:
|
|
764
|
-
- There is a certain pattern which makes Engine#convert()
|
|
765
|
-
too slow. Now Engne#convert() is fixed not to be slown.
|
|
766
|
-
- Command name is now displayed when '-h' is specified.
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
#
|
|
770
|
-
- release: 2.0.1
|
|
771
|
-
date: 2006-06-21
|
|
772
|
-
bugfix:
|
|
773
|
-
- some minor bugs are fixed
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
#
|
|
777
|
-
- release: 2.0.0
|
|
778
|
-
date: 2006-05-20
|
|
779
|
-
changes:
|
|
780
|
-
- module 'PrintEnhancer' is renamed to 'PrintEnabledEnahncer'
|
|
781
|
-
- module 'FastEnhancer' and class 'FastEruby' is obsolete because they are integrated into Eruby class
|
|
782
|
-
- Eruby#evaluate() calls instance_eval() instead of eval()
|
|
783
|
-
- XmlEruby.escape_xml() is moved to XmlHelper.escape_xml()
|
|
784
|
-
enhancements:
|
|
785
|
-
- multi programming language support (Ruby/PHP/C/Java/Scheme/Perl/Javascript)
|
|
786
|
-
- class Eruby runs very fast because FastEnhancer module is integrated into Eruby by default
|
|
787
|
-
- TinyEruby class (tiny.rb) is added
|
|
788
|
-
- module ArrayBufferEnhancer added
|
|
789
|
-
- module ArrayEnhancer added
|
|
790
|
-
- module BiPatternEnhancer added
|
|
791
|
-
- module EscapeEnhancer added
|
|
792
|
-
- module HeaderFooterEnhancer added
|
|
793
|
-
- module NoTextEnhancer added
|
|
794
|
-
- module PercentLineEnhancer added
|
|
795
|
-
- module PrintEnabledEnhancer added
|
|
796
|
-
- module PrintOutEnhancer added
|
|
797
|
-
- module SimplifyEnhancer added
|
|
798
|
-
- module StringBufferEnhancer added
|
|
799
|
-
- module StringIOEnhancer added
|
|
800
|
-
- command-line option '-b' (body only) added
|
|
801
|
-
- command-line option '-e' (escape) added
|
|
802
|
-
- command-line option '-l' (lang) added
|
|
803
|
-
- command-line option '-E' (enhancer) added
|
|
804
|
-
- command-line option '-I' (require path) added
|
|
805
|
-
- command-line option '-K' (kanji code) added
|
|
806
|
-
- command-line option '-S' (string to symbol) added
|
|
807
|
-
- command-line option '-B' (call result(binding())) added
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
#
|
|
811
|
-
- release: 1.1.0
|
|
812
|
-
date: 2006-03-05
|
|
813
|
-
enhancements:
|
|
814
|
-
- '<%# ... %>' is supported
|
|
815
|
-
- PrintEnhancer, PrintEruby, and PrintXmlEruby added
|
|
816
|
-
|
|
817
|
-
- release: 1.0.1
|
|
818
|
-
date: 2006-02-01
|
|
819
|
-
bugfixes:
|
|
820
|
-
- bin/erubis is available with RubyGems
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
#
|
|
824
|
-
- release: 1.0.0
|
|
825
|
-
date: 2006-02-01
|
|
826
|
-
bugfixes:
|
|
827
|
-
- first release
|
|
828
|
-
|