CHANGES.txt 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  1. # -*- coding: utf-8 -*-
  2. # $Release: 2.7.0 $
  3. # copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
  4. - release: 2.7.0
  5. date: 2011-04-01
  6. enhancements:
  7. - |
  8. New option ':bufvar' supported to specify buffer variable name.
  9. ex:
  10. input = "Hello <%= name %>!"
  11. eruby = Erubis::Eruby.new(input)
  12. puts eruby.src
  13. #=> _buf = ''; _buf << "Hello "; _buf << ( name ).to_s; _buf << '!';
  14. eruby = Erubis::Eruby.new(input, :bufvar=>'@_out')
  15. puts eruby.src
  16. #=> @_out = ''; @_out << 'Hello '; @_out << ( name ).to_s; @_out << '!';
  17. - |
  18. New enhancer 'PrefixedLineEnhancer' which is a customizable version
  19. of PercentLineEnhancer.
  20. The difference between PrefixedLineEnhancer and PercentLineEnhancer is:
  21. * You can indent Ruby statetment lines starting with '%'
  22. * You can specify prefix character by :prefixchar option.
  23. ex:
  24. class MyEruby < Erubis::Eruby
  25. include Erubis::PrefixedLineEnhancer
  26. end
  27. input = <<END
  28. <ul>
  29. % for item in @items
  30. <li><%= item %></li>
  31. % end
  32. %% you can indent '%' lines
  33. </ul>
  34. END
  35. eruby = MyEruby.new(input, :prefixchar=>'%') # default '%'
  36. puts eruby.src
  37. output:
  38. _buf = ''; _buf << '<ul>
  39. '; for item in @items
  40. _buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
  41. '; end
  42. % you can indent '%' lines
  43. _buf << '</ul>
  44. ';
  45. _buf.to_s
  46. - |
  47. Add helper CGI script. See 'public_html/README.txt' for details.
  48. - |
  49. Rubinius is supported as first-class Ruby implementation.
  50. - |
  51. C++ support. Try '-l cpp' command-line option.
  52. changes:
  53. - |
  54. Remove dependency to 'abstract' library.
  55. You don't need to install 'abstract' gem.
  56. - |
  57. Erubis::Eruby#load_file() now sets cache file timestamp to the same
  58. value as original eRuby file. For example, if you restore eRuby files
  59. from backup, Erubis::Eruby#load_file() can detect it and generate
  60. cache file again.
  61. ## generates cache file (A.rhtml.cache).
  62. eruby = Erubis::Eruby.load_file('A.rhtml')
  63. p File.mtime('A.rhtml') == File.mtime('A.rhtml.cache') #=> true
  64. - release: 2.6.6
  65. date: 2010-06-27
  66. bugfixes:
  67. - |
  68. Fixed a bug around InterporationEnhancer and FastEruby to escape back-quote. (thanks to Andrew R Jackson)
  69. - release: 2.6.5
  70. date: 2009-07-20
  71. bugfixes:
  72. - |
  73. Fixed bug around '-z' option.
  74. - release: 2.6.4
  75. date: 2009-02-18
  76. enhancements:
  77. - |
  78. Rails 2.2 and 2.3 support.
  79. - release: 2.6.3
  80. date: 2009-02-07
  81. bugfixes:
  82. - Enhancer name was not displayed in Ruby 1.9.1 when it was missing.
  83. - Command option argument name was not displayed correctly as a part of error message.
  84. - MethoNotFound error was raised when invalid option was specified.
  85. - release: 2.6.2
  86. date: 2008-06-12
  87. enhancements:
  88. - |
  89. Ruby 1.9 support.
  90. bugfixes:
  91. - |
  92. Fixed installation problem on Windows (Thanks to Tim Morgan and Allen).
  93. - release: 2.6.1
  94. date: 2008-06-06
  95. enhancements:
  96. - |
  97. Rails 2.1 support. (special thanks José Valim)
  98. - release: 2.6.0
  99. date: 2008-05-05
  100. enhancements:
  101. - |
  102. Improved support of Ruby on Rails 2.0.2.
  103. New class ActionView::TemplateHandlers::Erubis is defined and
  104. registered as default handler of *.html.erb and *.rhtml.
  105. - |
  106. '<%% %>' and '<%%= %>' are converted into '<% %>' and '<%= %>' respectively.
  107. This is for compatibility with ERB.
  108. ex1.rhtml:
  109. <ul>
  110. <%% for item in @list %>
  111. <li><%%= item %></li>
  112. <%% end %>
  113. </ul>
  114. result:
  115. $ erubis ex1.rhtml
  116. <ul>
  117. <% for item in @list %>
  118. <li><%= item %></li>
  119. <% end %>
  120. </ul>
  121. - |
  122. '<%= -%>' removes tail spaces and newlines.
  123. This is for compatibiliy with ERB when trim mode is '-'.
  124. '<%= =%>' also removes tail spaces and newlines, and this is
  125. Erubis-original enhancement (cooler than '<%= -%>', isn't it?).
  126. ex2.rhtml:
  127. <div>
  128. <%= @var -%> # or <%= @var =%>
  129. </div>
  130. result (version 2.6.0):
  131. $ erubis -c '{var: "AAA\n"}' ex2.rhtml
  132. <div>
  133. AAA
  134. </div>
  135. result (version 2.5.0):
  136. $ erubis -c '{var: "AAA\n"}' ex2.rhtml
  137. <div>
  138. AAA
  139. </div>
  140. - |
  141. Erubis::Eruby.load_file() now allows you to change cache filename.
  142. ex.
  143. eruby = Erubis::Eruby.load_file("ex3.rhtml",
  144. :cachename=>'ex3.rhtml.cache')
  145. - release: 2.5.0
  146. date: 2008-01-30
  147. enhancements:
  148. - |
  149. Ruby on Rails 2.0 support.
  150. If you are using preprocessing, notice that _?('foo.id') will be NG
  151. because it contains period ('.') character.
  152. --------------------
  153. <!-- NG in Rails 2.0 -->
  154. [%= link_to 'Edit', edit_user_path(_?('@user.id')) %]
  155. [%= link_to 'Show', @user %]
  156. [%= link_to 'Delete', @user, :confirm=>'OK?', :method=>:delete %]
  157. <!-- OK in Rails 2.0 -->
  158. <%= user_id = @user.id %>
  159. [%= link_to 'Edit', edit_user_path(_?('user_id')) %]
  160. [%= link_to 'Show', :action=>'show', :id=>_?('user_id') %]
  161. [%= link_to 'Delete', {:action=>'destroy', :id=>_?('user_id')},
  162. {:confirm=>'OK?', :method=>:delete} %]
  163. --------------------
  164. - |
  165. (experimental)
  166. Rails form helper methods for preprocessing are added.
  167. These helper methos are available with preprocessing.
  168. ex. _form.rhtml
  169. --------------------
  170. Name: <%= text_field :user, :name %>
  171. Name: [%= pp_text_field :user, :name %]
  172. --------------------
  173. preprocessed:
  174. --------------------
  175. Name: <%= text_field :user, :name %>
  176. Name: <input id="stock_name" name="stock[name]" size="30" type="text" value="<%=h @stock.name%>" />
  177. --------------------
  178. Ruby code:
  179. --------------------
  180. _buf << '
  181. Name: '; _buf << ( text_field :stock, :name ).to_s; _buf << '
  182. Name: <input id="stock_name" name="stock[name]" size="30" type="text" value="'; _buf << (h @stock.name).to_s; _buf << '" />
  183. ';
  184. --------------------
  185. This shows that text_filed() is called every time when rendering,
  186. but pp_text_filed() is called only once when loading template,
  187. so pp_text_field() with prepocessing is much faster than text_field().
  188. See User's guide for details.
  189. http://www.kuwata-lab.com/erubis/users-guide.05.html#rails-formhelpers
  190. #
  191. - release: 2.4.1
  192. date: 2007-09-25
  193. enhancements:
  194. - |
  195. Add new section 'evaluate(context) v.s. result(binding)' to user's guide.
  196. This section describes why Erubis::Eruby#evaluate(context) is recommended
  197. rather than Erubis::Eruby#result(binding).
  198. User's Guide > Other Topics > evaluate(context) v.s. result(binding)
  199. http://www.kuwata-lab.com/erubis/users-guide.06.html#topics-context-vs-binding
  200. - |
  201. Add new command-line property '--docwrite={true|false}' to
  202. Erubis::Ejavascript.
  203. If this property is true then 'document.write(_buf.join(""));' is used
  204. as postamble and if it is false then '_buf.join("")' is used.
  205. Default is true for compatibility reason but it will be false in the
  206. future release.
  207. (This feature was proposed by D.Dribin. Thank you.)
  208. bugfix:
  209. - |
  210. When using Erubis::Eruby#evaluate(), changing local variables in
  211. templates have affected to variables accessible with TOPLEVEL_BINDING.
  212. It means that if you change variables in templates, it is possible to
  213. change variables in main program.
  214. This was a bug and is now fixed not to affect to variables in main
  215. program.
  216. ex. template.rhtml
  217. --------------------
  218. <% for x in @items %>
  219. item = <%= x %>
  220. <% end %>
  221. --------------------
  222. ex. main-program.rb
  223. --------------------
  224. require 'erubis'
  225. x = 10
  226. items = ['foo', 'bar', 'baz']
  227. eruby = Erubis::Eruby.new(File.read('template.rhtml'))
  228. s = eruby.evaluate(:items=>items)
  229. print s
  230. $stderr.puts "*** debug: x=#{x.inspect}" #=> x="baz" (2.4.0)
  231. #=> x=10 (2.4.1)
  232. --------------------
  233. - |
  234. PercentLineEnhancer was very slow. Now performance problem is solved.
  235. #
  236. - release: 2.4.0
  237. date: 2007-07-19
  238. enhancements:
  239. - |
  240. Preprocessing is supported by Ruby on Rails helper.
  241. Preprocessing makes Ruby on Rails application about 20-40 percent faster.
  242. For example,
  243. [%= link_to 'Show', :action=>'show', :id=>_?('@user.id') %]
  244. is evaluate by preprocessor and expanded into the following
  245. when template file is loaded.
  246. <a href="/users/show/<%=@user.id%>">Show</a>
  247. It means that link_to() is not called when template is rendered
  248. and rendering speed will be much faster in the result.
  249. See User's Guide for details.
  250. - |
  251. Erubis::Eruby#evaluate() (or Erubis::RubyEvaluator#evaluate()) now
  252. creates Proc object from @src and eval it.
  253. def evaluate(context=Context.new)
  254. context = Context.new(context) if context.is_a?(Hash)
  255. @_proc ||= eval("proc { #{@src} }", TOPLEVEL_BINDING, @filename || '(erubis)')
  256. return context.instance_eval(&@_proc)
  257. end
  258. This makes evaluate() much faster when eruby object is reused.
  259. - |
  260. Erubis::Eruby#def_method() is supported.
  261. This method defines ruby code as instance method or singleton metod.
  262. require 'erubis'
  263. s = "hello <%= name %>"
  264. eruby = Erubis::Eruby.new(s)
  265. filename = 'hello.rhtml'
  266. ## define instance method to Dummy class (or module)
  267. class Dummy; end
  268. eruby.def_method(Dummy, 'render(name)', filename) # filename is optional
  269. p Dummy.new.render('world') #=> "hello world"
  270. ## define singleton method to an object
  271. obj = Object.new
  272. eruby.def_method(obj, 'render(name)', filename) # filename is optional
  273. p obj.render('world') #=> "hello world"
  274. This is equivarent to ERB#def_method().
  275. - |
  276. Erubis::XmlHelper.url_escape() and u() which is alias of url_escape()
  277. are added.
  278. This is equivarent to ERB#Util.url_escape().
  279. bugfix:
  280. - Help message was not shown when '-h' is specified. Fixed.
  281. - 'def method()' was not availabe in template file. Fixed.
  282. #
  283. - release: 2.3.1
  284. date: 2007-05-26
  285. bugfix:
  286. - A serious bug in 'helpers/rails_helper.rb' is fixed.
  287. You must be update if you are using Erubis with Ruby on Rails.
  288. #
  289. - release: 2.3.0
  290. date: 2007-05-23
  291. enhancements:
  292. - |
  293. New class 'Erubis::FastEruby' is added.
  294. It is a subclass of Erubis::Eruby and includes InterpolationEnhancer.
  295. Erubis::FastEruby is compatible with and faster than Erubis::Eruby.
  296. - |
  297. New enhancer 'InterpolationEnhancer' is added.
  298. This enhancer uses expression interpolation to eliminate method call
  299. of String#<<. In the result, this enhancer makes Eruby a little faster.
  300. --------------------
  301. ## Assume that input is '<a href="<%=url%>"><%=name%></a>'.
  302. ## Eruby convert input into the following code. String#<< is called 5 times.
  303. _buf << '<a href="'; _buf << (url).to_s; _buf << '">'; _buf << (name).to_s; _buf << '</a>';
  304. ## When InterpolationEnhancer is used, String#<< is called only once.
  305. _buf << %Q`<a href="#{url}">#{name}</a>`;
  306. --------------------
  307. - |
  308. New enhancer 'ErboutEnhancer' is added.
  309. ErboutEnhancer set '_erbout' as well as '_buf' to be compatible with ERB.
  310. ex.
  311. ====================
  312. $ cat ex.rhtml
  313. <p>Hello</p>
  314. $ erubis -x ex.rhtml
  315. _buf = ''; _buf << '<p>Hello</p>
  316. ';
  317. _buf.to_s
  318. $ erubis -xE Erbout ex.rhtml
  319. _erbout = _buf = ''; _buf << '<p>Hello</p>
  320. ';
  321. _buf.to_s
  322. ====================
  323. - |
  324. [experimental]
  325. New enhancer 'DeleteIndentEnhancer' is added.
  326. This enhancer deletes indentation of HTML file.
  327. ex.
  328. ====================
  329. $ cat ex.rhtml
  330. <div>
  331. <ul>
  332. <% for item in ['AAA', 'BBB', 'CCC'] %>
  333. <li><%= item %></li>
  334. <% end %>
  335. </ul>
  336. </div>
  337. $ erubis ex.rhtml
  338. <div>
  339. <ul>
  340. <li>AAA</li>
  341. <li>BBB</li>
  342. <li>CCC</li>
  343. </ul>
  344. </div>
  345. $ erubis -E DeleteIndent ex.rhtml
  346. <div>
  347. <ul>
  348. <li>AAA</li>
  349. <li>BBB</li>
  350. <li>CCC</li>
  351. </ul>
  352. </div>
  353. ====================
  354. - |
  355. Mod_ruby is supported (very thanks to Andrew R Jackson!).
  356. See users-guide and 'contrib/erubis-run.rb' for details.
  357. - |
  358. New command-line option '-X', '-N', '-U', and '-C' are added.
  359. These are intended to be a replacement of 'notext' command.
  360. '-X' shows only ruby statements and expressions.
  361. '-N' adds line numbers.
  362. '-U' compress empty lines into a line.
  363. '-C' removes empty lines.
  364. changes:
  365. - |
  366. 'helpers/rails_helper.rb' is changed to use ErboutEnhancer.
  367. The following is an examle to use Erubis with Ruby on Rails.
  368. File 'config/environment.rb':
  369. ----------------------------------------
  370. require 'erubis/helpers/rails_helper'
  371. #Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby
  372. #Erubis::Helpers::RailsHelper.init_properties = {}
  373. #Erubis::Helpers::RailsHelper.show_src = false # set true for debugging
  374. ----------------------------------------
  375. - |
  376. Command 'notext' has been removed. Use '-X', '-N', '-U', and '-C'
  377. instead.
  378. - |
  379. Tab characters in YAML file are expaneded automatically.
  380. If you want not to expand tab characters, add command-line optio '-T'.
  381. - |
  382. Benchmark scripts (benchmark/bench.*) are rewrited.
  383. - |
  384. Users-guide (doc/users-guide.html) is updated.
  385. #
  386. - release: 2.2.0
  387. date: 2007-02-11
  388. enhancements:
  389. - |
  390. Performance tuned up. Release 2.2.0 works about 8 percent faster
  391. than 2.1.0.
  392. As a result, Erubis works more than 10 percent faster than eruby.
  393. (eruby is the extension module of eRuby written in C.)
  394. - |
  395. Support of Ruby on Rails improved.
  396. If you want to use Erubis with Ruby on Rails, add the following code
  397. into your 'config/environment.rb' and restart web server.
  398. This will set Erubis as eRuby compiler in Ruby on Rails instead of ERB.
  399. --------------------
  400. require 'erubis/helpers/rails_helper'
  401. #Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby
  402. #Erubis::Helpers::RailsHelper.init_properties = {}
  403. #Erubis::Helpers::RailsHelper.show_src = true
  404. --------------------
  405. Methods 'capture()' and 'content_for()' of ActionView::Helpers::CaptureHelper
  406. are available. Methd ActionView::Helpers::TextHelper#concat() is also available.
  407. If Erubis::Helpers::RailsHelper.show_src is ture, Erubis prints converted
  408. Ruby code into log file (such as 'log/development.log').
  409. - |
  410. Erubis::Engine.load_file(filename) creates cache file (filename +
  411. '.cache') automatically if cache file is old or not exist.
  412. Caching makes Erubis about 40-50 percent faster.
  413. ex.
  414. --------------------
  415. require 'erubis'
  416. eruby = Erubis::Eruby.load_file('example.rhtml')
  417. ## cache file 'example.rhtml.cache' is created automatically
  418. --------------------
  419. - |
  420. Command-line option '-f datafile' can take Ruby script ('*.rb')
  421. as well as YAML file ('*.yaml' or '*.yml').
  422. ex.
  423. ====================
  424. $ cat context.rb
  425. @title = 'Example'
  426. @list = %w[AAA BBB CCC]
  427. $ cat example.rhtml
  428. <h1><%= @title %></h1>
  429. <ul>
  430. <% for item in @list %>
  431. <li><%= item %></li>
  432. <% end %>
  433. </ul>
  434. $ erubis -f context.rb example.rhtml
  435. <h1>Example</h1>
  436. <ul>
  437. <li>AAA</li>
  438. <li>BBB</li>
  439. <li>CCC</li>
  440. </ul>
  441. ====================
  442. - |
  443. New command-line option '-c context' support. It takes context string
  444. in YAML inline style or Ruby code style.
  445. ex. YAML inline style
  446. ====================
  447. $ erubis -c '{title: Example, list: [AAA, BBB, CCC]}' example.rhtml
  448. ====================
  449. ex. Ruby style
  450. ====================
  451. $ erubis -c '@title="Example"; @list=%w[AAA BBB CCC]' example.rhtml
  452. ====================
  453. - |
  454. New command-line option '-z' (syntax checking) support. It is similar
  455. to 'erubis -x file.rhtml | ruby -wc', but it can take several filenames.
  456. ex.
  457. ====================
  458. $ erubis -z app/views/*/*.rhtml
  459. Syntax OK
  460. ====================
  461. - |
  462. New constant Erubis::VERSION added.
  463. changes:
  464. - |
  465. Class Erubis::Eruby changed to include Erubis::StringBufferEnhancer
  466. instead of Erubis::ArrayBufferEnhancer.
  467. This is for Ruby on Rails support.
  468. ex.
  469. ====================
  470. $ cat example.rhtml
  471. <ul>
  472. <% for item in @list %>
  473. <li><%= item %></li>
  474. <% end %>
  475. </ul>
  476. $ erubis -x example.rhtml
  477. _buf = ''; _buf << '<ul>
  478. '; for item in @list
  479. _buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
  480. '; end
  481. _buf << '</ul>
  482. ';
  483. _buf.to_s
  484. ====================
  485. - |
  486. Erubis::StringBufferEnhancer#add_postamble() prints "_buf.to_s"
  487. instead of "_buf".
  488. This is useful for 'erubis -x file.rhtml | ruby -wc'.
  489. - |
  490. Command-line option '-T' is removed. Use '--trim=false' instead.
  491. - |
  492. License is changed to MIT License.
  493. - |
  494. Embedded pattern '<%- -%>' can be handled.
  495. #
  496. - release: 2.1.0
  497. date: 2006-09-23
  498. enhancements:
  499. - |
  500. Ruby on Rails support. Add the following code to
  501. your 'app/controllers/application.rb' and restart web server.
  502. --------------------
  503. require 'erubis/helper/rails'
  504. suffix = 'erubis'
  505. ActionView::Base.register_template_handler(suffix, Erubis::Helper::RailsTemplate)
  506. #Erubis::Helper::RailsTemplate.engine_class = Erubis::EscapedEruby ## or Erubis::PI::Eruby
  507. #Erubis::Helper::RailsTemplate.default_properties = { :escape=>true, :escapefunc=>'h' }
  508. --------------------
  509. And rename your view template as 'xxx.erubis'.
  510. If you got the "(eval):10:in `render': no block given" error,
  511. use '@content_for_layout' instead 'yield' in your layout template.
  512. - |
  513. Another eRuby engine (PIEngine) support. This engine doesn't
  514. break HTML design because it uses Processing Instructions (PI)
  515. '<?rb .. ?>' as embedded pattern instead of '<% .. %>'.
  516. example.rhtml
  517. --------------------
  518. <table>
  519. <?rb @list.each_with_index do |item, i| ?>
  520. <?rb klass = i % 2 == 0 ? 'odd' : 'even' ?>
  521. <tr class="@{klass}@">
  522. <td>@!{item}@</td>
  523. </tr>
  524. <?rb end ?>
  525. </table>
  526. --------------------
  527. compile:
  528. ====================
  529. $ erubis -x --pi example.rhtml
  530. _buf = []; _buf << '<table>
  531. '; @list.each_with_index do |item, i|
  532. klass = i % 2 == 0 ? 'odd' : 'even'
  533. _buf << ' <tr class="'; _buf << Erubis::XmlHelper.escape_xml(klass); _buf << '">
  534. <td>'; _buf << (item).to_s; _buf << '</td>
  535. </tr>
  536. '; end
  537. _buf << '</table>
  538. ';
  539. _buf.join
  540. ====================
  541. - |
  542. Add new command 'notext' which remove text part from eRuby
  543. script and leaves only Ruby code.
  544. This is very useful for debug of eRuby script.
  545. example2.rhtml
  546. --------------------
  547. <html>
  548. <body>
  549. <table>
  550. <% @list.each_with_index do |item, i| %>
  551. <% klass = i % 2 == 0 ? 'odd' : 'even' %>
  552. <tr class="<%= klass %>">
  553. <td><%== item %></td>
  554. </tr>
  555. <% end %>
  556. </table>
  557. </body>
  558. </html>
  559. --------------------
  560. command line example:
  561. ====================
  562. $ notext example2.rhtml
  563. _buf = [];
  564. @list.each_with_index do |item, i| ;
  565. klass = i % 2 == 0 ? 'odd' : 'even' ;
  566. _buf << ( klass ).to_s;
  567. _buf << Erubis::XmlHelper.escape_xml( item );
  568. end ;
  569. _buf.join
  570. $ notext -nc example2.rhtml
  571. 1: _buf = [];
  572. 4: @list.each_with_index do |item, i| ;
  573. 5: klass = i % 2 == 0 ? 'odd' : 'even' ;
  574. 6: _buf << ( klass ).to_s;
  575. 7: _buf << Erubis::XmlHelper.escape_xml( item );
  576. 9: end ;
  577. 13: _buf.join
  578. ====================
  579. - |
  580. Add new enhance 'NoCode' which removes ruby code from
  581. eRuby script and leaves only HTML text part.
  582. It is very useful to validate HTML of eRuby script.
  583. command-line example:
  584. ====================
  585. $ erubis -x -E NoCode example2.rhtml
  586. <html>
  587. <body>
  588. <table>
  589. <tr class="">
  590. <td></td>
  591. </tr>
  592. </table>
  593. </body>
  594. </html>
  595. ====================
  596. changes:
  597. - License is changed to LGPL.
  598. - Command-line property '--escape=name' is renamed to
  599. '--escapefunc=name'.
  600. - When command-line option '-l perl' is specified, function
  601. 'encode_entities()' is used ad escaping function which is
  602. available wth HTML::Entities module.
  603. bugfix:
  604. - There is a certain pattern which makes Engine#convert()
  605. too slow. Now Engne#convert() is fixed not to be slown.
  606. - Command name is now displayed when '-h' is specified.
  607. #
  608. - release: 2.0.1
  609. date: 2006-06-21
  610. bugfix:
  611. - some minor bugs are fixed
  612. #
  613. - release: 2.0.0
  614. date: 2006-05-20
  615. changes:
  616. - module 'PrintEnhancer' is renamed to 'PrintEnabledEnahncer'
  617. - module 'FastEnhancer' and class 'FastEruby' is obsolete because they are integrated into Eruby class
  618. - Eruby#evaluate() calls instance_eval() instead of eval()
  619. - XmlEruby.escape_xml() is moved to XmlHelper.escape_xml()
  620. enhancements:
  621. - multi programming language support (Ruby/PHP/C/Java/Scheme/Perl/Javascript)
  622. - class Eruby runs very fast because FastEnhancer module is integrated into Eruby by default
  623. - TinyEruby class (tiny.rb) is added
  624. - module ArrayBufferEnhancer added
  625. - module ArrayEnhancer added
  626. - module BiPatternEnhancer added
  627. - module EscapeEnhancer added
  628. - module HeaderFooterEnhancer added
  629. - module NoTextEnhancer added
  630. - module PercentLineEnhancer added
  631. - module PrintEnabledEnhancer added
  632. - module PrintOutEnhancer added
  633. - module SimplifyEnhancer added
  634. - module StringBufferEnhancer added
  635. - module StringIOEnhancer added
  636. - command-line option '-b' (body only) added
  637. - command-line option '-e' (escape) added
  638. - command-line option '-l' (lang) added
  639. - command-line option '-E' (enhancer) added
  640. - command-line option '-I' (require path) added
  641. - command-line option '-K' (kanji code) added
  642. - command-line option '-S' (string to symbol) added
  643. - command-line option '-B' (call result(binding())) added
  644. #
  645. - release: 1.1.0
  646. date: 2006-03-05
  647. enhancements:
  648. - '<%# ... %>' is supported
  649. - PrintEnhancer, PrintEruby, and PrintXmlEruby added
  650. - release: 1.0.1
  651. date: 2006-02-01
  652. bugfixes:
  653. - bin/erubis is available with RubyGems
  654. #
  655. - release: 1.0.0
  656. date: 2006-02-01
  657. bugfixes:
  658. - first release