diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-13 01:02:20 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-13 01:02:20 +0000 |
| commit | c6278a7db80c4bf015213bfd4f4c9d62c5a3ca50 (patch) | |
| tree | 872850409c1d3a0895f0d61a471b56d368c58dfb /lib/rexml | |
| parent | 73193abf028a75fac169b4cd883b9b8569bf9bc7 (diff) | |
merges r20620 from trunk into ruby_1_9_1.
* lib/rexml/document.rb (REXML::Document#write): require
rexml/formatters/transitive if transitive flag is on. a patch
from akira yamada in [ruby-dev:36230]. fix #553
* lib/rexml/element.rb (REXML::Element#write): ditto.
* lib/rexml/formatters/transitive.rb (REXML::Formatters::Transitive#write_element):
add hack for IE. [ruby-dev:36230]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml')
| -rw-r--r-- | lib/rexml/document.rb | 1 | ||||
| -rw-r--r-- | lib/rexml/element.rb | 1 | ||||
| -rw-r--r-- | lib/rexml/formatters/transitive.rb | 4 |
3 files changed, 5 insertions, 1 deletions
diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb index 28c3a781d..48f1a0ec6 100644 --- a/lib/rexml/document.rb +++ b/lib/rexml/document.rb @@ -186,6 +186,7 @@ module REXML end formatter = if indent > -1 if transitive + require "rexml/formatters/transitive" REXML::Formatters::Transitive.new( indent, ie_hack ) else REXML::Formatters::Pretty.new( indent, ie_hack ) diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb index a1c01e7de..92308a5c9 100644 --- a/lib/rexml/element.rb +++ b/lib/rexml/element.rb @@ -691,6 +691,7 @@ module REXML Kernel.warn("#{self.class.name}.write is deprecated. See REXML::Formatters") formatter = if indent > -1 if transitive + require "rexml/formatters/transitive" REXML::Formatters::Transitive.new( indent, ie_hack ) else REXML::Formatters::Pretty.new( indent, ie_hack ) diff --git a/lib/rexml/formatters/transitive.rb b/lib/rexml/formatters/transitive.rb index 1d80f21fb..6083f0390 100644 --- a/lib/rexml/formatters/transitive.rb +++ b/lib/rexml/formatters/transitive.rb @@ -12,9 +12,10 @@ module REXML # formatted. Since this formatter does not alter whitespace nodes, the # results of formatting already formatted XML will be odd. class Transitive < Default - def initialize( indentation=2 ) + def initialize( indentation=2, ie_hack=false ) @indentation = indentation @level = 0 + @ie_hack = ie_hack end protected @@ -29,6 +30,7 @@ module REXML output << "\n" output << ' '*@level if node.children.empty? + output << " " if @ie_hack output << "/" else output << ">" |
