* lib/yaml/baseemitter.rb (indent_text): was forcing a mod value

of zero at times, which kept some blocks from getting indentation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
why 2004-05-16 15:29:30 +00:00
parent 246b33d108
commit 620549da3f
2 changed files with 120 additions and 115 deletions

View File

@ -1,3 +1,8 @@
Mon May 17 00:36:21 2004 why the lucky stiff <why@ruby-lang.org>
* lib/yaml/baseemitter.rb (indent_text): was forcing a mod value
of zero at times, which kept some blocks from getting indentation.
Mon May 17 00:07:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
* lib/drb/drb.rb: Cosmetic documentation changes.

View File

@ -33,7 +33,7 @@ module YAML
#
# Emit plain, normal flowing text
#
def node_text( value, block = '>' )
def node_text( value, block = nil )
@seq_map = false
valx = value.dup
unless block
@ -65,6 +65,7 @@ module YAML
end
indt = nil
indt = $&.to_i if block =~ /\d+/
#p [block, indt]
self << block + indent_text( valx, indt ) + "\n"
end
@ -93,10 +94,9 @@ module YAML
#
# Write a text block with the current indent
#
def indent_text( text, indt = nil )
def indent_text( text, mod = nil )
return "" if text.to_s.empty?
indt ||= 0
spacing = indent( indt )
spacing = indent( mod )
return "\n" + text.gsub( /^([^\n])/, "#{spacing}\\1" )
end
@ -104,8 +104,8 @@ module YAML
# Write a current indent
#
def indent( mod = nil )
#p [ self.id, @level, :INDENT ]
if level.zero?
#p [ self.id, level, mod, :INDENT ]
if level <= 0
mod ||= 0
else
mod ||= options(:Indent)