Bug #541: cgi.rb : obsolete regex "n" option http://redmine.ruby-lang.org/issues/show/541 $B5/I<<T(B: Takeyuki Fujioka $B%9%F!<%?%9(B: Open, $BM%@hEY(B: Normal CGI::pretty$B$N@55,I=8=ItJ,$K(Bn$B$,;H$o$l$F$$$k$N$G(B warning$B$,=P$^$9!#(B Index: lib/cgi.rb =================================================================== --- lib/cgi.rb ($B%j%S%8%g%s(B 19071) +++ lib/cgi.rb ($B:n6H%3%T!<(B) @@ -1245,14 +1245,14 @@ # # </HTML> # def CGI::pretty(string, shift = " ") - lines = string.gsub(/(?!\A)<(?:.|\n)*?>/n, "\n\\0").gsub(/<(?:.|\n)*?>(?!\n)/n, "\\0\n") + lines = string.gsub(/(?!\A)<(?:.|\n)*?>/, "\n\\0").gsub(/<(?:.|\n)*?>(?!\n)/, "\\0\n") end_pos = 0 - while end_pos = lines.index(/^<\/(\w+)/n, end_pos) + while end_pos = lines.index(/^<\/(\w+)/, end_pos) element = $1.dup - start_pos = lines.rindex(/^\s*<#{element}/ni, end_pos) - lines[start_pos ... end_pos] = "__" + lines[start_pos ... end_pos].gsub(/\n(?!\z)/n, "\n" + shift) + "__" + start_pos = lines.rindex(/^\s*<#{element}/i, end_pos) + lines[start_pos ... end_pos] = "__" + lines[start_pos ... end_pos].gsub(/\n(?!\z)/, "\n" + shift) + "__" end - lines.gsub(/^((?:#{Regexp::quote(shift)})*)__(?=<\/?\w)/n, '\1') + lines.gsub(/^((?:#{Regexp::quote(shift)})*)__(?=<\/?\w)/, '\1') end
on 03.09.2008 14:32
on 08.09.2008 15:37
$B%A%1%C%H(B #541 $B$,99?7$5$l$^$7$?!#(B (by Takeyuki Fujioka) $B%9%F!<%?%9(B Open$B$+$i(BClosed$B$KJQ99(B $B?JD=(B % 0$B$+$i(B100$B$KJQ99(B Applied in changeset r19245. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/541