* 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:
parent
246b33d108
commit
620549da3f
@ -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>
|
Mon May 17 00:07:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
|
||||||
|
|
||||||
* lib/drb/drb.rb: Cosmetic documentation changes.
|
* lib/drb/drb.rb: Cosmetic documentation changes.
|
||||||
|
@ -33,7 +33,7 @@ module YAML
|
|||||||
#
|
#
|
||||||
# Emit plain, normal flowing text
|
# Emit plain, normal flowing text
|
||||||
#
|
#
|
||||||
def node_text( value, block = '>' )
|
def node_text( value, block = nil )
|
||||||
@seq_map = false
|
@seq_map = false
|
||||||
valx = value.dup
|
valx = value.dup
|
||||||
unless block
|
unless block
|
||||||
@ -65,6 +65,7 @@ module YAML
|
|||||||
end
|
end
|
||||||
indt = nil
|
indt = nil
|
||||||
indt = $&.to_i if block =~ /\d+/
|
indt = $&.to_i if block =~ /\d+/
|
||||||
|
#p [block, indt]
|
||||||
self << block + indent_text( valx, indt ) + "\n"
|
self << block + indent_text( valx, indt ) + "\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -93,10 +94,9 @@ module YAML
|
|||||||
#
|
#
|
||||||
# Write a text block with the current indent
|
# 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?
|
return "" if text.to_s.empty?
|
||||||
indt ||= 0
|
spacing = indent( mod )
|
||||||
spacing = indent( indt )
|
|
||||||
return "\n" + text.gsub( /^([^\n])/, "#{spacing}\\1" )
|
return "\n" + text.gsub( /^([^\n])/, "#{spacing}\\1" )
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -104,8 +104,8 @@ module YAML
|
|||||||
# Write a current indent
|
# Write a current indent
|
||||||
#
|
#
|
||||||
def indent( mod = nil )
|
def indent( mod = nil )
|
||||||
#p [ self.id, @level, :INDENT ]
|
#p [ self.id, level, mod, :INDENT ]
|
||||||
if level.zero?
|
if level <= 0
|
||||||
mod ||= 0
|
mod ||= 0
|
||||||
else
|
else
|
||||||
mod ||= options(:Indent)
|
mod ||= options(:Indent)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user