From 66b72eae1710087a38e41df6b9168acfe723cae9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 19 Jun 2014 19:11:16 -0400 Subject: v5 v6: ao, misc, mostly minor cleaning --- lib/sisu/v6/ao_doc_str.rb | 98 ++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 52 deletions(-) (limited to 'lib/sisu/v6/ao_doc_str.rb') diff --git a/lib/sisu/v6/ao_doc_str.rb b/lib/sisu/v6/ao_doc_str.rb index d060d89c..846a7027 100644 --- a/lib/sisu/v6/ao_doc_str.rb +++ b/lib/sisu/v6/ao_doc_str.rb @@ -63,14 +63,14 @@ module SiSU_AO_DocumentStructureExtract class Instantiate < SiSU_Param::Parameters::Instructions @@flag={ - ocn: :on, - code: :off, - poem: :off, - block: :off, - group: :off, - alt: :off, - table: :off, - table_to: :off, + ocn: :on, + code: :off, + poem: :off, + block: :off, + group: :off, + alt: :off, + table: :off, + table_to: :off, } def initialize @@counter=@@column=@@columns=0 @@ -79,14 +79,14 @@ module SiSU_AO_DocumentStructureExtract end class Build @@flag={ - ocn: :on, - code: :off, - poem: :off, - block: :off, - group: :off, - alt: :off, - table: :off, - table_to: :off, + ocn: :on, + code: :off, + poem: :off, + block: :off, + group: :off, + alt: :off, + table: :off, + table_to: :off, } def initialize(md,data) @md,@data=md,data @@ -516,7 +516,7 @@ module SiSU_AO_DocumentStructureExtract width=100.00/cols cols.times { col << width } end - h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table } + h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table } t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ obj: "table end #{@num_table}" } @@ -539,7 +539,7 @@ module SiSU_AO_DocumentStructureExtract r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") rows += r + Mx[:tc_c] end - h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table } + h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table } t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o h={ obj: "table end #{@num_table}" } @@ -1231,7 +1231,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} || dob.is==:alt \ || dob.is==:group \ || dob.is==:block - dob.obj=dob.obj.gsub(/\n\n/,"\n") #newlines taken out + dob.obj=dob.obj.gsub(/\n+/,"\n") #newlines taken out end @o_array << dob end @@ -1255,19 +1255,13 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} @data,@md=data,md end def dom - @s=[ - 'A', - 'B', - 'C', - 'D', - '1', - '2', - '3' - ] - @sp=' ' + @s=[ 'A', 'B', 'C', 'D', '1', '2', '3' ] tuned_file=structure_build tuned_file end + def spaces + Ax[:spaces] + end def structure_build data=@data tuned_file=[] @@ -1498,45 +1492,45 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} ary end def puts_tag_open(o,tag) - puts %{#{@sp*o.ln}<#{tag[o.ln]} id="#{o.node}">} + puts %{#{spaces*o.ln}<#{tag[o.ln]} id="#{o.node}">} end def puts_tag_close(lev,hs) case hs[0] when 0 - #puts "#{@sp*0}" if (lev <= 0) and hs[0] + #puts "#{spaces*0}" if (lev <= 0) and hs[0] puts "" if (lev==0) when 1 - puts "#{@sp*1}" if (lev <= 1) and hs[1] + puts "#{spaces*1}" if (lev <= 1) and hs[1] puts "" if (lev==0) when 2 - puts "#{@sp*2}" if (lev <= 2) and hs[2] - puts "#{@sp*1}" if (lev <= 1) and hs[1] + puts "#{spaces*2}" if (lev <= 2) and hs[2] + puts "#{spaces*1}" if (lev <= 1) and hs[1] puts "" if (lev==0) when 3 - puts "#{@sp*3}" if (lev <= 3) and hs[3] - puts "#{@sp*2}" if (lev <= 2) and hs[2] - puts "#{@sp*1}" if (lev <= 1) and hs[1] + puts "#{spaces*3}" if (lev <= 3) and hs[3] + puts "#{spaces*2}" if (lev <= 2) and hs[2] + puts "#{spaces*1}" if (lev <= 1) and hs[1] puts "" if (lev==0) when 4 - puts "#{@sp*4}" if (lev <= 4) - puts "#{@sp*3}" if (lev <= 3) and hs[3] - puts "#{@sp*2}" if (lev <= 2) and hs[2] - puts "#{@sp*1}" if (lev <= 1) and hs[1] + puts "#{spaces*4}" if (lev <= 4) + puts "#{spaces*3}" if (lev <= 3) and hs[3] + puts "#{spaces*2}" if (lev <= 2) and hs[2] + puts "#{spaces*1}" if (lev <= 1) and hs[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) and hs[3] - puts "#{@sp*2}" if (lev <= 2) and hs[2] - puts "#{@sp*1}" if (lev <= 1) and hs[1] + puts "#{spaces*5}" if (lev <= 5) + puts "#{spaces*4}" if (lev <= 4) + puts "#{spaces*3}" if (lev <= 3) and hs[3] + puts "#{spaces*2}" if (lev <= 2) and hs[2] + puts "#{spaces*1}" if (lev <= 1) and hs[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) and hs[3] - puts "#{@sp*2}" if (lev <= 2) and hs[2] - puts "#{@sp*1}" if (lev <= 1) and hs[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) and hs[3] + puts "#{spaces*2}" if (lev <= 2) and hs[2] + puts "#{spaces*1}" if (lev <= 1) and hs[1] puts "" if (lev==0) end end -- cgit v1.2.3