aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/ao_doc_str.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/ao_doc_str.rb')
-rw-r--r--lib/sisu/v5/ao_doc_str.rb294
1 files changed, 148 insertions, 146 deletions
diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb
index b66f01d1..43fa8e5e 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
@@ -225,7 +225,14 @@ module SiSU_AO_DocumentStructureExtract
def identify_parts
tuned_file=[]
@tuned_block,@tuned_code=[],[]
- @@counter,@verse_count,@num_code_block,@num_poem,@num_group,@num_block,@num_alt,@num_table=0,0,0,0,0,0,0,0
+ @@counter,@verse_count=0,0
+ @num_id={
+ code_block: 0,
+ poem: 0,
+ group: 0,
+ alt: 0,
+ table: 0,
+ }
@metadata={}
@data.each do |t_o|
if t_o =~/^--([+~-])[#]$/
@@ -248,7 +255,7 @@ module SiSU_AO_DocumentStructureExtract
end
t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") if @@flag[:code]==:off
if t_o !~/^(?:code|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \
- and t_o !~/^[`]{3}\s+(?:code|poem|alt|group|block|table)|^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ \
+ and t_o !~/^```[ ]+(?:code|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ \
and @@flag[:code]==:off \
and @@flag[:poem]==:off \
and @@flag[:group]==:off \
@@ -409,60 +416,60 @@ module SiSU_AO_DocumentStructureExtract
end
end
elsif @@flag[:code]==:off
- if t_o =~/^(?:code\{|[`]{3}\s+code)/
+ if t_o =~/^(?:code\{|```[ ]+code)/
@@flag[:code]=case t_o
when /^code\{/ then :curls
- when /^[`]{3}\s+code/ then :tics
+ when /^```[ ]+code/ then :tics
else @@flag[:code] #error
end
@@counter=1
- @codeblock_numbered=(t_o =~/^(?:code\{#|[`]{3}\s+code\s[#])/) ? true : false
- @num_code_block +=1
- h={ obj: "code block start #{@num_code_block}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
- elsif t_o =~/^(?:poem\{|[`]{3}\s+poem)/
+ @codeblock_numbered=(t_o =~/^(?:code\{#|```[ ]+code\s[#])/) ? true : false
+ @num_id[:code_block] +=1
+ h={ obj: '', sym: :code_block_open, num: @num_id[:code_block] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ elsif t_o =~/^(?:poem\{|```[ ]+poem)/
@@flag[:poem]=case t_o
- when /^poem\{/ then :curls
- when /^[`]{3}\s+poem/ then :tics
- else @@flag[:poem] #error
+ when /^poem\{/ then :curls
+ when /^```[ ]+poem/ then :tics
+ else @@flag[:poem] #error
end
- @num_poem +=1
- h={ obj: "poem start #{@num_poem}" }
+ @num_id[:poem] +=1
+ h={ obj: "poem start #{@num_id[:poem]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
- elsif t_o =~/^(?:group\{|[`]{3}\s+group)/
+ elsif t_o =~/^(?:group\{|```[ ]+group)/
@@flag[:group]=case t_o
- when /^group\{/ then :curls
- when /^[`]{3}\s+group/ then :tics
- else @@flag[:group] #error
+ when /^group\{/ then :curls
+ when /^```[ ]+group/ then :tics
+ else @@flag[:group] #error
end
- @num_group +=1
- h={ obj: "group text start #{@num_group}" }
+ @num_id[:group] +=1
+ h={ obj: "group text start #{@num_id[:group]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
- elsif t_o =~/^(?:block\{|[`]{3}\s+block)/
+ elsif t_o =~/^(?:block\{|```[ ]+block)/
@@flag[:block]=case t_o
- when /^block\{/ then :curls
- when /^[`]{3}\s+block/ then :tics
- else @@flag[:block] #error
+ when /^block\{/ then :curls
+ when /^```[ ]+block/ then :tics
+ else @@flag[:block] #error
end
- @num_block +=1
- h={ obj: "block text start #{@num_block}" }
+ @num_id[:block] +=1
+ h={ obj: "block text start #{@num_id[:block]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
- elsif t_o =~/^(?:alt\{|[`]{3}\s+alt)/
+ elsif t_o =~/^(?:alt\{|```[ ]+alt)/
@@flag[:alt]=case t_o
when /^alt\{/ then :curls
- when /^[`]{3}\s+alt/ then :tics
+ when /^```[ ]+alt/ then :tics
else @@flag[:alt] #error
end
- @num_alt +=1
- h={ obj: "alt text start #{@num_alt}" }
+ @num_id[:alt] +=1
+ h={ obj: "alt text start #{@num_id[:alt]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
- elsif t_o =~/^(?:table\{|[`]{3}\s+table|\{table)[ ~]/
- @num_table +=1
- h={ obj: "table start #{@num_table}" }
+ elsif t_o =~/^(?:table\{|```[ ]+table|\{table)[ ~]/
+ @num_id[:table] +=1
+ h={ obj: "table start #{@num_id[:table]}" }
ins=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << ins
if t_o=~/^table\{(?:~h)?\s+/
@@ -479,15 +486,15 @@ module SiSU_AO_DocumentStructureExtract
heading=false
end
@h={ head_: heading, cols: cols, widths: col, idx: idx }
- elsif t_o=~/^[`]{3}\s+table(?:~h)?\s+c\d+/
+ elsif t_o=~/^```[ ]+table(?:~h)?\s+c\d+/
@@flag[:table]=:tics
@rows=''
case t_o
- when /^[`]{3}\s+table~h\s+c(\d+);\s+(.+)/
+ when /^```[ ]+table~h\s+c(\d+);\s+(.+)/
cols=$1
col=$2.scan(/\d+/)
heading=true
- when /^[`]{3}\s+table\s+c(\d+);\s+(.+)/
+ when /^```[ ]+table\s+c(\d+);\s+(.+)/
cols=$1
col=$2.scan(/\d+/)
heading=false
@@ -516,18 +523,18 @@ 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_id[:table] }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: "table end #{@num_table}" }
+ h={ obj: "table end #{@num_id[:table]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
- elsif t_o=~/^[`]{3}\s+table(?:~h)?\s+/
+ elsif t_o=~/^```[ ]+table(?:~h)?\s+/
m1,m2,hd=nil,nil,nil
h=case t_o
- when /^[`]{3}\s+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
+ when /^```[ ]+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
m1,tbl,hd=$1,$2,true
- when /^[`]{3}\s+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
+ when /^```[ ]+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
m1,tbl,hd=$1,$2,false
else nil
end
@@ -539,10 +546,10 @@ 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_id[:table] }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: "table end #{@num_table}" }
+ h={ obj: "table end #{@num_id[:table]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
elsif t_o=~/^\{table(?:~h)?\s+/
@@ -562,10 +569,10 @@ 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_id[:table] }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: "table end #{@num_table}" }
+ h={ obj: "table end #{@num_id[:table]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
end
@@ -576,19 +583,19 @@ module SiSU_AO_DocumentStructureExtract
if (@@flag[:table]==:curls \
and t_o =~/^\}table/) \
or (@@flag[:table]==:tics \
- and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:table]=:off
headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx]
@h={ head_: headings, cols: columns, widths: widths, idx: idx, obj: @rows }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(@h)
tuned_file << t_o
@h,@rows=nil,''
- h={ obj: "table end #{@num_table}" }
+ h={ obj: "table end #{@num_id[:table]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
else
if t_o.is_a?(String) \
- and t_o !~/^(?:table\{|[`]{3}\s+table)/
+ and t_o !~/^(?:table\{|```[ ]+table)/
t_o=t_o.gsub(/^\n+/m,''). #check added for ruby 1.9.2 not needed in 1.8 series (tested in v2)
gsub(/\n+/m,"#{Mx[:tc_p]}")
@rows += t_o + Mx[:tc_c]
@@ -598,15 +605,16 @@ module SiSU_AO_DocumentStructureExtract
end
if @@flag[:code]==:curls or @@flag[:code]==:tics
if (@@flag[:code]==:curls and t_o =~/^\}code/) \
- or (@@flag[:code]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:code]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:code]=:off
+ @tuned_code[-1].gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'')
obj=@tuned_code.join("\n")
tags=[]
- h={ obj: obj, tags: tags, num: @num_code_block, number_: @codeblock_numbered }
+ h={ obj: obj, tags: tags, num: @num_id[:code_block], number_: @codeblock_numbered }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.code(h)
@tuned_code=[]
tuned_file << t_o
- h={ obj: "code block end #{@num_code_block}" }
+ h={ obj: "code block end #{@num_id[:code_block]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
end
if (@@flag[:code]==:curls or @@flag[:code]==:tics) \
@@ -623,39 +631,39 @@ module SiSU_AO_DocumentStructureExtract
or (@@flag[:block]==:curls or @@flag[:block]==:tics) \
or (@@flag[:alt]==:curls or @@flag[:alt]==:tics)
if (@@flag[:poem]==:curls and t_o =~/^\}poem/) \
- or (@@flag[:poem]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:poem]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:poem]=:off
- h={ obj: "poem end #{@num_poem}" }
+ h={ obj: "poem end #{@num_id[:poem]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:group]==:curls and t_o =~/^\}group/) \
- or (@@flag[:group]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:group]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:group]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags, num: @num_group }
+ h={ obj: obj, tags: tags, num: @num_id[:group] }
@tuned_block=[]
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.group(h)
tuned_file << t_o
- h={ obj: "group text end #{@num_group}" }
+ h={ obj: "group text end #{@num_id[:group]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:block]==:curls and t_o =~/^\}block/) \
- or (@@flag[:block]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:block]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:block]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags, num: @num_block }
+ h={ obj: obj, tags: tags, num: @num_id[:block] }
@tuned_block=[]
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.block(h)
tuned_file << t_o
- h={ obj: "block text end #{@num_block}" }
+ h={ obj: "block text end #{@num_id[:block]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:alt]==:curls and t_o =~/^\}alt/) \
- or (@@flag[:alt]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:alt]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:alt]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags, num: @num_alt }
+ h={ obj: obj, tags: tags, num: @num_id[:alt] }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.alt(h)
@tuned_block=[]
tuned_file << t_o
- h={ obj: "alt text end #{@num_alt}" }
+ h={ obj: "alt text end #{@num_id[:alt]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
end
if (@@flag[:poem]==:curls or @@flag[:poem]==:tics \
@@ -663,7 +671,7 @@ module SiSU_AO_DocumentStructureExtract
or @@flag[:alt]==:curls or @@flag[:alt]==:tics) \
and t_o =~/\S/ \
and t_o !~/^(?:\}(?:verse|code|alt|group|block)|(?:verse|code|alt|group|block)\{)/ \
- and t_o !~/^[`]{3}\s+(?:code|poem|alt|group|block)|^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic
+ and t_o !~/^```[ ]+(?:code|poem|alt|group|block)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic
sub_array=t_o.dup
@line_mode=sub_array.scan(/.+/)
type=if @@flag[:poem]==:curls or @@flag[:poem]==:tics
@@ -672,7 +680,7 @@ module SiSU_AO_DocumentStructureExtract
poem.each do |v|
v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n")
obj,tags=extract_tags(v)
- h={ obj: obj, tags: tags, num: @num_poem }
+ h={ obj: obj, tags: tags, num: @num_id[:poem] }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.verse(h)
tuned_file << t_o
end
@@ -751,7 +759,7 @@ module SiSU_AO_DocumentStructureExtract
lines.each do |line|
line=if line =~/\S/ \
and line !~/^(?:code\{|\}code)/ \
- and line !~/^(?:[`]{3}\s+code|[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$)/ \
+ and line !~/^(?:```[ ]+code|```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$)/ \
and not line.is_a?(Hash) #watch
@@counter+=1 if @@flag[:code]==:curls or @@flag[:code]==:tics
line=line.gsub(/\s\s/,"#{Mx[:nbsp]*2}").
@@ -1231,7 +1239,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,24 +1263,18 @@ 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=[]
hs=[0,false,false,false]
- t={ lv: @s[0], status: 'open' }
+ t={ lv: @s[0], status: :open }
tuned_file << tags(t)
if @md.opt.act[:verbose_plus][:set]==:on
puts "\nXML sisu structure outline --->\n"
@@ -1349,7 +1351,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
tuned_file=tuned_file.flatten
end
def tags(o)
- tag=(o[:status]=='open') \
+ tag=(o[:status]==:open) \
? %{<#{o[:lv]} id="#{o[:node]}">}
: "</#{o[:lv]}>"
ln=case o[:lv]
@@ -1368,7 +1370,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
SiSU_AO_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments
end
def tag_open(o,tag)
- t={ lv: tag[o.ln], node: o.node, status: 'open' }
+ t={ lv: tag[o.ln], node: o.node, status: :open }
t_o=tags(t)
t_o
end
@@ -1377,166 +1379,166 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
case hs[0]
when 0
if (lev <= 0) and hs[0]
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 1
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 2
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 3
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 4
if (lev <= 4)
- t={ lv: @s[4], status: 'close' }
+ t={ lv: @s[4], status: :close }
ary << tags(t)
end
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 5
if (lev <= 5)
- t={ lv: @s[5], status: 'close' }
+ t={ lv: @s[5], status: :close }
ary << tags(t)
end
if (lev <= 4)
- t={ lv: @s[4], status: 'close' }
+ t={ lv: @s[4], status: :close }
ary << tags(t)
end
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 6
if (lev <= 6)
- t={ lv: @s[6], status: 'close' }
+ t={ lv: @s[6], status: :close }
ary << tags(t)
end
if (lev <= 5)
- t={ lv: @s[5], status: 'close' }
+ t={ lv: @s[5], status: :close }
ary << tags(t)
end
if (lev <= 4)
- t={ lv: @s[4], status: 'close' }
+ t={ lv: @s[4], status: :close }
ary << tags(t)
end
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
end
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