зеркало из https://github.com/github/ruby.git
------------------------------------------------------------------------
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
fcc9c6eab3
Коммит
0d04057aad
|
@ -59,7 +59,7 @@ module REXML
|
||||||
# c = CData.new( " Some text " )
|
# c = CData.new( " Some text " )
|
||||||
# c.write( $stdout ) #-> <![CDATA[ Some text ]]>
|
# c.write( $stdout ) #-> <![CDATA[ Some text ]]>
|
||||||
def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
|
def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
|
||||||
indent( output, indent )
|
indent( output, indent ) unless transitive
|
||||||
output << START
|
output << START
|
||||||
output << @string
|
output << @string
|
||||||
output << STOP
|
output << STOP
|
||||||
|
|
|
@ -659,7 +659,7 @@ module REXML
|
||||||
end
|
end
|
||||||
writer << "/"
|
writer << "/"
|
||||||
else
|
else
|
||||||
if transitive and indent>-1 and !@children[0].kind_of? Text
|
if transitive and indent>-1 and !@children[0].instance_of? Text
|
||||||
writer << "\n"
|
writer << "\n"
|
||||||
indent writer, indent+1
|
indent writer, indent+1
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# Main page:: http://www.germane-software.com/software/rexml
|
# Main page:: http://www.germane-software.com/software/rexml
|
||||||
# Author:: Sean Russell <serATgermaneHYPHENsoftwareDOTcom>
|
# Author:: Sean Russell <serATgermaneHYPHENsoftwareDOTcom>
|
||||||
# Version:: 3.0.7
|
# Version:: 3.0.8
|
||||||
# Date:: +2004/137
|
# Date:: +2004/137
|
||||||
#
|
#
|
||||||
# This API documentation can be downloaded from the REXML home page, or can
|
# This API documentation can be downloaded from the REXML home page, or can
|
||||||
|
@ -22,5 +22,5 @@
|
||||||
module REXML
|
module REXML
|
||||||
Copyright = "Copyright © 2001, 2002, 2003, 2004 Sean Russell <ser@germane-software.com>"
|
Copyright = "Copyright © 2001, 2002, 2003, 2004 Sean Russell <ser@germane-software.com>"
|
||||||
Date = "+2004/137"
|
Date = "+2004/137"
|
||||||
Version = "3.0.7"
|
Version = "3.0.8"
|
||||||
end
|
end
|
||||||
|
|
|
@ -194,7 +194,7 @@ module REXML
|
||||||
@raw = false
|
@raw = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def indent(string, level=1, style="\t", indentfirstline=true)
|
def indent_text(string, level=1, style="\t", indentfirstline=true)
|
||||||
return string if level < 0
|
return string if level < 0
|
||||||
new_string = ''
|
new_string = ''
|
||||||
string.each { |line|
|
string.each { |line|
|
||||||
|
@ -211,7 +211,7 @@ module REXML
|
||||||
if not (@parent and @parent.whitespace) then
|
if not (@parent and @parent.whitespace) then
|
||||||
s = wrap(s, 60, false) if @parent and @parent.context[:wordwrap] == :all
|
s = wrap(s, 60, false) if @parent and @parent.context[:wordwrap] == :all
|
||||||
if @parent and not @parent.context[:indentstyle].nil? and indent > 0 and s.count("\n") > 0
|
if @parent and not @parent.context[:indentstyle].nil? and indent > 0 and s.count("\n") > 0
|
||||||
s = indent(s, indent, @parent.context[:indentstyle], false)
|
s = indent_text(s, indent, @parent.context[:indentstyle], false)
|
||||||
end
|
end
|
||||||
s.squeeze!(" \n\t") if @parent and !@parent.whitespace
|
s.squeeze!(" \n\t") if @parent and !@parent.whitespace
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче