\n
}
md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc
md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc
md_opf_a_guide << @epub.metadata_opf.guide_sisu_toc
@ncxo=[nil,false,false,false,false,false,false]
@dob_toc2,@dob_toc3=nil,nil
@ncx_cls=[]
@level_a_first_occurrence=true
@data.each do |dob|
if dob.is=='heading' \
or dob.is=='heading_insert'
dob_toc=dob.dup
toc=case dob_toc.ln
when 1
@s_a_no +=1
name_s_a='section_a' + @s_a_no.to_s
@nav_no+=1
@nav_no2=@nav_no
@@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]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1]
@ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4]=true,false,false,false
@epub.sections(dob_toc,name_s_a)
@@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_a) if dob_toc
if @level_a_first_occurrence
@nav_no+=1
@@toc[:ncx] << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc
@level_a_first_occurrence=false
end
md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_a)
md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_a)
md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_a)
Toc.new(@md,dob_toc).level_1
when 2
@s_b_no +=1
name_s_b='section_b' + @s_b_no.to_s
@nav_no+=1
@nav_no2=@nav_no
@@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[2],@ncxo[3],@ncxo[4]=true,false,false
@epub.sections(dob_toc,name_s_b)
@@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_b) if dob_toc
md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_b)
md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_b)
md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_b)
Toc.new(@md,dob_toc).level_2
when 3
@s_c_no +=1
name_s_c='section_c' + @s_c_no.to_s
@nav_no+=1
@nav_no3=@nav_no
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
@ncxo[3],@ncxo[4]=true,false
@epub.sections(dob_toc,name_s_c)
@@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_c) if dob_toc
md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_c)
md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_c)
md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_c)
Toc.new(@md,dob_toc).level_3
when 4
@ncx_cls=[]
@nav_no+=1
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
@ncxo[4]=true
@@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no) if dob_toc
md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc)
md_opf_a_spine << @epub.metadata_opf.spine(dob_toc)
md_opf_a_guide << @epub.metadata_opf.guide(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