ruby-changes:47110
From: usa <ko1@a...>
Date: Fri, 30 Jun 2017 20:18:13 +0900 (JST)
Subject: [ruby-changes:47110] usa:r59225 (ruby_2_3): merge revision(s) 58823: [Backport #11464]
usa 2017-06-30 20:18:02 +0900 (Fri, 30 Jun 2017) New Revision: 59225 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59225 Log: merge revision(s) 58823: [Backport #11464] erb.rb: Allow trimming carriage return when trim_mode is "<>", for Windows environments. [Bug #11464] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/lib/erb.rb branches/ruby_2_3/test/erb/test_erb.rb branches/ruby_2_3/version.h Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 59224) +++ ruby_2_3/ChangeLog (revision 59225) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Fri Jun 30 20:16:15 2017 Takashi Kokubun <takashikkbn@g...> + + * lib/erb.rb: Allow trimming carriage return when trim_mode is "<>", for + Windows environments. [Bug #11464] + Fri Jun 30 20:07:37 2017 NARUSE, Yui <naruse@r...> * util.c (ruby_strtod) Merge latest dtoa.c [Bug #13545] Index: ruby_2_3/test/erb/test_erb.rb =================================================================== --- ruby_2_3/test/erb/test_erb.rb (revision 59224) +++ ruby_2_3/test/erb/test_erb.rb (revision 59225) @@ -197,6 +197,11 @@ EOS https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/erb/test_erb.rb#L197 assert_equal(ans, erb.result) end + def test_trim_line2_with_carriage_return + erb = @erb.new("<% 3.times do %>\r\nline\r\n<% end %>\r\n", nil, '<>') + assert_equal("line\r\n" * 3, erb.result) + end + class Foo; end def test_def_class Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 59224) +++ ruby_2_3/version.h (revision 59225) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.5" #define RUBY_RELEASE_DATE "2017-06-30" -#define RUBY_PATCHLEVEL 321 +#define RUBY_PATCHLEVEL 322 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 6 Index: ruby_2_3/lib/erb.rb =================================================================== --- ruby_2_3/lib/erb.rb (revision 59224) +++ ruby_2_3/lib/erb.rb (revision 59225) @@ -444,11 +444,11 @@ class ERB https://github.com/ruby/ruby/blob/trunk/ruby_2_3/lib/erb.rb#L444 def trim_line2(line) head = nil - line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\n|%>|\n|\z)/m) do |tokens| + line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\r?\n|%>|\n|\z)/m) do |tokens| tokens.each do |token| next if token.empty? head = token unless head - if token == "%>\n" + if token == "%>\n" || token == "%>\r\n" yield('%>') if is_erb_stag?(head) yield(:cr) Index: ruby_2_3 =================================================================== --- ruby_2_3 (revision 59224) +++ ruby_2_3 (revision 59225) Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r58823 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/