\n}
@@seg[:main] << dob_html
@@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc
else
@@seg[:main] << dob_html #unless @@flag_alt==true
end
end
end
def tail
format_head_seg=SiSU_HTML_Format::Head_seg.new(@md)
if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn]
@@seg[:tail] << %{\n
\n
\n}
if @@seg_endnotes[@@get_hash_fn].flatten.length > 0
@@seg[:tail] << format_head_seg.endnote_mark
@@seg[:tail] << @@seg_endnotes[@@get_hash_fn].flatten #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES|
end
@@seg[:tail] << '
'
@@seg[:tail] << '
' #this div closes div class content
end
ads=SiSU_HTML_promo::Ad.new(@md)
@@seg[:credits] << format_head_seg.credit << ads.div.close << ads.display << format_head_seg.html_close
end
def reinitialise
@@seg[:title],@@seg[:dot_nav],@@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:headings],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(8){[]}
@@segtocband=nil
end
def cleanup
reinitialise
@@seg_total,@@tracker=0,0
@@seg_endnotes,@@seg_subtoc={},{}
@@seg_endnotes_array,@@seg_subtoc_array=[],[]
@@seg[:endnote_all]=[]
end
def get_subtoc_endnotes(data) #get endnotes & sub-table of contents subtoc
data.each do |dob|
dob.obj.gsub!(/
(.+?)<\/a>/mi,'\1')
if @md.flag_auto_endnotes
if (dob.is=='heading' or dob.is=='heading_insert') \
and dob.ln.to_s =~/^[1234]/ \
and not @@fn.to_s.empty?
@@seg_endnotes[@@fn]=[]
@@seg_endnotes[@@fn] << @@seg_endnotes_array
@@seg_endnotes_array=[] if dob.ln==4
@@fns_previous=@md.fns if dob.ln==4 and dob.name =~/^meta/
end
if (dob.is=='heading' or dob.is=='heading_insert') \
and dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs
@@seg_subtoc[@@fn]=@@seg_subtoc_array
@@seg_subtoc_array=[]
if dob.name \
and dob.obj
@@fn=dob.name
else
if dob.name =~/\S+/
@@fn=dob.name
else @@fn=''
end
end
end
end
if dob.is=='heading' \
and dob.ln.to_s =~/^[56]/
case dob.ln
when 5
txt_obj={:txt =>dob.obj.strip,:ocn =>dob.ocn}
format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
subtoc=format_seg.subtoc_lev5 #keep and make available, this is the subtoc
when 6
txt_obj={:txt =>dob.obj.strip,:ocn =>dob.ocn}
format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
subtoc=format_seg.subtoc_lev6 #keep and make available, this is the subtoc
end
@@seg_subtoc_array << subtoc
end
if @md.flag_auto_endnotes
if dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ /)
try.each do |e|
txt_obj={:txt =>e}
format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/
format_seg.endnote_body_indent
else format_seg.endnote_body
end
@@seg_endnotes_array << note_match
end
try.join('
')
#% creation of separate end segment/page of all endnotes referenced back to reference segment
m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(#-[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi
endnote_part_a=note_match_seg[m,1]
endnote_part_b=note_match_seg[m,2]
txt_obj={:endnote_part_a =>endnote_part_a,:endnote_part_b =>endnote_part_b}
format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj)
note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408
@@seg[:endnote_all] << note_match_all_seg
end
dob.obj.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
end
end
end
end
end
end
__END__