\n
}
md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc
md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc
@ncxo=[nil,false,false,false,false,false,false]
@dob_toc2,@dob_toc3=nil,nil
@ncx_cls=[]
@data.each do |dob|
if dob.is=='heading' \
or dob.is=='heading_insert'
dob_toc=dob.dup
toc=case dob_toc.ln
when 1
Toc.new(@md,dob_toc).level_1
when 2
@nav_no+=1
@nav_no2=@nav_no
@ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[4]
@ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[3]
@ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[2]
@ncxo[2],@ncxo[3],@ncxo[4]=false,false,false
@dob_toc2=dob_toc
@ncxo[2]=true
Toc.new(@md,dob_toc).level_2
when 3
@nav_no+=1
@nav_no3=@nav_no
@ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[4]
@ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[3]
@ncxo[3],@ncxo[4]=false,false
@dob_toc3=dob_toc
@ncxo[3]=true
Toc.new(@md,dob_toc).level_3
when 4
@@toc[:ncx] << @ncx_cls if @ncx_cls.length > 0
@ncx_cls=[]
@@toc[:ncx] << @epub.toc_ncx.navpoint_top3(@dob_toc2,@nav_no2,dob_toc.name) if @dob_toc2 #epub ncx navmap
@@toc[:ncx] << @epub.toc_ncx.navpoint_top3(@dob_toc3,@nav_no3,dob_toc.name) if @dob_toc3 #epub ncx navmap
@dob_toc2,@dob_toc3=nil,nil
@nav_no+=1
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
@ncxo[4]=false
@@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no) if dob_toc #epub ncx navmap
@ncxo[4]=true
md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc)
md_opf_a_spine << @epub.metadata_opf.spine(dob_toc)
Toc.new(@md,dob_toc).level_4
when 5; Toc.new(@md,dob_toc).level_5
when 6; Toc.new(@md,dob_toc).level_6
else nil
end
toc.each do |k,d|
d.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
end if toc
if @@firstseg.nil? \
and dob.ln==4 \
and dob.name =~/\S+/
@@firstseg=dob.name
end
if toc
begin
@@toc[:seg] << toc[:seg]
@@toc[:scr] << toc[:seg]
@@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini]
rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error
end
end
end
end
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2]
@ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4]=false,false,false,false
md_opf_a_content << @epub.metadata_opf.manifest_images(@md.ec[:image])
@@toc[:seg] << "
\n