1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-12-11 01:20:23 +00:00
parent 54a722bd42
commit bc53f80b37
4 changed files with 16 additions and 1 deletions

View file

@ -1,3 +1,14 @@
Thu Dec 11 10:18:35 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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]
Thu Dec 11 02:37:22 2008 Yukihiro Matsumoto <matz@ruby-lang.org> Thu Dec 11 02:37:22 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* math.c (domain_check): should not raise EDOM exception for NaN * math.c (domain_check): should not raise EDOM exception for NaN

View file

@ -186,6 +186,7 @@ module REXML
end end
formatter = if indent > -1 formatter = if indent > -1
if transitive if transitive
require "rexml/formatters/transitive"
REXML::Formatters::Transitive.new( indent, ie_hack ) REXML::Formatters::Transitive.new( indent, ie_hack )
else else
REXML::Formatters::Pretty.new( indent, ie_hack ) REXML::Formatters::Pretty.new( indent, ie_hack )

View file

@ -691,6 +691,7 @@ module REXML
Kernel.warn("#{self.class.name}.write is deprecated. See REXML::Formatters") Kernel.warn("#{self.class.name}.write is deprecated. See REXML::Formatters")
formatter = if indent > -1 formatter = if indent > -1
if transitive if transitive
require "rexml/formatters/transitive"
REXML::Formatters::Transitive.new( indent, ie_hack ) REXML::Formatters::Transitive.new( indent, ie_hack )
else else
REXML::Formatters::Pretty.new( indent, ie_hack ) REXML::Formatters::Pretty.new( indent, ie_hack )

View file

@ -12,9 +12,10 @@ module REXML
# formatted. Since this formatter does not alter whitespace nodes, the # formatted. Since this formatter does not alter whitespace nodes, the
# results of formatting already formatted XML will be odd. # results of formatting already formatted XML will be odd.
class Transitive < Default class Transitive < Default
def initialize( indentation=2 ) def initialize( indentation=2, ie_hack=false )
@indentation = indentation @indentation = indentation
@level = 0 @level = 0
@ie_hack = ie_hack
end end
protected protected
@ -29,6 +30,7 @@ module REXML
output << "\n" output << "\n"
output << ' '*@level output << ' '*@level
if node.children.empty? if node.children.empty?
output << " " if @ie_hack
output << "/" output << "/"
else else
output << ">" output << ">"