Forum: Ruby-core Simple rexml formatter patch

Posted by Danilo Nascimento (Guest)
on 2010-03-09 23:07
(Received via mailing list)
write_text function in Pretty class doesn't use the width variable

--- lib/rexml/formatters/pretty.rb      (revision 26861)
+++ lib/rexml/formatters/pretty.rb      (working copy)
@@ -88,7 +88,7 @@
         s = node.to_s()
         s.gsub!(/\s/,' ')
         s.squeeze!(" ")
-        s = wrap(s, 80-@level)
+        s = wrap(s, @width-@level)
         s = indent_text(s, @level, " ", true)
         output << (' '*@level + s)
       end

IRB Session http://pastebin.com/YWqz7EnL

--------------------------------------------------------------------------------------------------------

IMO, REXML::Document.write should also have an option to set the
compact format output

[]'s Danilo Nascimento
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.