Project

General

Profile

Bug #5892

REXML always wraps long tag text regardless the page width setting.

Added by dimitri-lo2u (Dimitri Geshef) over 8 years ago. Updated over 8 years ago.

Status:
Rejected
Priority:
Normal
Target version:
ruby -v:
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
Backport:
[ruby-core:42112]

Description

When ones prints a REXML document that contains a tag with a long text (with space chars), the REXML::Formatters::Pretty formatter will force a line wrapping at column 80.
If one changes the value of the width attribute of the formatter to a very large value does not change the result.
In other words, the formatter ignores the value of the 'width' attribute.
The REXML version used is:
REXML VERSION = "3.1.7.3"
REXML REVISION = 26193

Apparently, the defect lies in the method REXML::Formatters::Pretty#write_text.
There is a statement with a hardcoded value of 80.
Look in the .rb file in attachment for a possible fix of this bug.


Files

XML_text_wrapping.rb (2.33 KB) XML_text_wrapping.rb Code with defect and possible bug fix dimitri-lo2u (Dimitri Geshef), 01/13/2012 10:42 PM

Related issues

Has duplicate Ruby master - Bug #4498: REXML Pretty formater does use specified 'width' to wrap linesClosedkou (Kouhei Sutou)03/13/2011Actions

Updated by naruse (Yui NARUSE) over 8 years ago

  • Status changed from Open to Assigned
  • Assignee set to kou (Kouhei Sutou)

Updated by kou (Kouhei Sutou) over 8 years ago

  • Status changed from Assigned to Rejected
  • % Done changed from 0 to 100

=begin
It seems that this had been fixed in Ruby 1.9.3. Please update your ruby or request a backport for r31997 and r31998. (ayumin will backport them. :-) See also #4498.

Ruby 1.9.3p0:
% ruby1.9.1 -v /tmp/XML_text_wrapping.rb
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
<?xml version='1.0' encoding='UTF-8'?>

foo:bar
123456789 123456789 123456789 123456789 123456789 123456789 123456789
123456789 123456789 123456789 123456789 123456789 123456789 123456789
123456789 123456789 123456789 123456789 123456789 123456789
/foo:bar
<?xml version='1.0' encoding='UTF-8'?>

foo:bar
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
/foo:bar
/tmp/XML_text_wrapping.rb:52: warning: method redefined; discarding old write_text
/usr/lib/ruby/1.9.1/rexml/formatters/pretty.rb:87: warning: previous definition of write_text was here
<?xml version='1.0' encoding='UTF-8'?>

foo:bar
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
/foo:bar

Ruby trunk (r34305):
% /tmp/local/bin/ruby -v /tmp/XML_text_wrapping.rb
ruby 2.0.0dev (2012-01-14 trunk 34305) [x86_64-linux]
<?xml version='1.0' encoding='UTF-8'?>

foo:bar
123456789 123456789 123456789 123456789 123456789 123456789 123456789
123456789 123456789 123456789 123456789 123456789 123456789 123456789
123456789 123456789 123456789 123456789 123456789 123456789
/foo:bar
<?xml version='1.0' encoding='UTF-8'?>

foo:bar
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
/foo:bar
/tmp/XML_text_wrapping.rb:52: warning: method redefined; discarding old write_text
/tmp/local/lib/ruby/2.0.0/rexml/formatters/pretty.rb:87: warning: previous definition of write_text was here
<?xml version='1.0' encoding='UTF-8'?>

foo:bar
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
/foo:bar

=end

Also available in: Atom PDF