aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/ao_doc_str.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-06-19 19:11:16 -0400
committerRalph Amissah <ralph@amissah.com>2014-06-19 19:11:16 -0400
commit66b72eae1710087a38e41df6b9168acfe723cae9 (patch)
tree0169faa8886c19c5626b6a9802d229bea60439cf /lib/sisu/v5/ao_doc_str.rb
parentv5 v6: version & changelog (& rakefile) (diff)
v5 v6: ao, misc, mostly minor cleaning
Diffstat (limited to 'lib/sisu/v5/ao_doc_str.rb')
-rw-r--r--lib/sisu/v5/ao_doc_str.rb98
1 files changed, 46 insertions, 52 deletions
diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb
index b66f01d1..15d4aa9e 100644
--- a/lib/sisu/v5/ao_doc_str.rb
+++ b/lib/sisu/v5/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}</#{@s[0]}>" if (lev <= 0) and hs[0]
+ #puts "#{spaces*0}</#{@s[0]}>" if (lev <= 0) and hs[0]
puts "</#{@s[0]}>" if (lev==0)
when 1
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 2
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 3
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[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) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[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) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[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) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[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) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[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) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
end
end