diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-08-08 00:34:25 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-08-08 00:36:15 -0400 |
commit | 6bc3b814011e829db684ec96bb3abd1e4abb29c3 (patch) | |
tree | 72d759c1d89a72c4fc5e3c46f6917f69e72699e6 /lib/sisu/v5/xhtml_epub2.rb | |
parent | v5: merged v6 libraries (diff) |
v5 v6: extend document structure, headings A - D, 1 - 4
* sql db table structure changed (needs to be rebuilt)
Diffstat (limited to 'lib/sisu/v5/xhtml_epub2.rb')
-rw-r--r-- | lib/sisu/v5/xhtml_epub2.rb | 61 |
1 files changed, 54 insertions, 7 deletions
diff --git a/lib/sisu/v5/xhtml_epub2.rb b/lib/sisu/v5/xhtml_epub2.rb index 25d1b955..ae83214e 100644 --- a/lib/sisu/v5/xhtml_epub2.rb +++ b/lib/sisu/v5/xhtml_epub2.rb @@ -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| @@ -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='') |