aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--data/doc/sisu/CHANGELOG_v613
-rw-r--r--lib/sisu/develop/ao.rb1
-rw-r--r--lib/sisu/develop/html_segments.rb2
-rw-r--r--lib/sisu/develop/xhtml.rb12
-rw-r--r--lib/sisu/develop/xhtml_epub2.rb448
-rw-r--r--lib/sisu/develop/xhtml_epub2_segments.rb2
-rw-r--r--lib/sisu/develop/xml_dom.rb12
-rw-r--r--lib/sisu/develop/xml_odf_odt.rb1
-rw-r--r--lib/sisu/develop/xml_sax.rb12
9 files changed, 260 insertions, 243 deletions
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 9e1a1afa..5f7fd012 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -67,16 +67,15 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.4.0.orig.tar.xz
* ao, rearrange, introduce new file
- * txt outputs, reorganize, introduce new files
+ * reorganize, introduce new file(s)
+ * txt outputs
+ * html segments
+ * epub
+ * xmls
+ * address related garbage collection issue
* orgmode, add orgmode structure output to txts
- * html, segments, reorganize, introduce new file
-
- * epub, reorganize, introduce new file
-
- * xmls, reorganize, introduce new file
-
* cgi, search form, html ref, remove leading 'o' ocn, bugfix
in html (on use of html5), removed leading 'o' before ocn, not
reflected in generated cgi, sample search form, so, does not
diff --git a/lib/sisu/develop/ao.rb b/lib/sisu/develop/ao.rb
index 585192b0..747c987e 100644
--- a/lib/sisu/develop/ao.rb
+++ b/lib/sisu/develop/ao.rb
@@ -119,6 +119,7 @@ module SiSU_AO
__LINE__.to_s + ':' + __FILE__
end
ensure
+ SiSU_AO_Persist::Persist.new.persist_init
SiSU_AO::Instantiate.new
end
end
diff --git a/lib/sisu/develop/html_segments.rb b/lib/sisu/develop/html_segments.rb
index d6a76de6..65bd2d64 100644
--- a/lib/sisu/develop/html_segments.rb
+++ b/lib/sisu/develop/html_segments.rb
@@ -199,7 +199,6 @@ module SiSU_HTML_Seg
def songsheet
begin
@minitoc=SiSU_HTML::Source::Toc.new(@md,@data).minitoc
- SiSU_HTML_Persist::Persist.new.persist_init
@per=SiSU_HTML_Persist::Persist.new
data=get_subtoc_endnotes(@data,@per)
data=articles(data,@per)
@@ -210,6 +209,7 @@ module SiSU_HTML_Seg
__LINE__.to_s + ':' + __FILE__
end
ensure
+ SiSU_HTML_Persist::Persist.new.persist_init
@@seg_name=@per.seg_name=[]
end
end
diff --git a/lib/sisu/develop/xhtml.rb b/lib/sisu/develop/xhtml.rb
index 9e06d7b2..d24a568e 100644
--- a/lib/sisu/develop/xhtml.rb
+++ b/lib/sisu/develop/xhtml.rb
@@ -153,10 +153,14 @@ module SiSU_XHTML
@per=SiSU_XML_Persist::Persist.new
end
def songsheet
- pre
- @data=markup(@ao_array)
- post
- publish
+ begin
+ pre
+ @data=markup(@ao_array)
+ post
+ publish
+ ensure
+ SiSU_XML_Persist::Persist.new.persist_init
+ end
end
protected
def embedded_endnotes(dob='')
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
diff --git a/lib/sisu/develop/xhtml_epub2_segments.rb b/lib/sisu/develop/xhtml_epub2_segments.rb
index b3ce33b0..436cf845 100644
--- a/lib/sisu/develop/xhtml_epub2_segments.rb
+++ b/lib/sisu/develop/xhtml_epub2_segments.rb
@@ -164,7 +164,6 @@ WOK
end
def songsheet
begin
- SiSU_XHTML_EPUB2_Persist::Persist.new.persist_init
data=get_subtoc_endnotes(@data,@per)
data=articles(data,@per)
SiSU_XHTML_EPUB2_Seg::Seg.new.cleanup(@md,@per) # (((( added ))))
@@ -174,6 +173,7 @@ WOK
__LINE__.to_s + ':' + __FILE__
end
ensure
+ SiSU_XHTML_EPUB2_Persist::Persist.new.persist_init
@@seg_name=@per.seg_name=[]
end
end
diff --git a/lib/sisu/develop/xml_dom.rb b/lib/sisu/develop/xml_dom.rb
index b3d3adde..199faed5 100644
--- a/lib/sisu/develop/xml_dom.rb
+++ b/lib/sisu/develop/xml_dom.rb
@@ -167,10 +167,14 @@ module SiSU_XML_DOM
@per=SiSU_XML_Persist::Persist.new
end
def songsheet
- pre
- @data=markup(@ao_arr)
- post
- publish
+ begin
+ pre
+ @data=markup(@ao_arr)
+ post
+ publish
+ ensure
+ SiSU_XML_Persist::Persist.new.persist_init
+ end
end
protected
def xml_markup(dob='')
diff --git a/lib/sisu/develop/xml_odf_odt.rb b/lib/sisu/develop/xml_odf_odt.rb
index 16a77e7a..85a85ddd 100644
--- a/lib/sisu/develop/xml_odf_odt.rb
+++ b/lib/sisu/develop/xml_odf_odt.rb
@@ -145,6 +145,7 @@ module SiSU_XML_ODF_ODT
@data=markup(@ao_array)
publish
ensure
+ SiSU_XML_Persist::Persist.new.persist_init
unless (@md.opt.act[:verbose_plus][:set]==:on \
|| @md.opt.act[:maintenance][:set]==:on)
if @env.processing_path.odt =~/od[ft]/
diff --git a/lib/sisu/develop/xml_sax.rb b/lib/sisu/develop/xml_sax.rb
index 81e2423d..8d552f92 100644
--- a/lib/sisu/develop/xml_sax.rb
+++ b/lib/sisu/develop/xml_sax.rb
@@ -168,10 +168,14 @@ module SiSU_XML_SAX
@per=SiSU_XML_Persist::Persist.new
end
def songsheet
- pre
- @data=markup(@ao_arr)
- post
- publish
+ begin
+ pre
+ @data=markup(@ao_arr)
+ post
+ publish
+ ensure
+ SiSU_XML_Persist::Persist.new.persist_init
+ end
end
protected
def embedded_endnotes(dob='')