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/html_format.rb | 91 +++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 51 deletions(-) (limited to 'lib/sisu/v3dv/html_format.rb') diff --git a/lib/sisu/v3dv/html_format.rb b/lib/sisu/v3dv/html_format.rb index d8b44760..56360455 100644 --- a/lib/sisu/v3dv/html_format.rb +++ b/lib/sisu/v3dv/html_format.rb @@ -62,27 +62,22 @@ module SiSU_HTML_Format def initialize(md,ocn) @md,@ocn=md,ocn.to_s @ocn ||='' - vz=SiSU_Env::GetInit.instance.skin - @skin_no_ocn=if defined? vz.ocn_display_off \ - and vz.ocn_display_off==true - true - else false - end end def ocn_display - if @md.markup.inspect =~/no_ocn/ \ - or @md.opt.mod.inspect =~/--no-ocn/ \ - or @skin_no_ocn + @make=SiSU_Env::ProcessingSettings.new(@md) + if @make.build.ocn? + ocn_class='ocn' + if @ocn.to_i==0 + @ocn.gsub(/^(\d+|)$/, + %{}) + else + @ocn.gsub(/^(\d+|)$/, + %{}) + end + else ocn_class='ocn_off' @ocn.gsub(/^(\d+|)$/, %{}) - elsif @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{}) - else - ocn_class='ocn' - @ocn.gsub(/^(\d+|)$/, - %{}) end end def name @@ -109,7 +104,7 @@ module SiSU_HTML_Format @metalink='#metadata' @tocband_scroll,@tocband_segtoc=nil,nil @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet - @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure + @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure @index='index' @toc="#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}" end @@ -206,7 +201,8 @@ module SiSU_HTML_Format @cf_defaults=SiSU_Env::InfoProcessingFlag.new @env=SiSU_Env::InfoEnv.new(md.fns) @file=SiSU_Env::FileOp.new(md) - @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure + @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure + @make=SiSU_Env::ProcessingSettings.new(@md) end def home %{ @@ -234,11 +230,15 @@ module SiSU_HTML_Format } end def search - env=SiSU_Env::InfoEnv.new(@md.fns,@md) - env.widget.search_form('sisusearch',nil,nil,true) + if @make.build.html_search_form? + env=SiSU_Env::InfoEnv.new(@md.fns,@md) + env.widget.search_form('sisusearch',nil,nil,true) + else '' + end end def manifest - if not @o_str.dump_or_redirect? + if @make.build.links_to_manifest? \ + and not @o_str.dump_or_redirect? manifest_lnk=if @file.output_dir_structure.by_language_code? \ or @file.output_dir_structure.by_filetype? "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}" @@ -321,28 +321,30 @@ module SiSU_HTML_Format def initialize(md) super(md) @md=md - @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure + @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure + @make=SiSU_Env::ProcessingSettings.new(@md) end def scroll_head_navigation_band - pdf=if @md.programs[:pdf] - < - #{make_seg_scroll_pdf} + #{make_scroll_search_form_and_manifest_link} WOK - else '' - end - %{ + %{
#{pdf} +#{search_and_manifest}
#{@vz.banner_band} -   #{@vz.table_close}

} + else '' + end end def concordance_navigation_band(type='') - %{ + if @make.build.html_top_band? + %{
@@ -352,6 +354,8 @@ WOK   #{@vz.table_close}

} + else '' + end end def seg_head_navigation_band(type='') firstseg=%{ @@ -367,25 +371,6 @@ WOK

#{@vz.banner_band}  #{firstseg}  #{@vz.table_close} -

} - end - def seg_head_navigation_band_bottom(type='') #retired 2.7.9 - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{ - #{png_nav.nxt} - } if @md.firstseg =~/\S+/ - %{ - - -
-   - - #{@tocband_segtoc} - -  #{firstseg}  -#{@vz.table_close}

} end def manifest_link(text) @@ -404,7 +389,7 @@ WOK else '' end end - def make_seg_scroll_pdf + def make_scroll_search_form_and_manifest_link wgt=SiSU_HTML_Format::Widget.new(@md) scroll=%{

#{@vz.nav_txt_doc_link} @@ -992,6 +977,7 @@ WOK end @p_num=ParagraphNumber.new(@md,@ocn) @vz=SiSU_Env::GetInit.instance.skin + @make=SiSU_Env::ProcessingSettings.new(@md) end def nametags_scroll(dob) tags='' @@ -1134,8 +1120,11 @@ WOK heading_normal('h6','norm') end def title_heading(tag,attrib) + cl=(@make.build.html_minitoc?) \ + ? 'content' + : 'content0' %{ -
+
<#{tag} class="#{attrib}"> #{@named}#{@txt} -- cgit v1.2.3