Project

General

Profile

Actions

Bug #213

closed

Different ERB behavior across versions

Added by febuiles (Federico Builes) over 15 years ago. Updated almost 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 #1

Updated by shyouhei (Shyouhei Urabe) over 15 years ago

=begin
卜部です。

以下のようなバグ報告がきています。1.8.7でなにやらエンバグしてしまってい
るようなのですが...

Federico Builes さんは書きました:

Issue #213 has been reported by Federico Builes.


Bug #213: Different ERB behavior across versions
http://redmine.ruby-lang.org/issues/show/213

Author: Federico Builes
Status: Open
Priority: Normal
Assigned to:
Category:
Target version:

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.


You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://redmine.ruby-lang.org/my/account

=end

Actions #2

Updated by Anonymous over 15 years ago

=begin
咳といいます。

On 2008/07/04, at 14:09, Urabe Shyouhei wrote:

卜部です。

以下のようなバグ報告がきています。1.8.7でなにやらエン
バグしてしまってい
るようなのですが...

ごめんなさい。ごめんなさい。ごめんなさい。
たしかに1.8.7で壊してしまったようです。
%%ではじまるときは特別だ、って仕様を忘れてました。

ruby_1_8にciしました。 

=end

Actions #3

Updated by rogerdpack (Roger Pack) over 15 years ago

=begin
here's wishing
require 'erb'
template = ERB.new <<-EOF
x is <%= x # this should work %>
EOF
x = 4
puts template.result(binding)

worked :)
=end

Actions #4

Updated by nobu (Nobuyoshi Nakada) over 15 years ago

=begin
Hi,

At Thu, 10 Jul 2008 10:01:25 +0900,
Roger Pack wrote in [ruby-core:17714]:

here's wishing
require 'erb'
template = ERB.new <<-EOF
x is <%= x # this should work %>
EOF
x = 4
puts template.result(binding)

worked :)

It seems not to work even in 1.8.0, and 1.6 didn't have erb, it
was since 1.7.3 and 1.7 was a development version. From which
version do you say it's different?

--
Nobu Nakada

=end

Actions #5

Updated by shyouhei (Shyouhei Urabe) over 15 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r18002.
=end

Actions #6

Updated by rogerdpack (Roger Pack) over 15 years ago

=begin
Referring to http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/17403 for differences in versioning.
Just adding my wish for it :)
Some others have the same wish, apparently:
http://pennysmalls.com/2008/06/29/rails-on-ruby-187/
Thanks!
-R
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0