aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/xhtml_epub2.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/xhtml_epub2.rb')
-rw-r--r--lib/sisu/v5/xhtml_epub2.rb75
1 files changed, 61 insertions, 14 deletions
diff --git a/lib/sisu/v5/xhtml_epub2.rb b/lib/sisu/v5/xhtml_epub2.rb
index 9b110497..ae83214e 100644
--- a/lib/sisu/v5/xhtml_epub2.rb
+++ b/lib/sisu/v5/xhtml_epub2.rb
@@ -135,7 +135,7 @@ module SiSU_XHTML_EPUB2
SiSU_XHTML_EPUB2::Source::Seg.new(@md,data).songsheet
SiSU_XHTML_EPUB2::Source::Output.new(@md).songsheet
rescue
- SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do
+ SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do
__LINE__.to_s + ':' + __FILE__
end
ensure
@@ -148,7 +148,7 @@ module SiSU_XHTML_EPUB2
end
end
end
- SiSU_Env::Clear.new(@opt.cmd,@opt.fns).param_instantiate
+ SiSU_Env::Clear.new(@opt.selections.str,@opt.fns).param_instantiate
@@flag,@@scr,@@seg,@@seg_endnotes,@@seg_subtoc,@@seg_ad={},{},{},{},{},{}
@@seg_total,@@tracker,@@loop_count,@@tablehead,@@number_of_cols=0,0,0,0,0
@@seg_name,@@seg_name_html,@@seg_subtoc_array,@@seg_endnotes_array,@@segtocband,@@tablefoot=Array.new(7){[]}
@@ -268,6 +268,7 @@ module SiSU_XHTML_EPUB2
lv_name='section_a' + @s_a_no.to_s
@nav_no+=1
@nav_no2=@nav_no
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[7]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
@@ -275,7 +276,8 @@ module SiSU_XHTML_EPUB2
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[0]
- @ncxo[0],@ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false,false,false,false
+ @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?
@@ -293,13 +295,15 @@ module SiSU_XHTML_EPUB2
lv_name='section_b' + @s_b_no.to_s
@nav_no+=1
@nav_no2=@nav_no
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[7]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
@@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],@ncxo[5],@ncxo[6]=true,false,false,false,false,false
+ @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)
@@toc[: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)
@@ -311,12 +315,14 @@ module SiSU_XHTML_EPUB2
lv_name='section_c' + @s_c_no.to_s
@nav_no+=1
@nav_no2=@nav_no
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[7]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
@@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],@ncxo[5],@ncxo[6]=true,false,false,false,false
+ @ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
+ true, false, false, false, false, false
@epub.sections(dob_toc,lv_name)
@@toc[: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)
@@ -328,11 +334,13 @@ module SiSU_XHTML_EPUB2
lv_name='section_d' + @s_d_no.to_s
@nav_no+=1
@nav_no3=@nav_no
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[7]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3]
- @ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false
+ @ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
+ true, false, false, false, false
@epub.sections(dob_toc,lv_name)
@@toc[: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)
@@ -344,10 +352,12 @@ module SiSU_XHTML_EPUB2
lv_name=dob_toc.name
@nav_no+=1
@dob_name=dob.name
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[7]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4]
- @ncxo[4],@ncxo[5],@ncxo[6]=true,false,false
+ @ncxo[4],@ncxo[5],@ncxo[6],@ncxo[7]=
+ true, false, false, false
@@toc[: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)
@@ -358,9 +368,11 @@ module SiSU_XHTML_EPUB2
hashtag='#o' + dob_toc.ocn.to_s
lv_name=@dob_name
@nav_no+=1
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[7]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5]
- @ncxo[5],@ncxo[6]=true,false
+ @ncxo[5],@ncxo[6],@ncxo[7]=
+ true, false, false
@@toc[: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)
@@ -371,13 +383,27 @@ module SiSU_XHTML_EPUB2
hashtag='#o' + dob_toc.ocn.to_s
lv_name=@dob_name
@nav_no+=1
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[7]
@@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6]
- @ncxo[6]=true
+ @ncxo[6],@ncxo[7]=
+ true, false
@@toc[: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
+ @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[7]
+ @ncxo[7]=true
+ @@toc[: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|
@@ -393,7 +419,7 @@ module SiSU_XHTML_EPUB2
@@toc[:seg] << toc[:seg]
@@toc[:scr] << toc[:seg]
rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
+ SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
__LINE__.to_s + ':' + __FILE__
end
end
@@ -594,6 +620,27 @@ module SiSU_XHTML_EPUB2
end
toc
end
+ def level_7
+ dob=@data
+ linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip
+ ocn=dob.ocn
+ toc={}
+ if ocn \
+ and ocn !~/#/
+ p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)
+ lnk_n_txt=%{ <a href="#{@@seg_url}#{Sfx[:epub_xhtml]}#o#{ocn}">
+ #{linkname}
+</a>}
+ txt_obj={ txt: lnk_n_txt }
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
+ toc[:seg]=format_toc.lev7
+ title=%{#{p_num.goto}#{linkname}</a>}
+ txt_obj={ txt: title }
+ format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj)
+ toc[:scr]=format_toc.lev7
+ end
+ toc
+ end
end
class ScrollHeadAndSegToc < Toc
def initialize(md='',toc='',links_guide_toc='')
@@ -726,7 +773,7 @@ module SiSU_XHTML_EPUB2
end
out.close
rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
+ SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
__LINE__.to_s + ':' + __FILE__
end
end
@@ -741,7 +788,7 @@ module SiSU_XHTML_EPUB2
end
out.close
rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
+ SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
__LINE__.to_s + ':' + __FILE__
end
end
@@ -818,7 +865,7 @@ WOK
filename_xhtml.close
end
rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
+ SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
__LINE__.to_s + ':' + __FILE__
end
end
@@ -836,7 +883,7 @@ WOK
filename_xhtml.close
end
rescue
- SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do
+ SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
__LINE__.to_s + ':' + __FILE__
end
end