aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v6/xml_scaffold_structure_collapsed.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-06-19 19:17:23 -0400
committerRalph Amissah <ralph@amissah.com>2014-06-19 19:17:23 -0400
commit83137da0f259e8366eba7f626319b5a5b9b27d6d (patch)
tree761c81279d2b228ba17535a06970f792cbfd7b45 /lib/sisu/v6/xml_scaffold_structure_collapsed.rb
parentv5 v6: ao, misc, mostly minor cleaning (diff)
v5 v6: indent spaces, minor
Diffstat (limited to 'lib/sisu/v6/xml_scaffold_structure_collapsed.rb')
-rw-r--r--lib/sisu/v6/xml_scaffold_structure_collapsed.rb53
1 files changed, 27 insertions, 26 deletions
diff --git a/lib/sisu/v6/xml_scaffold_structure_collapsed.rb b/lib/sisu/v6/xml_scaffold_structure_collapsed.rb
index 23bc4f4c..9fece3bf 100644
--- a/lib/sisu/v6/xml_scaffold_structure_collapsed.rb
+++ b/lib/sisu/v6/xml_scaffold_structure_collapsed.rb
@@ -70,7 +70,9 @@ module SiSU_XML_Scaffold_Structure_Collapse
def initialize(opt)
@opt=opt
@particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
- @sp=' '
+ end
+ def spaces
+ Ax[:spaces]
end
def read
begin
@@ -87,7 +89,6 @@ module SiSU_XML_Scaffold_Structure_Collapse
class Scroll <Source
def initialize(data='',md='')
@data,@md=data,md
- @sp=' '
end
def songsheet
@t='sisu'
@@ -116,8 +117,8 @@ module SiSU_XML_Scaffold_Structure_Collapse
self
end
def output(o,lev=nil,comment='')
- puts lev == 0..6 \
- ? "#{@sp*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
+ puts lev == (0..6) \
+ ? "#{spaces*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
: "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
end
def structure_collapsed(data)
@@ -137,7 +138,7 @@ module SiSU_XML_Scaffold_Structure_Collapse
if (o.is ==:heading || o.is ==:heading_insert)
lev=o.lc
structure_build_tag_close(lev,h)
- puts "#{@sp*lev}<#{@s[lev]}>\n#{@sp*lev} [#{o.ocn}] #{lev} {#{o.node}}"
+ puts "#{spaces*lev}<#{@s[lev]}>\n#{spaces*lev} [#{o.ocn}] #{lev} {#{o.node}}"
h[0]=lev
end
end
@@ -146,37 +147,37 @@ module SiSU_XML_Scaffold_Structure_Collapse
def structure_build_tag_close(lev,h)
case h[0]
when 1
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 2
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 3
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 4
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 5
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 6
- puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6)
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6)
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
end
end