From 756caa5d09492586824354864be6a5c9fe244005 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 12 Mar 2012 18:45:04 -0400 Subject: v3dv: start using output control hooks * for config file, document headers, & command line * v3dv: sysenv, ProcessingSettings, start to use hooks to make it possible to control (via: the command line; the document markup header, or; the configuration file) the likes of: ocn, toc, segsubtoc, minitoc, links-to-manifest, search-form, html-navigation, html-navigation-bar, html-right-pane, html-top-band; these are switched on by default and may be switched off in omit lists within configuration file, the document markup header, or command line. The command line takes precedence & may switch on or off overriding settings within the document markup header or the sisu configuration file. * --inc- on by default, but if switched off in doc header or configuration, the command line --inc- has precedence; for each possible exclude configuration the --inc- switch that overrides configuration settings * --exc- == --no-; exclude/switch off feature (but --inc- include has precedence) * document header @build: :omit: [list output features to be omitted] * configuration (sisurc.yml) omit: exclude output feature, overrides configuration settings (omit --dev development branch modifier once merged back to main) --exc-ocn, html (seg, scroll), epub, xml, pdf sisu --dev --exc-ocn --html --epub --xml-sax --xml-dom --xhtml -v \ filename.sst --exc-toc, html (scroll), epub, pdf sisu --dev --exc-toc --html --epub --pdf -v filename.sst --exc-segsubtoc html (seg), epub sisu --dev --exc-segsubtoc --html --epub -v filename.sst --exc-minitoc, html (seg), concordance, manifest sisu --dev --exc-minitoc --html --concordance -v filename.sst --exc-manifest-minitoc, manifest sisu --dev --exc-manifest-minitoc --html -v filename.sst --exc-links_to_manifest, --exc-manifest-links, html (seg, scroll) sisu --dev --exc-manifest-links --html -v filename.sst --exc-search-form, html (seg, scroll), manifest sisu --dev --exc-search-form --html -v filename.sst --exc-html-minitoc, html (seg), concordance sisu --dev --exc-html-minitoc --html --concordance -v filename.sst --exc-html-navigation, html (seg, scroll)? sisu --dev --exc-html-navigation --html -v filename.sst --exc-html-navigation-bar, html (seg) sisu --dev --exc-html-navigation-bar --html -v filename.sst --exc-html-search-form, html (seg, scroll) sisu --dev --exc-html-search-form --html -v filename.sst --exc-html-right-pane, html (seg, scroll) sisu --dev --exc-html-right-pane --html -v filename.sst --exc-html-top-band, html (seg, scroll), concordance (minitoc is forced on to provide seg navigation) sisu --dev --exc-html-top-band --html --concordance -v filename.sst --- lib/sisu/v3dv/epub.rb | 58 +++++++++++++++++++-------------------------------- 1 file changed, 22 insertions(+), 36 deletions(-) (limited to 'lib/sisu/v3dv/epub.rb') diff --git a/lib/sisu/v3dv/epub.rb b/lib/sisu/v3dv/epub.rb index 7d90883b..e9aeb4de 100644 --- a/lib/sisu/v3dv/epub.rb +++ b/lib/sisu/v3dv/epub.rb @@ -192,6 +192,7 @@ module SiSU_EPUB @vz=SiSU_Env::GetInit.instance.skin @epub=SiSU_EPUB_Format::HeadInformation.new(@md) @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md + @make=SiSU_Env::ProcessingSettings.new(@md) end def songsheet #extracts toc for scroll & seg SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/ @@ -211,8 +212,10 @@ module SiSU_EPUB @@toc[:seg] << %{
\n
} @@toc[:scr] << %{
\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 + 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=[nil,false,false,false,false,false,false] @dob_toc2,@dob_toc3=nil,nil @ncx_cls=[] @@ -234,7 +237,8 @@ module SiSU_EPUB @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 + if @level_a_first_occurrence \ + && @make.build.toc? @nav_no+=1 @@toc[:ncx] << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc @level_a_first_occurrence=false @@ -298,7 +302,6 @@ module SiSU_EPUB begin @@toc[:seg] << toc[:seg] @@toc[:scr] << toc[:seg] - @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini] rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error end end @@ -323,10 +326,6 @@ module SiSU_EPUB @md.firstseg=@@firstseg @@toc end - def minitoc - minitoc=@@toc[:seg_mini].join("\n") - '
' + minitoc + '
' - end protected def level_1 dob=@data @@ -348,14 +347,6 @@ module SiSU_EPUB format_toc.lev0 else format_toc.lev1 end - toc[:seg_mini]=if dob.name =~/^meta/ \ - and dob.obj =~/Document Information/ #check - x=if @md.concord_make - format_toc.mini_concord_tail - else format_toc.mini_tail - end - else format_toc.mini_lev1 - end title=if dob.ocn ==0 if dob.name =~/^meta/ \ and dob.obj =~/Document Information/ @@ -389,7 +380,6 @@ module SiSU_EPUB format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev2 - toc[:seg_mini]=format_toc.mini_lev2 if p_num title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } @@ -409,7 +399,6 @@ module SiSU_EPUB format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev3 - toc[:seg_mini]=format_toc.mini_lev3 if p_num title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } @@ -437,7 +426,6 @@ module SiSU_EPUB format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev4 - toc[:seg_mini]=format_toc.mini_lev4 title=%{#{p_num.goto}#{linkname}} if p_num txt_obj={ txt: title } format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) @@ -457,7 +445,6 @@ module SiSU_EPUB txt_obj={ txt: lnk_n_txt } format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:seg]=format_toc.lev5 - toc[:seg_mini]=format_toc.mini_lev5 title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) @@ -478,7 +465,6 @@ module SiSU_EPUB txt_obj={ txt: lnk_n_txt } format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:seg]=format_toc.lev6 - toc[:seg_mini]=format_toc.mini_lev6 title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) @@ -582,7 +568,8 @@ module SiSU_EPUB @md,@output=md,output @epub_doc="#{@md.fnb}.epub" @epub_header=SiSU_EPUB_Format::HeadInformation.new(@md) - @make=SiSU_Env::CreateFile.new(@md.fns) + @make=SiSU_Env::ProcessingSettings.new(@md) + @make_file=SiSU_Env::CreateFile.new(@md.fns) end def songsheet mimetype @@ -593,23 +580,23 @@ module SiSU_EPUB output_zip end def mimetype - out=@make.epub.mimetype + out=@make_file.epub.mimetype out<<@epub_header.mimetype out.close end def metainf_container #container.xml file in META-INF directory - out=@make.epub.metainf_cont + out=@make_file.epub.metainf_cont out<<@epub_header.metainf_container out.close end def css - out=@make.epub.xhtml_css + out=@make_file.epub.xhtml_css out << SiSU_EPUB_Format::CSS.new.css_epub_xhtml out.close end def epub_toc_ncx begin - out=@make.epub.toc_ncx + out=@make_file.epub.toc_ncx @output.each do |para| unless para =~/\A\s*\Z/ out.puts para @@ -621,7 +608,7 @@ module SiSU_EPUB end def epub_metadata_opf begin - out=@make.epub.metadata + out=@make_file.epub.metadata @output.each do |para| unless para =~/\A\s*\Z/ out.puts para @@ -663,17 +650,16 @@ module SiSU_EPUB end def segtoc begin - filename_html_segtoc=@make.epub.xhtml_segtoc - filename_html_index=@make.epub.xhtml_index - @output.each do |para| - para=para.strip - unless para =~/\A\s*\Z/ - filename_html_segtoc.puts para,"\n" - filename_html_index.puts para,"\n" + if @make.build.toc? + filename_html_index=@make_file.epub.xhtml_index + @output.each do |para| + para=para.strip + unless para =~/\A\s*\Z/ + filename_html_index.puts para,"\n" + end end + filename_html_index.close end - filename_html_segtoc.close - filename_html_index.close rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error end end -- cgit v1.2.3