ruby-changes:13935
From: xibbar <ko1@a...>
Date: Fri, 13 Nov 2009 00:50:11 +0900 (JST)
Subject: [ruby-changes:13935] Ruby:r25738 (trunk): * lib/cgi/util.rb (CGI::pretty): fix the overflow bug
xibbar 2009-11-13 00:48:46 +0900 (Fri, 13 Nov 2009) New Revision: 25738 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25738 Log: * lib/cgi/util.rb (CGI::pretty): fix the overflow bug if stripped string.[ruby-dev:37975] Modified files: trunk/ChangeLog trunk/lib/cgi/util.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 25737) +++ ChangeLog (revision 25738) @@ -1,3 +1,8 @@ +Fri Nov 13 00:46:24 2009 Takeyuki FUJIOKA <xibbar@r...> + + * lib/cgi/util.rb (CGI::pretty): fix the overflow bug + if stripped string.[ruby-dev:37975] + Thu Nov 12 23:08:11 2009 Takeyuki FUJIOKA <xibbar@r...> * lib/cgi/core.rb (read_from_cmdline): this code is better. Index: lib/cgi/util.rb =================================================================== --- lib/cgi/util.rb (revision 25737) +++ lib/cgi/util.rb (revision 25738) @@ -170,7 +170,7 @@ # # </HTML> # def CGI::pretty(string, shift = " ") - lines = string.gsub(/(?!\A)<(?:.|\n)*?>/, "\n\\0").gsub(/<(?:.|\n)*?>(?!\n)/, "\\0\n") + lines = string.gsub(/(?!\A)<.*?>/m, "\n\\0").gsub(/<.*?>(?!\n)/m, "\\0\n") end_pos = 0 while end_pos = lines.index(/^<\/(\w+)/, end_pos) element = $1.dup -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/