Project

General

Profile

Actions

Bug #213

closed

Different ERB behavior across versions

Added by febuiles (Federico Builes) over 16 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
ruby -v:
[ruby-core:17491]

Description

=begin
I'm seeing some differences in ERB processing across 1.8.6, 1.8.7 and
1.9. 1.8.6 and 1.9 behave the same while 1.8.7 differs:

  $ cat foo.rb 
  require 'erb'
  str = <<'END'
  <ul>
  % list = [1,2,3]
  %for item in list
  %  if item
    <li><%= item %>
    <% end %>
  <% end %>
  </ul>
  %%%
  END
  
  p ERB.new(str, nil, "%").result
  
  
  $ ruby -v foo.rb 
  ruby 1.8.6 (2008-06-29 patchlevel 255) [i686-darwin9.3.0]
  "<ul>\n  <li>1\n  \n  <li>2\n  \n  <li>3\n  \n\n</ul>\n%%\n"
  
  $ ruby-1.9 -v foo.rb 
  ruby 1.9.0 (2008-06-10 revision 15929) [i686-darwin9.3.0]
  "<ul>\n  <li>1\n  \n  <li>2\n  \n  <li>3\n  \n\n</ul>\n%%\n"
  
  $ ruby-1.8.7 -v foo.rb 
  ruby 1.8.7 (2008-05-31 patchlevel 0) [i686-darwin9.3.0]
  "<ul>\n  <li>1\n  \n  <li>2\n  \n  <li>3\n  \n\n</ul>\n%"

In order:

  # 1.8.6 => "<ul>\n  <li>1\n  \n  <li>2\n  \n  <li>3\n  \n\n</ul>\n%%\n"
  # 1.9   => "<ul>\n  <li>1\n  \n  <li>2\n  \n  <li>3\n  \n\n</ul>\n%%\n"
  # 1.8.7 => "<ul>\n  <li>1\n  \n  <li>2\n  \n  <li>3\n  \n\n</ul>\n%"

I think this is a bug in 1.8.7 but I'd like some clarification.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0