aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/develop/xhtml_epub2.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/develop/xhtml_epub2.rb')
-rw-r--r--lib/sisu/develop/xhtml_epub2.rb448
1 files changed, 226 insertions, 222 deletions
diff --git a/lib/sisu/develop/xhtml_epub2.rb b/lib/sisu/develop/xhtml_epub2.rb
index b595b00d..0c4e6245 100644
--- a/lib/sisu/develop/xhtml_epub2.rb
+++ b/lib/sisu/develop/xhtml_epub2.rb
@@ -212,235 +212,239 @@ module SiSU_XHTML_EPUB2
@per=SiSU_XHTML_EPUB2_Persist::PersistTOC.new
end
def songsheet #extracts toc for scroll & seg
- if (@md.opt.act[:verbose][:set]==:on \
- || @md.opt.act[:verbose_plus][:set]==:on \
- || @md.opt.act[:maintenance][:set]==:on)
- SiSU_Screen::Ansi.new(
- @md.opt.act[:color_state][:set],
- 'Toc'
- ).txt_grey
- end
- toc=nil
- @@firstseg=nil
- SiSU_XHTML_EPUB2_Persist::PersistTOC.new.persist_init
- md_opf_a_content,md_opf_a_spine,md_opf_a_guide=[],[],[]
- @nav_no=0
- @s_a_no,@s_b_no,@s_c_no,@s_d_no,@lv5_no,@lv6_no=0,0,0,0,0,0
- @per.ncx << @epub.toc_ncx.open #epub ncx navmap
- @per.ncx << @epub.toc_ncx.head_open << @epub.toc_ncx.head << @epub.toc_ncx.head_close
- @per.ncx << @epub.toc_ncx.doc_title << @epub.toc_ncx.doc_author
- @per.ncx << @epub.toc_ncx.navmap_open
- @per.opf << @epub.metadata_opf.package_open
- @per.opf << @epub.metadata_opf.metadata
- @per.opf << @epub.metadata_opf.manifest_open
- @per.seg << %{<div class="content">\n<div class="substance">}
- @per.scr << %{<div class="content">\n<div class="substance">}
- if defined? @md.make.cover_image \
- and @md.make.cover_image.is_a?(Hash) \
- and @md.make.cover_image[:cover] =~/\S+/
- md_opf_a_content << @epub.metadata_opf.manifest_cover_image_information(@md)
- md_opf_a_spine << @epub.metadata_opf.spine_cover_image
- md_opf_a_guide << @epub.metadata_opf.guide_cover_image
- end
- md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc
- if @make.build.toc?
- md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc
- md_opf_a_guide << @epub.metadata_opf.guide_sisu_toc
- end
- @ncxo=[false,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 \
- || dob.is==:heading_insert
- dob_toc=dob.dup
- toc=case dob_toc.ln
- when 0
- @s_a_no +=1
- lv_name='section_a' + @s_a_no.to_s
- @nav_no+=1
- @nav_no2=@nav_no
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[2]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[1]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[0]
- @ncxo[0],@ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
- true, false, false, false, false, false, false, false
- @epub.sections(dob_toc,lv_name)
- if @level_a_first_occurrence \
- && @make.build.toc?
- @per.ncx << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc
+ begin
+ if (@md.opt.act[:verbose][:set]==:on \
+ || @md.opt.act[:verbose_plus][:set]==:on \
+ || @md.opt.act[:maintenance][:set]==:on)
+ SiSU_Screen::Ansi.new(
+ @md.opt.act[:color_state][:set],
+ 'Toc'
+ ).txt_grey
+ end
+ toc=nil
+ @@firstseg=nil
+ SiSU_XHTML_EPUB2_Persist::PersistTOC.new.persist_init
+ md_opf_a_content,md_opf_a_spine,md_opf_a_guide=[],[],[]
+ @nav_no=0
+ @s_a_no,@s_b_no,@s_c_no,@s_d_no,@lv5_no,@lv6_no=0,0,0,0,0,0
+ @per.ncx << @epub.toc_ncx.open #epub ncx navmap
+ @per.ncx << @epub.toc_ncx.head_open << @epub.toc_ncx.head << @epub.toc_ncx.head_close
+ @per.ncx << @epub.toc_ncx.doc_title << @epub.toc_ncx.doc_author
+ @per.ncx << @epub.toc_ncx.navmap_open
+ @per.opf << @epub.metadata_opf.package_open
+ @per.opf << @epub.metadata_opf.metadata
+ @per.opf << @epub.metadata_opf.manifest_open
+ @per.seg << %{<div class="content">\n<div class="substance">}
+ @per.scr << %{<div class="content">\n<div class="substance">}
+ if defined? @md.make.cover_image \
+ and @md.make.cover_image.is_a?(Hash) \
+ and @md.make.cover_image[:cover] =~/\S+/
+ md_opf_a_content << @epub.metadata_opf.manifest_cover_image_information(@md)
+ md_opf_a_spine << @epub.metadata_opf.spine_cover_image
+ md_opf_a_guide << @epub.metadata_opf.guide_cover_image
+ end
+ md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc
+ if @make.build.toc?
+ md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc
+ md_opf_a_guide << @epub.metadata_opf.guide_sisu_toc
+ end
+ @ncxo=[false,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 \
+ || dob.is==:heading_insert
+ dob_toc=dob.dup
+ toc=case dob_toc.ln
+ when 0
+ @s_a_no +=1
+ lv_name='section_a' + @s_a_no.to_s
+ @nav_no+=1
+ @nav_no2=@nav_no
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[3]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[2]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[1]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[0]
+ @ncxo[0],@ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
+ true, false, false, false, false, false, false, false
+ @epub.sections(dob_toc,lv_name)
+ if @level_a_first_occurrence \
+ && @make.build.toc?
+ @per.ncx << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc
+ @nav_no+=1
+ @level_a_first_occurrence=false
+ end
+ @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_0
+ when 1
+ @s_b_no +=1
+ lv_name='section_b' + @s_b_no.to_s
+ @nav_no+=1
+ @nav_no2=@nav_no
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[3]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[2]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[1]
+ @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
+ true, false, false, false, false, false, false
+ @epub.sections(dob_toc,lv_name)
+ @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_1
+ when 2
+ @s_c_no +=1
+ lv_name='section_c' + @s_c_no.to_s
+ @nav_no+=1
+ @nav_no2=@nav_no
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[3]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[2]
+ @ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
+ true, false, false, false, false, false
+ @epub.sections(dob_toc,lv_name)
+ @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_2
+ when 3
+ @s_d_no +=1
+ lv_name='section_d' + @s_d_no.to_s
+ @nav_no+=1
+ @nav_no3=@nav_no
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[3]
+ @ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
+ true, false, false, false, false
+ @epub.sections(dob_toc,lv_name)
+ @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_3
+ when 4
+ @ncx_cls=[]
+ lv_name=dob_toc.name
@nav_no+=1
- @level_a_first_occurrence=false
+ @dob_name=dob.name
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
+ @ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
+ true, false, false, false
+ @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_4
+ when 5
+ @ncx_cls=[]
+ hashtag='#o' + dob_toc.ocn.to_s
+ lv_name=@dob_name
+ @nav_no+=1
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
+ @ncxo[5],@ncxo[6],@ncxo[7]=
+ true, false, false
+ @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag)
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_5
+ when 6
+ @ncx_cls=[]
+ hashtag='#o' + dob_toc.ocn.to_s
+ lv_name=@dob_name
+ @nav_no+=1
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
+ @ncxo[6],@ncxo[7]=
+ true, false
+ @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag)
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_6
+ when 7
+ @ncx_cls=[]
+ hashtag='#o' + dob_toc.ocn.to_s
+ lv_name=@dob_name
+ @nav_no+=1
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
+ @ncxo[7]=true
+ @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc
+ md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag)
+ md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag)
+ md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag)
+ SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_7
+ else nil
end
- @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
- md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
- md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
- md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
- SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_0
- when 1
- @s_b_no +=1
- lv_name='section_b' + @s_b_no.to_s
- @nav_no+=1
- @nav_no2=@nav_no
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[2]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[1]
- @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
- true, false, false, false, false, false, false
- @epub.sections(dob_toc,lv_name)
- @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
- md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
- md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
- md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
- SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_1
- when 2
- @s_c_no +=1
- lv_name='section_c' + @s_c_no.to_s
- @nav_no+=1
- @nav_no2=@nav_no
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[2]
- @ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
- true, false, false, false, false, false
- @epub.sections(dob_toc,lv_name)
- @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
- md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
- md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
- md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
- SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_2
- when 3
- @s_d_no +=1
- lv_name='section_d' + @s_d_no.to_s
- @nav_no+=1
- @nav_no3=@nav_no
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
- true, false, false, false, false
- @epub.sections(dob_toc,lv_name)
- @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
- md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
- md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
- md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
- SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_3
- when 4
- @ncx_cls=[]
- lv_name=dob_toc.name
- @nav_no+=1
- @dob_name=dob.name
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
- true, false, false, false
- @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc
- md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name)
- md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name)
- md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name)
- SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_4
- when 5
- @ncx_cls=[]
- hashtag='#o' + dob_toc.ocn.to_s
- lv_name=@dob_name
- @nav_no+=1
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @ncxo[5],@ncxo[6],@ncxo[7]=
- true, false, false
- @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc
- md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag)
- md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag)
- md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag)
- SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_5
- when 6
- @ncx_cls=[]
- hashtag='#o' + dob_toc.ocn.to_s
- lv_name=@dob_name
- @nav_no+=1
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @ncxo[6],@ncxo[7]=
- true, false
- @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc
- md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag)
- md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag)
- md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag)
- SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_6
- when 7
- @ncx_cls=[]
- hashtag='#o' + dob_toc.ocn.to_s
- lv_name=@dob_name
- @nav_no+=1
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[7]
- @ncxo[7]=true
- @per.ncx << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc
- md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag)
- md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag)
- md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag)
- SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_7
- 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
- @per.seg << toc[:seg]
- @per.scr << toc[:seg]
- rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
- __LINE__.to_s + ':' + __FILE__
+ 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
+ @per.seg << toc[:seg]
+ @per.scr << toc[:seg]
+ rescue
+ SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
+ __LINE__.to_s + ':' + __FILE__
+ end
end
end
end
end
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[3]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[2]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[1]
+ @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[0]
+ @ncxo[0],@ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=false,false,false,false,false,false,false
+ md_opf_a_content << @epub.metadata_opf.manifest_images(@md.ec[:image])
+ @per.seg << "</div>\n</div>"
+ @per.scr << "</div>\n</div>"
+ @per.ncx << @epub.toc_ncx.navmap_close
+ @per.ncx << @epub.toc_ncx.close
+ @per.opf << md_opf_a_content << @epub.metadata_opf.manifest_close
+ @per.opf << @epub.metadata_opf.spine_open << md_opf_a_spine << @epub.metadata_opf.spine_close
+ @per.opf << @epub.metadata_opf.guide_open << md_opf_a_guide << @epub.metadata_opf.guide_close
+ @per.opf << @epub.metadata_opf.package_close
+ @per.opf=@per.opf.flatten
+ SiSU_XHTML_EPUB2::Source::Output.new(@md,@per.opf).epub_metadata_opf
+ SiSU_XHTML_EPUB2::Source::Output.new(@md,@per.ncx).epub_toc_ncx
+ @md.firstseg=@@firstseg
+ @per
+ ensure
+ SiSU_XHTML_EPUB2_Persist::Persist.new.persist_init
end
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[2]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[1]
- @per.ncx << @epub.toc_ncx.navpoint_close if @ncxo[0]
- @ncxo[0],@ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=false,false,false,false,false,false,false
- md_opf_a_content << @epub.metadata_opf.manifest_images(@md.ec[:image])
- @per.seg << "</div>\n</div>"
- @per.scr << "</div>\n</div>"
- @per.ncx << @epub.toc_ncx.navmap_close
- @per.ncx << @epub.toc_ncx.close
- @per.opf << md_opf_a_content << @epub.metadata_opf.manifest_close
- @per.opf << @epub.metadata_opf.spine_open << md_opf_a_spine << @epub.metadata_opf.spine_close
- @per.opf << @epub.metadata_opf.guide_open << md_opf_a_guide << @epub.metadata_opf.guide_close
- @per.opf << @epub.metadata_opf.package_close
- @per.opf=@per.opf.flatten
- SiSU_XHTML_EPUB2::Source::Output.new(@md,@per.opf).epub_metadata_opf
- SiSU_XHTML_EPUB2::Source::Output.new(@md,@per.ncx).epub_toc_ncx
- @md.firstseg=@@firstseg
- @per
end
protected
def level_0