aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/ao_doc_str.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-07-01 01:00:30 -0400
committerRalph Amissah <ralph@amissah.com>2014-07-01 01:00:30 -0400
commitf3832f0acc5b335fc820287ce2530435ad651202 (patch)
treeecd2004aecd2b706316291a98645ed98a5a25a75 /lib/sisu/v5/ao_doc_str.rb
parentdebian/changelog (5.4.2-1) (diff)
parentv5 v6: sysenv, developer _CONSTRUCTION_ZONE warning setup modified (diff)
Merge tag 'sisu_5.4.3' into debian/sid
SiSU 5.4.3
Diffstat (limited to 'lib/sisu/v5/ao_doc_str.rb')
-rw-r--r--lib/sisu/v5/ao_doc_str.rb824
1 files changed, 660 insertions, 164 deletions
diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb
index 4708a126..931e51d3 100644
--- a/lib/sisu/v5/ao_doc_str.rb
+++ b/lib/sisu/v5/ao_doc_str.rb
@@ -65,10 +65,13 @@ module SiSU_AO_DocumentStructureExtract
@@flag={
ocn: :on,
code: :off,
+ lngsyn: :txt,
poem: :off,
block: :off,
+ box: :off,
group: :off,
alt: :off,
+ quote: :off,
table: :off,
table_to: :off,
}
@@ -81,10 +84,13 @@ module SiSU_AO_DocumentStructureExtract
@@flag={
ocn: :on,
code: :off,
+ lngsyn: :txt,
poem: :off,
block: :off,
+ box: :off,
group: :off,
alt: :off,
+ quote: :off,
table: :off,
table_to: :off,
}
@@ -119,6 +125,11 @@ module SiSU_AO_DocumentStructureExtract
? true
: false
end
+ def quotes?
+ @@flag[:quote]==:open \
+ ? true
+ : false
+ end
def hang_and_indent_test(str)
hang_indent=if str=~/^_([1-9])[^_]/
[$1,$1]
@@ -143,12 +154,18 @@ module SiSU_AO_DocumentStructureExtract
[0,0]
end
obj=if str2 =~/^(.+?)\s+\\\\(?:\s+|\n)/
- str2.gsub(/^(.+?)(\s+\\\\(?:\s+|\n))/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
+ str2.gsub(/^(.+?)(\s+\\\\(?:\s+|\n))/,
+ "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2")
else
- str2.gsub(/^(.+?)\n/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\n")
+ str2.gsub(/^(.+?)\n/,
+ "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\n")
end
hang,indent=hang_indent[0],hang_indent[1]
- [hang,indent,obj]
+ [
+ hang,
+ indent,
+ obj,
+ ]
end
def endnote_test?(str)
(str=~/~\{.+?\}~|~\[.+?\]~/) \
@@ -171,7 +188,10 @@ module SiSU_AO_DocumentStructureExtract
t.gsub!(/[^a-z0-9._-]/,'')
end
end
- [str,tags]
+ [
+ str,
+ tags,
+ ]
end
def rgx_idx_ocn_seg
@rgx_idx_ocn_seg=/(.+?)\s*[+](\d+)/
@@ -180,14 +200,19 @@ module SiSU_AO_DocumentStructureExtract
idx_array_raw=idxraw.scan(/[^;]+/)
idx_hash,idx_array,idx_lst={},[],[]
idx_array_raw.each do |idx|
+ idx=idx.strip
idx_lst=case idx
when /\S+?\s*:/
idx_couplet_tmp=[]
idx_couplet=idx.scan(/\s*[^:]+\s*/)
if idx_couplet[1] =~/[|]/
- idx_couplet_tmp << idx_couplet[0] << idx_couplet[1].scan(/\s*[^|]+\s*/)
+ idx_couplet_tmp <<
+ idx_couplet[0] <<
+ idx_couplet[1].scan(/\s*[^|]+\s*/)
else
- idx_couplet_tmp << idx_couplet[0] << [idx_couplet[1]]
+ idx_couplet_tmp <<
+ idx_couplet[0] <<
+ [idx_couplet[1]]
end
idx_couplet=idx_couplet_tmp
else [idx]
@@ -196,14 +221,17 @@ module SiSU_AO_DocumentStructureExtract
idx_lst.each do |term_node|
case term_node
when String
- term_node=term_node[0].chr.capitalize + term_node[1,term_node.length]
+ term_node=
+ term_node[0].chr.capitalize +
+ term_node[1,term_node.length]
term_node=(term_node =~/.+?[+]\d+/) \
? term_node
: (term_node + '+0')
term_nodes << term_node
use,plus=rgx_idx_ocn_seg.match(term_node)[1,2]
@use=use.strip
- idx_hash[@use]={ sub: [], plus: plus } unless idx_hash[@use] and defined? idx_hash[@use]
+ idx_hash[@use]=
+ { sub: [], plus: plus } unless idx_hash[@use] and defined? idx_hash[@use]
when Array
subterm_nodes=[]
term_node.each do |subterm_node|
@@ -212,15 +240,20 @@ module SiSU_AO_DocumentStructureExtract
: (subterm_node + '+0')
subterm_nodes << subterm_node
sub,sub_plus=rgx_idx_ocn_seg.match(subterm_node)[1,2]
- idx_hash[@use]={ sub: [], plus: 0 } unless idx_hash[@use] and defined? idx_hash[@use]
- idx_hash[@use][:sub] << {sub.strip => { plus: sub_plus }}
+ idx_hash[@use]=
+ { sub: [], plus: 0 } unless idx_hash[@use] and defined? idx_hash[@use]
+ idx_hash[@use][:sub] <<
+ { sub.strip => { plus: sub_plus } }
end
term_nodes << subterm_nodes
end
end
idx_array << term_nodes
end
- { hash: idx_hash, array: idx_array }
+ {
+ hash: idx_hash,
+ array: idx_array,
+ }
end
def identify_parts
tuned_file=[]
@@ -229,8 +262,10 @@ module SiSU_AO_DocumentStructureExtract
@num_id={
code_block: 0,
poem: 0,
+ box: 0,
group: 0,
alt: 0,
+ quote: 0,
table: 0,
}
@metadata={}
@@ -239,35 +274,46 @@ module SiSU_AO_DocumentStructureExtract
h=case $1
when /[+]/
@@flag[:ocn]=:on
- {flag: :ocn_on}
+ {
+ flag: :ocn_on,
+ }
when /[~]/
@@flag[:ocn]=:ocn_off_headings_keep
- {flag: :ocn_off, mod: :headings_keep}
+ {
+ flag: :ocn_off,
+ mod: :headings_keep,
+ }
when /[-]/ #of particular relevance with level 1~ which is required to precede substantive text & used e.g. in html segmented text
@@flag[:ocn]=:ocn_off_headings_dummy_lev1
- {flag: :ocn_off, mod: :headings_exclude}
+ {
+ flag: :ocn_off,
+ mod: :headings_exclude,
+ }
else
@@flag[:ocn]=:on
- {flag: :ocn_on}
+ {
+ flag: :ocn_on,
+ }
end
t_o=SiSU_AO_DocumentStructure::ObjectFlag.new.flag_ocn(h)
next
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 !~/^```[ ]+(?:code|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ \
+ if t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \
+ and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$|^`:quote_(?:open|close)`/ \
and @@flag[:code]==:off \
and @@flag[:poem]==:off \
and @@flag[:group]==:off \
and @@flag[:block]==:off \
and @@flag[:alt]==:off \
+ and @@flag[:box]==:off \
and @@flag[:table]==:off
unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
- idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1
- m=m.split(/\n/).join(' ').
+ idx=if t_o=~/^=\{\s*(.+)\s*\}\s*$\Z/m; m=$1
+ m=m.split(/[ ]*\n/).join(' ').
gsub(/\s+([|:;])\s+/,'\1').
gsub(/\s+([+]\d+)\s+/,'\1')
- t_o=t_o.gsub(/\n=\{.+\}\s*$\Z/m,'')
+ t_o=t_o.gsub(/\n=\{.+?\}\s*$/m,'')
idx_array_and_hash=construct_idx_array_and_hash(m)
idx_array_and_hash[:hash]
else nil
@@ -282,7 +328,7 @@ module SiSU_AO_DocumentStructureExtract
t_o=nil
when /^%+\s/ #comment
t_o=if t_o=~/^%+\s+(.+)/
- h={obj: $1}
+ h={ obj: $1 }
SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
else nil
end
@@ -305,7 +351,13 @@ module SiSU_AO_DocumentStructureExtract
end
end
end
- h={ lv: lv, ln: ln, obj: obj, idx: idx, tags: tags }
+ h={
+ lv: lv,
+ ln: ln,
+ obj: obj,
+ idx: idx,
+ tags: tags,
+ }
SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
elsif t_o=~/^:?[A-D1-6]\~(\S+?)-\s+(.+)/m
name,obj=$1,$2
@@ -323,7 +375,14 @@ module SiSU_AO_DocumentStructureExtract
end
end
end
- h={ lv: lv, name: name, obj: obj, idx: idx, autonum_: false, tags: tags}
+ h={
+ lv: lv,
+ name: name,
+ obj: obj,
+ idx: idx,
+ autonum_: false,
+ tags: tags,
+ }
SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
elsif t_o=~/^:?[A-D1-6]\~(\S+)\s+(.+)/m
name,obj=$1,$2
@@ -341,7 +400,13 @@ module SiSU_AO_DocumentStructureExtract
end
end
end
- h={ lv: lv, name: name, obj: obj, idx: idx, tags: tags }
+ h={
+ lv: lv,
+ name: name,
+ obj: obj,
+ idx: idx,
+ tags: tags,
+ }
SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
else nil
end
@@ -364,7 +429,17 @@ module SiSU_AO_DocumentStructureExtract
obj << ' ~#'
end
end
- h={ bullet_: bullet, hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
+ h={
+ bullet_: bullet,
+ hang: hang,
+ indent: indent,
+ obj: obj,
+ idx: idx,
+ note_: note,
+ image_: image,
+ tags: tags,
+ quote: quotes?,
+ }
SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
else nil
@@ -387,7 +462,16 @@ module SiSU_AO_DocumentStructureExtract
obj << ' ~#'
end
end
- h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
+ h={
+ hang: hang,
+ indent: indent,
+ obj: obj,
+ idx: idx,
+ note_: note,
+ image_: image,
+ tags: tags,
+ quote: quotes?,
+ }
SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
else nil
@@ -411,22 +495,52 @@ module SiSU_AO_DocumentStructureExtract
end
end
unless obj=~/\A\s*\Z/m
- h={ bullet_: false, indent: 0, hang: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
- SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
+ h={
+ bullet_: false,
+ indent: 0,
+ hang: 0,
+ obj: obj,
+ idx: idx,
+ note_: note,
+ image_: image,
+ tags: tags,
+ quote: quotes?,
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
+ t_o=SiSU_AO_DocumentStructureExtract::Structure.new(@md).structure_markup(t_o) #must happen earlier, node info etc. require
end
elsif @@flag[:code]==:off
- if t_o =~/^(?:code\{|```[ ]+code)/
+ if t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?)/
@@flag[:code]=case t_o
- when /^code\{/ then :curls
- when /^```[ ]+code/ then :tics
- else @@flag[:code] #error
+ when /^code(?:\.[a-z][0-9a-z_]+)?\{/ then :curls
+ when /^```[ ]+code/ then :tics
+ else @@flag[:code] #error
+ end
+ @@flag[:lngsyn]=if t_o =~/^(?:code\.[a-z][0-9a-z_]+\{|```[ ]+code\.[a-z_]+)/
+ case t_o
+ when /^code\.([a-z][0-9a-z_]+)\{/
+ :"#{$1}"
+ when /^```[ ]+code\.([a-z][0-9a-z_]+)/
+ :"#{$1}"
+ else :txt
+ end
+ else :txt
end
@@counter=1
- @codeblock_numbered=(t_o =~/^(?:code\{#|```[ ]+code\s[#])/) ? true : false
+ @codeblock_numbered=
+ (t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{#|```[ ]+code(?:\.[a-z][0-9a-z_]+)?\s[#])/) \
+ ? true
+ : false
@num_id[:code_block] +=1
- h={ obj: "group text start #{@num_id[:code_block]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :code,
+ obj: '',
+ sym: :code_block_open,
+ num: @num_id[:code_block],
+ syntax: @@flag[:lngsyn],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
elsif t_o =~/^(?:poem\{|```[ ]+poem)/
@@flag[:poem]=case t_o
when /^poem\{/ then :curls
@@ -434,44 +548,95 @@ module SiSU_AO_DocumentStructureExtract
else @@flag[:poem] #error
end
@num_id[:poem] +=1
- h={ obj: "poem start #{@num_id[:poem]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :poem,
+ obj: '',
+ sym: :poem_open,
+ num: @num_id[:poem],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ tuned_file << t_o
+ elsif t_o =~/^(?:box(?:\.[a-z_]+)?\{|```[ ]+box(?:\.[a-z_]+)?)/
+ @@flag[:box]=case t_o
+ when /^box\{/ then :curls
+ when /^```[ ]+box/ then :tics
+ else @@flag[:box] #error
+ end
+ @num_id[:box] +=1
+ h={
+ is_for: :box,
+ obj: '',
+ sym: :box_open,
+ num: @num_id[:box],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
tuned_file << t_o
elsif t_o =~/^(?:group\{|```[ ]+group)/
@@flag[:group]=case t_o
when /^group\{/ then :curls
when /^```[ ]+group/ then :tics
- else @@flag[:group] #error
+ else @@flag[:group] #error
end
@num_id[:group] +=1
- h={ obj: "group text start #{@num_id[:group]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :group,
+ obj: '',
+ sym: :group_open,
+ num: @num_id[:group],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
tuned_file << t_o
elsif t_o =~/^(?:block\{|```[ ]+block)/
@@flag[:block]=case t_o
when /^block\{/ then :curls
when /^```[ ]+block/ then :tics
- else @@flag[:block] #error
+ else @@flag[:block] #error
end
@num_id[:block] +=1
- h={ obj: "block text start #{@num_id[:block]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :block,
+ obj: '',
+ sym: :block_open,
+ num: @num_id[:block],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
tuned_file << t_o
elsif t_o =~/^(?:alt\{|```[ ]+alt)/
@@flag[:alt]=case t_o
when /^alt\{/ then :curls
when /^```[ ]+alt/ then :tics
- else @@flag[:alt] #error
+ else @@flag[:alt] #error
end
@num_id[:alt] +=1
- h={ obj: "alt text start #{@num_id[:alt]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :alt,
+ obj: '',
+ sym: :alt_open,
+ num: @num_id[:alt],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
tuned_file << t_o
+ elsif t_o =~/^`:quote_open`/
+ @@flag[:quote]=:open
+ @num_id[:quote] +=1
+ h={
+ is_for: :quote,
+ obj: '',
+ sym: :quote_open,
+ num: @num_id[:quote],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ #tuned_file << t_o #% find second source, entered twice, should be once so closed off here
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
+ h={
+ is_for: :table,
+ obj: '',
+ sym: :table_open,
+ num: @num_id[:table],
+ }
+ ins_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ tuned_file << ins_o
if t_o=~/^table\{(?:~h)?\s+/
@@flag[:table]=:curls
@rows=''
@@ -485,7 +650,12 @@ module SiSU_AO_DocumentStructureExtract
col=$2.scan(/\d+/)
heading=false
end
- @h={ head_: heading, cols: cols, widths: col, idx: idx }
+ @h={
+ head_: heading,
+ cols: cols,
+ widths: col,
+ idx: idx,
+ }
elsif t_o=~/^```[ ]+table(?:~h)?\s+c\d+/
@@flag[:table]=:tics
@rows=''
@@ -499,7 +669,12 @@ module SiSU_AO_DocumentStructureExtract
col=$2.scan(/\d+/)
heading=false
end
- @h={ head_: heading, cols: cols, widths: col, idx: idx }
+ @h={
+ head_: heading,
+ cols: cols,
+ widths: col,
+ idx: idx,
+ }
elsif t_o=~/^\{table(?:~h)?(?:\s+\d+;?)?\}\n.+\Z/m
m1,m2,hd=nil,nil,nil
tbl=/^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1]
@@ -510,7 +685,7 @@ module SiSU_AO_DocumentStructureExtract
cols=nil
rws.each do |r|
cols=(cols ? cols : (r.scan('|').length) +1)
- r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
+ r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
rows += r + Mx[:tc_c]
end
col=[]
@@ -523,18 +698,31 @@ 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_id[: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_id[:table]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :table,
+ obj: '',
+ sym: :table_close,
+ num: @num_id[:table],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
t_o
elsif t_o=~/^```[ ]+table(?:~h)?\s+/
m1,m2,hd=nil,nil,nil
h=case t_o
- when /^```[ ]+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 /^```[ ]+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
@@ -543,14 +731,27 @@ module SiSU_AO_DocumentStructureExtract
rws=tbl.split(/\n/)
rows=''
rws.each do |r|
- r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
+ 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_id[: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_id[:table]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :table,
+ obj: '',
+ sym: :table_close,
+ num: @num_id[:table],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
t_o
elsif t_o=~/^\{table(?:~h)?\s+/
m1,m2,hd=nil,nil,nil
@@ -566,14 +767,27 @@ module SiSU_AO_DocumentStructureExtract
rws=tbl.split(/\n/)
rows=''
rws.each do |r|
- r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
+ 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_id[: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_id[:table]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :table,
+ obj: '',
+ sym: :table_close,
+ num: @num_id[:table],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
t_o
end
end
@@ -586,17 +800,28 @@ module SiSU_AO_DocumentStructureExtract
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 }
+ @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_id[:table]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :table,
+ obj: '',
+ sym: :table_close,
+ num: @num_id[:table],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
t_o
else
if t_o.is_a?(String) \
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)
+ t_o=t_o.gsub(/^\n+/m,'').
gsub(/\n+/m,"#{Mx[:tc_p]}")
@rows += t_o + Mx[:tc_c]
end
@@ -610,12 +835,24 @@ module SiSU_AO_DocumentStructureExtract
@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_id[:code_block], number_: @codeblock_numbered }
+ h={
+ obj: obj,
+ syntax: @@flag[:lngsyn],
+ tags: tags,
+ num: @num_id[:code_block],
+ number_: @codeblock_numbered,
+ }
+ @@flag[:lngsyn]=:txt
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.code(h)
@tuned_code=[]
tuned_file << t_o
- h={ obj: "code block end #{@num_id[:code_block]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :code,
+ obj: '',
+ sym: :code_close,
+ num: @num_id[:code_block],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
end
if (@@flag[:code]==:curls or @@flag[:code]==:tics) \
and t_o.is_a?(String)
@@ -627,51 +864,125 @@ module SiSU_AO_DocumentStructureExtract
t_o=nil
end
elsif (@@flag[:poem]==:curls or @@flag[:poem]==:tics) \
+ or (@@flag[:box]==:curls or @@flag[:box]==:tics) \
or (@@flag[:group]==:curls or @@flag[:group]==:tics) \
or (@@flag[:block]==:curls or @@flag[:block]==:tics) \
- or (@@flag[:alt]==:curls or @@flag[:alt]==:tics)
+ or (@@flag[:alt]==:curls or @@flag[:alt]==:tics) \
+ or (@@flag[:quote]==:open and t_o =~/`:quote_close`/m) #not
if (@@flag[:poem]==:curls and t_o =~/^\}poem/) \
or (@@flag[:poem]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:poem]=:off
- h={ obj: "poem end #{@num_id[:poem]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :poem,
+ obj: '',
+ sym: :poem_close,
+ num: @num_id[:poem],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ elsif (@@flag[:box]==:curls and t_o =~/^\}box/) \
+ or (@@flag[:box]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ @@flag[:box]=:off
+ obj,tags=extract_tags(@tuned_block.join("\n"))
+ h={
+ obj: obj,
+ tags: tags,
+ num: @num_id[:box],
+ }
+ @tuned_block=[]
+ t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.box(h)
+ tuned_file << t_o
+ h={
+ is_for: :box,
+ obj: '',
+ sym: :box_close,
+ num: @num_id[:box],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
elsif (@@flag[:group]==:curls and t_o =~/^\}group/) \
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_id[: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_id[:group]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :group,
+ obj: '',
+ sym: :group_close,
+ num: @num_id[:group],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
elsif (@@flag[:block]==:curls and t_o =~/^\}block/) \
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_id[: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_id[:block]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :block,
+ obj: '',
+ sym: :block_close,
+ num: @num_id[:block],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
elsif (@@flag[:alt]==:curls and t_o =~/^\}alt/) \
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_id[: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_id[:alt]}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={
+ is_for: :alt,
+ obj: '',
+ sym: :alt_close,
+ num: @num_id[:alt],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ elsif @@flag[:quote]==:open and t_o =~/`:quote_close`/m
+ @@flag[:quote]=:off
+ h={
+ is_for: :quote,
+ obj: '',
+ sym: :quote_close,
+ num: @num_id[:quote],
+ }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ elsif @@flag[:quote]==:open
+ t_o,tags=extract_tags(t_o)
+ h={
+ indent: 1,
+ obj: t_o,
+ idx: idx,
+ note_: note,
+ image_: image,
+ tags: tags,
+ quote: quotes?,
+ }
+ SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
if (@@flag[:poem]==:curls or @@flag[:poem]==:tics \
or @@flag[:group]==:curls or @@flag[:group]==:tics \
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 !~/^```[ ]+(?:code|poem|alt|group|block)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic
+ and t_o !~/^(?:\}(?:verse|code|box|alt|group|block)|(?:verse|code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|alt|group|block)\{)/ \
+ and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|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
@@ -680,7 +991,11 @@ 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_id[:poem] }
+ h={
+ obj: obj,
+ tags: tags,
+ num: @num_id[:poem],
+ }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.verse(h)
tuned_file << t_o
end
@@ -692,8 +1007,10 @@ module SiSU_AO_DocumentStructureExtract
end
if @@flag[:code]==:off
if @@flag[:poem]==:curls or @@flag[:poem]==:tics \
+ or @@flag[:box]==:curls or @@flag[:box]==:tics \
or @@flag[:group]==:curls or @@flag[:group]==:tics \
- or @@flag[:alt]==:curls or @@flag[:alt]==:tics
+ or @@flag[:alt]==:curls or @@flag[:alt]==:tics \
+ or (@@flag[:quote]==:open and t_o =~/`:quote_close`/m)
if t_o.is_a?(String)
t_o=t_o.gsub(/\n/m,"#{Mx[:br_nl]}").
gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}").
@@ -702,6 +1019,7 @@ module SiSU_AO_DocumentStructureExtract
elsif t_o.is==:group \
|| t_o.is==:block \
|| t_o.is==:alt \
+ || t_o.is==:box \
|| t_o.is==:verse
t_o.obj=t_o.obj.gsub(/\n/m,"#{Mx[:br_nl]}").
gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}").
@@ -715,26 +1033,67 @@ module SiSU_AO_DocumentStructureExtract
end
if @md.flag_endnotes
tuned_file << @pb
- h={ ln: 1, lc: 1, obj: 'Endnotes', autonum_: false }
+ h={
+ ln: 1,
+ lc: 1,
+ obj: 'Endnotes',
+ autonum_: false,
+ }
tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
- h={ ln: 4, lc: 2, obj: 'Endnotes', name: 'endnotes', autonum_: false }
+ h={
+ ln: 4,
+ lc: 2,
+ obj: 'Endnotes',
+ name: 'endnotes',
+ autonum_: false,
+ }
tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
- h={ obj: 'Endnotes' }
+ h={
+ obj: 'Endnotes'
+ }
end
if @md.book_idx
tuned_file << @pb
- h={ ln: 1, lc: 1, obj: 'Index', autonum_: false }
+ h={
+ ln: 1,
+ lc: 1,
+ obj: 'Index',
+ autonum_: false,
+ }
tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
- h={ ln: 4, lc: 2, obj: 'Index', name: 'book_index', autonum_: false }
+ h={
+ ln: 4,
+ lc: 2,
+ obj: 'Index',
+ name: 'book_index',
+ autonum_: false,
+ }
tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
- h={ obj: 'Index' }
+ h={
+ obj: 'Index'
+ }
end
tuned_file << @pb
- h={ ln: 1, lc: 1, obj: 'Metadata', autonum_: false, ocn_: false }
+ h={
+ ln: 1,
+ lc: 1,
+ obj: 'Metadata',
+ autonum_: false,
+ ocn_: false,
+ }
tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
- h={ ln: 4, lc: 2, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false }
+ h={
+ ln: 4,
+ lc: 2,
+ obj: 'SiSU Metadata, document information',
+ name: 'metadata',
+ autonum_: false,
+ ocn_: false,
+ }
tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
- h={ obj: 'eof' }
+ h={
+ obj: 'eof',
+ }
meta=SiSU_AO_DocumentStructure::ObjectMetadata.new.metadata(@metadata)
[tuned_file,meta]
end
@@ -747,19 +1106,28 @@ module SiSU_AO_DocumentStructureExtract
table
end
def meta_heading(h)
- h={ lv: h[:lv], ln: h[:ln], name: h[:name], obj: h[:obj], ocn: '0' }
+ h={
+ lv: h[:lv],
+ ln: h[:ln],
+ name: h[:name],
+ obj: h[:obj],
+ ocn: '0',
+ }
SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h)
end
def meta_para(str)
- h={ obj: str, ocn_: false }
+ h={
+ obj: str,
+ ocn_: false,
+ }
SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
def build_lines(type=:none)
lines,lines_new=@data,[]
lines.each do |line|
line=if line =~/\S/ \
- and line !~/^(?:code\{|\}code)/ \
- and line !~/^(?:```[ ]+code|```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$)/ \
+ and line !~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|\}code)/ \
+ and line !~/^(?:```[ ]+code(?:\.[a-z][0-9a-z_]+)?|```(?:\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}").
@@ -767,7 +1135,7 @@ module SiSU_AO_DocumentStructureExtract
line=line.gsub(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type==:code # REMOVE try sort for texpdf special case
line=if line =~/(?:https?|file|ftp):\/\/\S+$/
line.gsub(/\s*$/," #{Mx[:br_nl]}")
- else line.gsub(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code'
+ else line.gsub(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code'
end
elsif line =~/^\s*$/
line.gsub(/\s*$/,"#{Mx[:br_nl]}")
@@ -779,45 +1147,74 @@ module SiSU_AO_DocumentStructureExtract
end
end
class Structure # this must happen early
- def initialize(md,dob)
- @md,@dob=md,dob
+ def initialize(md)
+ @md=md
end
- def structure
- structure_markup
- @dob
+ def structure(data)
+ data.compact.each do |dob|
+ structure_markup(dob)
+ end
end
- def structure_markup #build structure where structure provided only in meta header
- @dob=if @dob.is==:para \
- && (((@dob.hang !~/[1-9]/) && (@dob.indent !~/[1-9]/)) \
- || (@dob.hang != @dob.indent)) \
- and not @dob.bullet_
- @dob=case @dob.obj
+ def structure_markup(dob) #build structure where structure provided only in meta header
+ dob=if dob.is==:para \
+ && (((dob.hang !~/[1-9]/) && (dob.indent !~/[1-9]/)) \
+ || (dob.hang != dob.indent)) \
+ and not dob.bullet_
+ dob=case dob.obj
when /^#{@md.lv0}/
- h={ lv: 'A', ln: 0 }
- SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ h={
+ is: :heading,
+ lv: 'A',
+ ln: 0,
+ }
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)
when /^#{@md.lv1}/
- h={ lv: 'B', ln: 1 }
- SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ h={
+ is: :heading,
+ lv: 'B',
+ ln: 1,
+ }
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)
when /^#{@md.lv2}/
- h={ lv: 'C', ln: 2 }
- SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ h={
+ is: :heading,
+ lv: 'C',
+ ln: 2,
+ }
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)
when /^#{@md.lv3}/
- h={ lv: 'D', ln: 3 }
- SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ h={
+ is: :heading,
+ lv: 'D',
+ ln: 3,
+ }
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)
when /^#{@md.lv4}/
- h={ lv: '1', ln: 4 }
- SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ h={
+ is: :heading,
+ lv: '1',
+ ln: 4,
+ }
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)
when /^#{@md.lv5}/
- h={ lv: '2', ln: 5 }
- SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
+ h={
+ is: :heading,
+ lv: '2',
+ ln: 5,
+ }
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)
when /^#{@md.lv6}/
- h={ lv: '3', ln: 6 }
- SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob)
- else @dob
+ h={
+ is: :heading,
+ lv: '3',
+ ln: 6,
+ }
+ SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)
+ else dob
end
- else @dob
+ else dob
end
- @dob
+ dob
end
end
class OCN
@@ -1190,6 +1587,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
ocnc+=1
ocn_sp,parent="c#{ocnc}",node
elsif dob.is==:group \
+ || dob.is==:box \
|| dob.is==:block \
|| dob.is==:alt \
|| dob.is==:verse
@@ -1204,7 +1602,8 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
end
if dob.is==:heading
if ocn_flag==true
- dob.ln,dob.node,dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent,dob.lc=ln,node,ocn,ocn_flag,ocn_dv,ocn_sp,parent,collapsed_level
+ dob.ln,dob.node,dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent,dob.lc=
+ ln, node, ocn, ocn_flag, ocn_dv,ocn_sp, parent, collapsed_level
else
ocnu+=1
heading_use=:ok
@@ -1215,19 +1614,22 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_dummy_heading]}/,'')
heading_use=:dummy
end
- dob.ln,dob.node,dob.ocn,dob.ocn_,dob.use_,dob.odv,dob.osp,dob.parent,dob.lc=ln,node,nil,ocn_flag,heading_use,ocn_dv,ocn_sp,parent,collapsed_level
+ dob.ln,dob.node,dob.ocn,dob.ocn_,dob.use_, dob.odv,dob.osp,dob.parent,dob.lc=
+ ln, node, nil, ocn_flag,heading_use,ocn_dv, ocn_sp, parent, collapsed_level
end
else
if dob.of !=:meta \
&& dob.of !=:comment \
&& dob.of !=:layout
if ocn_flag == true
- dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent=ocn,ocn_flag,ocn_dv,ocn_sp,parent
+ dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent=
+ ocn, ocn_flag,ocn_dv, ocn_sp, parent
else
ocnu+=1
dob.obj=dob.obj.gsub(/#{Mx[:fa_o]}[~-]##{Mx[:fa_c]}/,'') if dob.obj
ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}"
- dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent=nil,ocn_flag,ocn_dv,ocn_sp,parent
+ dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent=
+ nil, ocn_flag,ocn_dv, ocn_sp, parent
end
end
end
@@ -1237,6 +1639,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
if dob.is==:code \
|| dob.is==:verse \
|| dob.is==:alt \
+ || dob.is==:box \
|| dob.is==:group \
|| dob.is==:block
dob.obj=dob.obj.gsub(/\n+/,"\n") #newlines taken out
@@ -1274,7 +1677,10 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
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"
@@ -1366,7 +1772,13 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
when '5' then 8
when '6' then 9
end
- h={ tag: tag, node: o[:node], lv: o[:lv], ln: ln, status: o[:status] }
+ h={
+ tag: tag,
+ node: o[:node],
+ lv: o[:lv],
+ ln: ln,
+ status: o[:status],
+ }
SiSU_AO_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments
end
def tag_open(o,tag)
@@ -1379,121 +1791,205 @@ 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