From 83137da0f259e8366eba7f626319b5a5b9b27d6d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 19 Jun 2014 19:17:23 -0400 Subject: v5 v6: indent spaces, minor --- lib/sisu/v5/xml_scaffold_structure_sisu.rb | 55 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'lib/sisu/v5/xml_scaffold_structure_sisu.rb') diff --git a/lib/sisu/v5/xml_scaffold_structure_sisu.rb b/lib/sisu/v5/xml_scaffold_structure_sisu.rb index 5e2afa4d..39ca1e6a 100644 --- a/lib/sisu/v5/xml_scaffold_structure_sisu.rb +++ b/lib/sisu/v5/xml_scaffold_structure_sisu.rb @@ -70,7 +70,9 @@ module SiSU_XML_Scaffold_Structure_Sisu 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_Sisu class Scroll \n\n" data.each_with_index do |o,i| if (o.is ==:heading || o.is ==:heading_insert) - puts "#{@sp*o.ln}<#{tags.sisu[o.ln]}>[#{o.ocn}] #{o.ln} #{o.obj}" + puts "#{spaces*o.ln}<#{tags.sisu[o.ln]}>[#{o.ocn}] #{o.ln} #{o.obj}" end end end def output(o,lev=nil,comment='') - puts lev == 0..6 \ - ? "#{@sp*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}#{comment}" + puts lev == (0..6) \ + ? "#{spaces*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}#{comment}" : "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}#{comment}" end def structure_build_sisu(data) @@ -131,7 +132,7 @@ module SiSU_XML_Scaffold_Structure_Sisu data.each_with_index do |o,i| if (o.is ==:heading || o.is ==:heading_insert) structure_build_tag_close(o.ln,h) - puts "#{@sp*o.ln}<#{@s[o.ln]}>\n#{@sp*o.ln} [#{o.ocn}] #{o.ln} {#{o.node}}" + puts "#{spaces*o.ln}<#{@s[o.ln]}>\n#{spaces*o.ln} [#{o.ocn}] #{o.ln} {#{o.node}}" case o.ln when 1 h=[o.ln,true,false,false] @@ -149,37 +150,37 @@ module SiSU_XML_Scaffold_Structure_Sisu def structure_build_tag_close(lev,h) case h[0] when 1 - puts "#{@sp*1}" if (lev <= 1) && h[1] + puts "#{spaces*1}" if (lev <= 1) && h[1] puts "" if (lev==0) when 2 - puts "#{@sp*2}" if (lev <= 2) && h[2] - puts "#{@sp*1}" if (lev <= 1) && h[1] + puts "#{spaces*2}" if (lev <= 2) && h[2] + puts "#{spaces*1}" if (lev <= 1) && h[1] puts "" if (lev==0) when 3 - puts "#{@sp*3}" if (lev <= 3) && h[3] - puts "#{@sp*2}" if (lev <= 2) && h[2] - puts "#{@sp*1}" if (lev <= 1) && h[1] + puts "#{spaces*3}" if (lev <= 3) && h[3] + puts "#{spaces*2}" if (lev <= 2) && h[2] + puts "#{spaces*1}" if (lev <= 1) && h[1] puts "" if (lev==0) when 4 - puts "#{@sp*4}" if (lev <= 4) - puts "#{@sp*3}" if (lev <= 3) && h[3] - puts "#{@sp*2}" if (lev <= 2) && h[2] - puts "#{@sp*1}" if (lev <= 1) && h[1] + puts "#{spaces*4}" if (lev <= 4) + puts "#{spaces*3}" if (lev <= 3) && h[3] + puts "#{spaces*2}" if (lev <= 2) && h[2] + puts "#{spaces*1}" if (lev <= 1) && h[1] puts "" if (lev==0) when 5 - puts "#{@sp*5}" if (lev <= 5) - puts "#{@sp*4}" if (lev <= 4) - puts "#{@sp*3}" if (lev <= 3) && h[3] - puts "#{@sp*2}" if (lev <= 2) && h[2] - puts "#{@sp*1}" if (lev <= 1) && h[1] + puts "#{spaces*5}" if (lev <= 5) + puts "#{spaces*4}" if (lev <= 4) + puts "#{spaces*3}" if (lev <= 3) && h[3] + puts "#{spaces*2}" if (lev <= 2) && h[2] + puts "#{spaces*1}" if (lev <= 1) && h[1] puts "" if (lev==0) when 6 - puts "#{@sp*6}" if (lev <= 6) - puts "#{@sp*5}" if (lev <= 5) - puts "#{@sp*4}" if (lev <= 4) - puts "#{@sp*3}" if (lev <= 3) && h[3] - puts "#{@sp*2}" if (lev <= 2) && h[2] - puts "#{@sp*1}" if (lev <= 1) && h[1] + puts "#{spaces*6}" if (lev <= 6) + puts "#{spaces*5}" if (lev <= 5) + puts "#{spaces*4}" if (lev <= 4) + puts "#{spaces*3}" if (lev <= 3) && h[3] + puts "#{spaces*2}" if (lev <= 2) && h[2] + puts "#{spaces*1}" if (lev <= 1) && h[1] puts "" if (lev==0) end end -- cgit v1.2.3