From 4cdfa555d7e07d032bff270a962415b96c3b8741 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 12 Mar 2012 18:43:27 -0400 Subject: v3dv: sysenv, param, options, output control hooks code modified * for config file, document headers, & command line * requiring downstream code changes (in commit that follows) --- data/doc/sisu/CHANGELOG_v3 | 47 +++++ lib/sisu/v3dv/options.rb | 303 +++++++++++++++------------ lib/sisu/v3dv/param.rb | 82 +++++++- lib/sisu/v3dv/sysenv.rb | 503 ++++++++++++++++++++++++++++++--------------- 4 files changed, 644 insertions(+), 291 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 93213b05..2e7d3684 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,53 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.1.15.orig.tar.xz sisu_3.1.15-1.dsc sisu_3.1.15-1.debian.tar.gz +* 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 + * texinfo, fix (break holding back 3.2 merge) [proposed next version starts 3.2, (merge dev branch after 3.1.15)] diff --git a/lib/sisu/v3dv/options.rb b/lib/sisu/v3dv/options.rb index b2b7ff15..44eb1020 100644 --- a/lib/sisu/v3dv/options.rb +++ b/lib/sisu/v3dv/options.rb @@ -435,47 +435,47 @@ module SiSU_Commandline act={} act[:license]=(cmd =~/L/ \ || mod.inspect =~/"--license/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:site_init]=(cmd =~/C/ \ || mod.inspect =~/"--init-site/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:rc]=if mod.inspect =~/"--rc=/ x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'') - { bool: true, inst: x } + { bool: true, set: :on, inst: x } else - { bool: false, inst: '' } + { bool: false, set: :na, inst: '' } end act[:dump]=if mod.inspect =~/"--dump=/ base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, inst: base_pth } + { bool: true, set: :on, inst: base_pth } elsif mod.inspect =~/"--dump/ - { bool: true, inst: @base_path } + { bool: true, set: :on, inst: @base_path } else - { bool: false, inst: nil } + { bool: false, set: :na, inst: nil } end act[:redirect]=if mod.inspect =~/"--redirect=/ base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, inst: base_pth } + { bool: true, set: :on, inst: base_pth } elsif mod.inspect =~/"--redirect/ - { bool: true, inst: @base_path } + { bool: true, set: :on, inst: @base_path } else - { bool: false, inst: nil } + { bool: false, set: :na, inst: nil } end act[:verbose]=(cmd =~/v/ \ || mod.inspect =~/"--verbose"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:quiet]=(cmd =~/q/ \ || mod.inspect =~/"--quiet"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ - { bool: true } + { bool: true, set: :on } elsif mod.inspect =~/"--color-off"/ - { bool: false } - else { bool: true } #fix default color + { bool: false, set: :off } + else { bool: true, set: :na } #fix default color end # act[:color_toggle]=if cmd =~/c/ \ # or mod.inspect =~/"--color-toggle"/ @@ -484,202 +484,253 @@ module SiSU_Commandline # end act[:maintenance]=(cmd =~/M/ \ || mod.inspect =~/"--maintenance|--keep-processing-files"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:switch]=if mod.inspect =~/"--switch-off=/ off_list=mod.join(';').gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1') off_list=off_list.scan(/[^,;\s]+/) - { bool: false, off: off_list} - else { bool: true, off: [] } + { bool: false, set: :off, off: off_list} + else { bool: true, set: :na, off: [] } end - act[:ocn]=if mod.inspect =~/"--no-ocn"/ \ + act[:ocn]= + if mod.inspect =~/"--inc-ocn"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-ocn"/ \ || act[:switch][:off].inspect =~/"ocn"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:toc]=if mod.inspect =~/"--no-toc"/ \ + act[:toc]=if mod.inspect =~/"--inc-toc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-toc"/ \ || act[:switch][:off].inspect =~/"toc"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:manifest]=if mod.inspect =~/"--no-manifest"/ \ + act[:minitoc]=if mod.inspect =~/"--inc-minitoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-minitoc"/ \ + || act[:switch][:off].inspect =~/"minitoc"/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:manifest]=if mod.inspect =~/"--inc-manifest"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \ || act[:switch][:off].inspect =~/"manifest"/ - #|| mod.inspect =~/"--(?:redirect|dump)/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:manifest_links]=if mod.inspect =~/"--no-manifest-links"/ \ - || act[:switch][:off].inspect =~/"manifest_links"/ \ + act[:links_to_manifest]=if mod.inspect =~/"--inc-links-to-manifest"|"--inc-manifest-links"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \ + || act[:switch][:off].inspect =~/"links_to_manifest"|"manifest_links"/ \ || mod.inspect =~/"--(?:redirect|dump)/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:manifest_minitoc]=if mod.inspect =~/"--no-manifest-minitoc"/ \ + act[:manifest_minitoc]=if mod.inspect =~/"--inc-manifest-minitoc"|"--inc-minitoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-manifest-minitoc"|"--(?:exc|no)-minitoc"/ \ || act[:switch][:off].inspect =~/"manifest_minitoc"|"minitoc"/ #|| mod.inspect =~/"--(?:redirect|dump)/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:metadata]=if mod.inspect =~/"--no-metadata"/ \ + act[:metadata]=if mod.inspect =~/"--inc-metadata"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-metadata"/ \ || act[:switch][:off].inspect =~/"metadata"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_minitoc]=if mod.inspect =~/"--no-html-minitoc"/ \ + act[:html_minitoc]=if mod.inspect =~/"--inc-html-minitoc"|"--inc-minitoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-minitoc"|"--(?:exc|no)-minitoc"/ \ || act[:switch][:off].inspect =~/"html_minitoc"|"minitoc"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_navigation]=if mod.inspect =~/"--no-html-navigation"/ \ + act[:html_navigation]=if mod.inspect =~/"--inc-html-navigation"|"--inc-navigation"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-navigation"|"--(?:exc|no)-navigation"/ \ || act[:switch][:off].inspect =~/"html_navigation"|"nav"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_navigation_bar]=if mod.inspect =~/"--no-html-navigation-bar"/ \ + act[:html_navigation_bar]=if mod.inspect =~/"--inc-html-navigation-bar"|"--inc-navigation-bar"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \ || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:segsubtoc]=if mod.inspect =~/"--inc-segsubtoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-segsubtoc"/ \ + || act[:switch][:off].inspect =~/"segsubtoc"/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:search_form]=if mod.inspect =~/"--inc-search-form"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-search-form"/ \ + || act[:switch][:off].inspect =~/"search_form"|"search"/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:html_search_form]=if mod.inspect =~/"--inc-html-search-form"|"--inc-search-form"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-search-form"|"--(?:exc|no)-search-form"/ \ + || act[:switch][:off].inspect =~/"html_search_form"|"search_form"|"search"/ + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_search_form]=if mod.inspect =~/"--no-html-search-form"/ \ - || act[:switch][:off].inspect =~/"html_search_form"|"search"/ - { bool: false } - else { bool: true } + act[:html_right_pane]=if mod.inspect =~/"--inc-html-right-pane"|"--inc-right-pane"|"--inc-html-right-column"|"--inc-right-column"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-right-pane"|"--(?:exc|no)-right-pane"|"--(?:exc|no)-html-right-column"|"--(?:exc|no)-right-column"/ \ + || act[:switch][:off].inspect =~/"html_right_pane"|"html_right_column"|"promo"/ + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_right_column]=if mod.inspect =~/"--no-html-right-column"/ \ - || act[:switch][:off].inspect =~/"html_right_column"|"promo"/ - { bool: false } - else { bool: true } + act[:html_top_band]=if mod.inspect =~/"--inc-html-top-band"|"--inc-top-band"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-top-band"|"--(?:exc|no)-top-band"/ \ + || act[:switch][:off].inspect =~/"html-top-band"|"top-band"/ + { bool: false, set: :off } + else { bool: true, set: :na } end act[:dal]=(cmd =~/m/ \ || mod.inspect =~/"--dal"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:html]=(cmd =~/h/ \ || mod.inspect =~/"--html"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:concordance]=(cmd =~/w/ \ || mod.inspect =~/"--concordance"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:images]=(cmd =~/j/ \ || mod.inspect =~/"--images"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:pdf]=(cmd =~/p/ \ || mod.inspect =~/"--pdf"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:epub]=(cmd =~/e/ \ || mod.inspect =~/"--epub"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:odt]=(cmd =~/o/ \ || mod.inspect =~/"--odf"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:xml_sax]=(cmd =~/x/ \ || mod.inspect =~/"--xml-sax"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:xml_dom]=(cmd =~/X/ \ || mod.inspect =~/"--xml-dom"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:xhtml]=(cmd =~/b/ \ || mod.inspect =~/"--xhtml"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:txt]=(cmd =~/[at]/ \ || mod.inspect =~/"--txt"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:manpage]=(cmd =~/i/ \ || mod.inspect =~/"--manpage"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:texinfo]=(cmd =~/I/ \ || mod.inspect =~/"--texinfo"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:fictionbook]=(cmd =~/f/ \ || mod.inspect =~/"--fictionbook"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:psql]=(cmd =~/D/ \ || mod.inspect =~/"--pg"|"--pgsql"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sqlite]=(cmd =~/d/ \ || mod.inspect =~/"--sqlite"/) \ - ? { bool: true } - : { bool: false } + && (mod.inspect =~/"--createdb"|"--create"|"--recreate"|"--dropall"|"--recreate"|"--import"|"--update"|"--remove"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:harvest]=(mod.inspect =~/"--harvest"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:po4a]=(cmd =~/P/ \ || mod.inspect =~/"--po4a"|"--pot?"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:git]=(cmd =~/g/ \ || mod.inspect =~/"--git"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:hash_digests]=(cmd =~/N/ \ || mod.inspect =~/"--hash-digests"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sample_search_form]=(cmd =~/F/ \ || mod.inspect =~/"--sample-search-form"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:webrick]=(cmd =~/W/ \ || mod.inspect =~/"--webrick"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:share_source]=(cmd =~/s/ \ || mod.inspect =~/"--source"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sisupod]=(cmd =~/S/ \ || mod.inspect =~/"--sisupod"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:scp]=(cmd =~/r/ \ || mod.inspect =~/"--scp"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:rsync]=(cmd =~/R/ \ || mod.inspect =~/"--rsync"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:delete_output]=(cmd =~/z/ \ || mod.inspect =~/"--delete"|"--zap"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:urls_all]=(cmd =~/U/ \ || mod.inspect =~/"--urls-all"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:urls_seleted]=(cmd =~/u/ \ || mod.inspect =~/"--urls"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sitemap]=(cmd =~/Y/ \ || mod.inspect =~/"--sitemap"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:qrcode]=(cmd =~/Q/ \ || mod.inspect =~/"--qrcode"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:manifest]=(cmd =~/y/ \ || mod.inspect =~/"--manifest"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:help]=(mod.inspect =~/"--help/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } @act=act end def cmd diff --git a/lib/sisu/v3dv/param.rb b/lib/sisu/v3dv/param.rb index 8d3379b7..5563f780 100644 --- a/lib/sisu/v3dv/param.rb +++ b/lib/sisu/v3dv/param.rb @@ -811,8 +811,88 @@ module SiSU_Param else nil end end - def omit_list + def omit m=@h['omit'] + @m=m ? (m.split(/,\s+/)) : nil + def list + @m + end + self + end + def ocn? + (omit.list.inspect =~/"ocn"/) \ + ? :off + : :na + end + def toc? + (omit.list.inspect =~/"toc"/) \ + ? :off + : :na + end + def manifest? + (omit.list.inspect =~/"manifest"/) \ + ? :off + : :na + end + def links_to_manifest? + (omit.list.inspect =~/"manifest_links"|"links_to_manifest"/) \ + ? :off + : :na + end + def metadata? + (omit.list.inspect =~/"metadata"/) \ + ? :off + : :na + end + def minitoc? + (omit.list.inspect =~/"minitoc"/) \ + ? :off + : :na + end + def html_minitoc? + (omit.list.inspect =~/"html_minitoc"/) \ + ? :off + : :na + end + def html_top_band? + (omit.list.inspect =~/"html_top_band"/) \ + ? :off + : :na + end + def html_navigation? + (omit.list.inspect =~/"html_navigation"/) \ + ? :off + : :na + end + def html_navigation_bar? + (omit.list.inspect =~/"html_navigation_bar"/) \ + ? :off + : :na + end + def segsubtoc? + (omit.list.inspect =~/"segsubtoc"/) \ + ? :off + : :na + end + def search_form? + (omit.list.inspect =~/"search_form"/) \ + ? :off + : :na + end + def html_search_form? + (omit.list.inspect =~/"html_search_form"/) \ + ? :off + : :na + end + def html_right_pane? + (omit.list.inspect =~/"html_right_column"|"html_right_pane"/) \ + ? :off + : :na + end + def manifest_minitoc? + (omit.list.inspect =~/"manifest_minitoc"/) \ + ? :off + : :na end def texpdf_font def main diff --git a/lib/sisu/v3dv/sysenv.rb b/lib/sisu/v3dv/sysenv.rb index fcfc234b..95ebf6d9 100644 --- a/lib/sisu/v3dv/sysenv.rb +++ b/lib/sisu/v3dv/sysenv.rb @@ -435,27 +435,27 @@ module SiSU_Env end def dump? ((by?) ==:dump) \ - ? true \ + ? true : false end def redirect? ((by?) ==:redirect) \ - ? true \ + ? true : false end def by_language_code? ((by?) ==:language) \ - ? true \ + ? true : false end def by_filetype? ((by?) ==:filetype) \ - ? true \ + ? true : false end def by_filename? ((by?) ==:filename) \ - ? true \ + ? true : false end def multilingual? @@ -804,9 +804,10 @@ module SiSU_Env end def makeinfo #texinfo program='makeinfo' + options='' #'--force' #'' program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/" (program_found?(program)) \ - ? system("#{program} #{@input}\n") + ? system("#{program} #{options} #{@input}\n") : (puts "\tWARN: #{program} is not installed #{program_ref}") end def scp @@ -1192,13 +1193,6 @@ module SiSU_Env else false end end - def manifest_minitoc? - flag=if defined? @rc['manifest']['minitoc'] \ - and not @rc['manifest']['minitoc'].nil? - @rc['manifest']['minitoc'] - else false - end - end def manifest_minitoc? flag=if (defined? @rc['manifest']['minitoc'] \ and not @rc['manifest']['minitoc'].nil?) @@ -1222,7 +1216,7 @@ module SiSU_Env listed=if omit_list x=(omit_list.scan(/\b#{test}\b/)).join test==x \ - ? true \ + ? true : false else false @@ -1230,48 +1224,67 @@ module SiSU_Env listed end def ocn? - flag=if (defined? @rc['omit']['ocn'] \ + if (defined? @rc['omit']['ocn'] \ and not @rc['omit']['ocn'].nil?) \ or listed?('ocn') - false + :off else - true + :na end end def toc? - flag=if (defined? @rc['omit']['toc'] \ + if (defined? @rc['omit']['toc'] \ and not @rc['omit']['toc'].nil?) \ or listed?('toc') - false + :off else - true + :na end end def manifest? - flag=if (defined? @rc['omit']['manifest'] \ + if (defined? @rc['omit']['manifest'] \ and not @rc['omit']['manifest'].nil?) \ or listed?('manifest') - false + :off else - true + :na end end - def manifest_links? - flag=if (defined? @rc['omit']['manifest_links'] \ - and not @rc['omit']['manifest_links'].nil?) \ - or listed?('manifest_links') - false + def links_to_manifest? + flag=if (defined? @rc['omit']['links_to_manifest'] \ + and not @rc['omit']['links_to_manifest'].nil?) \ + or (listed?('links_to_manifest') \ + || listed?('manifest_links')) + :off else - true + :na + end + end + def metadata? + if (defined? @rc['omit']['metadata'] \ + and not @rc['omit']['metadata'].nil?) \ + or listed?('metadata') + :off + else + :na + end + end + def minitoc? + flag=if (defined? @rc['omit']['minitoc'] \ + and not @rc['omit']['minitoc'].nil?) \ + or (listed?('minitoc')) + :off + else + :na end end def manifest_minitoc? flag=if (defined? @rc['omit']['manifest_minitoc'] \ and not @rc['omit']['manifest_minitoc'].nil?) \ or listed?('manifest_minitoc') - false + :off else - true + :na end end def html_minitoc? @@ -1279,45 +1292,72 @@ module SiSU_Env and not @rc['omit']['html_minitoc'].nil?) \ or (listed?('html_minitoc') \ || listed?('minitoc')) - false + :off else - true + :na end end def html_navigation? flag=if (defined? @rc['omit']['html_navigation'] \ and not @rc['omit']['html_navigation'].nil?) \ or listed?('html_navigation') - false + :off else - true + :na end end def html_navigation_bar? flag=if (defined? @rc['omit']['html_navigation_bar'] \ and not @rc['omit']['html_navigation_bar'].nil?) \ or listed?('html_navigation_bar') - false + :off else - true + :na end end - def html_search_form? - flag=if (defined? @rc['omit']['html_search_form'] \ - and not @rc['omit']['html_search_form'].nil?) \ - or listed?('html_search_form') - false + def segsubtoc? + flag=if (defined? @rc['omit']['segsubtoc'] \ + and not @rc['omit']['segsubtoc'].nil?) \ + or listed?('segsubtoc') + :off else - true + :na end end - def html_right_column? - flag=if (defined? @rc['omit']['html_right_column'] \ - and not @rc['omit']['html_right_column'].nil?) \ - or listed?('html_right_column') - false + def html_right_pane? + flag=if (defined? @rc['omit']['html_right_pane'] \ + and not @rc['omit']['html_right_pane'].nil?) \ + or listed?('html_right_pane') + :off else - true + :na + end + end + def html_top_band? + flag=if (defined? @rc['omit']['html_top_band'] \ + and not @rc['omit']['html_top_band'].nil?) \ + or listed?('html_top_band') + :off + else + :na + end + end + def search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line + flag=if (defined? @rc['omit']['search_form'] \ + and not @rc['omit']['search_form'].nil?) \ + or listed?('search_form') + :off + else + :na + end + end + def html_search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line + flag=if (defined? @rc['omit']['html_search_form'] \ + and not @rc['omit']['html_search_form'].nil?) \ + or listed?('html_search_form') + :off + else + :na end end self @@ -3467,41 +3507,274 @@ WOK end end end - class OutputStructure + class ProcessingSettings def initialize(md) @md=md - @env=SiSU_Env::InfoEnv.new(@md.fns) + end + def cnf_rc #sisurc.yml + @rc=SiSU_Env::GetInit.instance.sisu_yaml.rc + end + def env_rc #env rc (including sisurc.yml) + @env_rc ||=SiSU_Env::InfoEnv.new(@md.fns) + end + def doc_rc #document rc, make instructions + @md.make + end + def cmd_rc #command-line rc + @cmd_rc=@md.opt.opt_act + end + def build + def ocn? + if cmd_rc[:ocn][:set]==:on + true + elsif cmd_rc[:ocn][:set]==:off + false + elsif @md.make.ocn? ==:off + false + elsif env_rc.build.ocn? ==:off + false + else + true + end + end + def toc? + if cmd_rc[:toc][:set]==:on + true + elsif cmd_rc[:toc][:set]==:off + false + elsif @md.make.toc? ==:off + false + elsif env_rc.build.toc? ==:off + false + else + true + end + end + def manifest? + if cmd_rc[:manifest][:set]==:on + true + elsif cmd_rc[:manifest][:set]==:off + false + elsif @md.make.manifest? ==:off + false + elsif env_rc.build.manifest? ==:off + false + else + true + end + end + def links_to_manifest? + if cmd_rc[:links_to_manifest][:set]==:on + true + elsif cmd_rc[:links_to_manifest][:set]==:off + false + elsif @md.make.links_to_manifest? ==:off + false + elsif env_rc.build.links_to_manifest? ==:off + false + else + true + end + end + def metadata? + if cmd_rc[:metadata][:set]==:on + true + elsif cmd_rc[:metadata][:set]==:off + false + elsif @md.make.metadata? ==:off + false + elsif env_rc.build.metadata? ==:off + false + else + true + end + end + def minitoc? + if html_top_band? == false #one form of navigation necessary + true + elsif cmd_rc[:minitoc][:set]==:on + true + elsif cmd_rc[:minitoc][:set]==:off + false + elsif @md.make.minitoc? ==:off + false + elsif env_rc.build.minitoc? ==:off + false + else + true + end + end + def manifest_minitoc? + if html_top_band? == false #one form of navigation necessary + true + elsif cmd_rc[:manifest_minitoc][:set]==:on \ + || cmd_rc[:minitoc][:set]==:on + true + elsif cmd_rc[:manifest_minitoc][:set]==:off \ + || cmd_rc[:minitoc][:set]==:off + false + elsif @md.make.manifest_minitoc? ==:off \ + || @md.make.minitoc? ==:off + false + elsif env_rc.build.manifest_minitoc? ==:off \ + || env_rc.build.minitoc? ==:off + false + elsif minitoc? == false + false + else + true + end + end + def html_minitoc? + if html_top_band? == false #one form of navigation necessary + true + elsif cmd_rc[:html_minitoc][:set]==:on \ + || cmd_rc[:minitoc][:set]==:on + true + elsif cmd_rc[:html_minitoc][:set]==:off \ + || cmd_rc[:minitoc][:set]==:off + false + elsif @md.make.html_minitoc? ==:off \ + || @md.make.minitoc? ==:off + false + elsif env_rc.build.html_minitoc? ==:off \ + || env_rc.build.minitoc? ==:off + false + elsif minitoc? == false + false + else + true + end + end + def html_top_band? + if cmd_rc[:html_top_band][:set]==:on + true + elsif cmd_rc[:html_top_band][:set]==:off + false + elsif @md.make.html_top_band? ==:off + false + elsif env_rc.build.html_top_band? ==:off + false + else + true + end + end + def html_navigation? + if cmd_rc[:html_navigation][:set]==:on + true + elsif cmd_rc[:html_navigation][:set]==:off + false + elsif @md.make.html_navigation? ==:off + false + elsif env_rc.build.html_navigation? ==:off + false + else + true + end + end + def html_navigation_bar? + if cmd_rc[:html_navigation_bar][:set]==:on + true + elsif cmd_rc[:html_navigation_bar][:set]==:off + false + elsif @md.make.html_navigation_bar? ==:off + false + elsif env_rc.build.html_navigation_bar? ==:off + false + else + true + end + end + def search_form? + if cmd_rc[:search_form][:set]==:on + true + elsif cmd_rc[:search_form][:set]==:off + false + elsif @md.make.search_form? ==:off + false + elsif env_rc.build.search_form? ==:off + false + else + true + end + end + def html_search_form? + if cmd_rc[:html_search_form][:set]==:on \ + || cmd_rc[:search_form][:set]==:on + true + elsif cmd_rc[:html_search_form][:set]==:off \ + || cmd_rc[:search_form][:set]==:off + false + elsif @md.make.html_search_form? ==:off \ + || @md.make.search_form? ==:off + false + elsif env_rc.build.html_search_form? ==:off \ + || env_rc.build.search_form? ==:off + false + elsif search_form? == false + false + else + true + end + end + def html_right_pane? + if cmd_rc[:html_right_pane][:set]==:on + true + elsif cmd_rc[:html_right_pane][:set]==:off + false + elsif @md.make.html_right_pane? ==:off + false + elsif env_rc.build.html_right_pane? ==:off + false + else + true + end + end + def segsubtoc? + if cmd_rc[:segsubtoc][:set]==:on + true + elsif cmd_rc[:segsubtoc][:set]==:off + false + elsif @md.make.segsubtoc? ==:off + false + elsif env_rc.build.segsubtoc? ==:off + false + else + true + end + end + self end def output_dir_structure def by_language_code? - @env.output_dir_structure.by_language_code? + env_rc.output_dir_structure.by_language_code? end def by_filetype? - @env.output_dir_structure.by_filetype? + env_rc.output_dir_structure.by_filetype? end def by_filename? - @env.output_dir_structure.by_filename? + env_rc.output_dir_structure.by_filename? end def multilingual? by_language_code? end def dump? - ((@md.opt.opt_act[:dump][:bool] \ - && @md.opt.opt_act[:dump][:inst]) \ - || (@env.output_dir_structure.dump?)) \ - ? true \ + ((cmd_rc[:dump][:bool] \ + && cmd_rc[:dump][:inst]) \ + || (env_rc.output_dir_structure.dump?)) \ + ? true : false end def redirect? - ((@md.opt.opt_act[:redirect][:bool] \ - && @md.opt.opt_act[:redirect][:inst]) \ - || (@env.output_dir_structure.redirect?)) \ - ? true \ + ((cmd_rc[:redirect][:bool] \ + && cmd_rc[:redirect][:inst]) \ + || (env_rc.output_dir_structure.redirect?)) \ + ? true : false end def dump_or_redirect? ((dump?) || (redirect?)) \ - ? true \ + ? true : false end def by? @@ -3532,7 +3805,7 @@ WOK end end def output_dir_structure - OutputStructure.new(@md).output_dir_structure + ProcessingSettings.new(@md).output_dir_structure end def mkdir_initialize # not used but consider using FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir) @@ -3585,7 +3858,7 @@ WOK def html_seg_index pth=((by_filename?) \ || (output_dir_structure.dump?)) \ - ? "#{output_path.html.dir}" \ + ? "#{output_path.html.dir}" : "#{output_path.html.dir}/#{@md.fnb}" fn=base_filename.html_seg_index make_path(pth) @@ -3595,7 +3868,7 @@ WOK def html_segtoc pth=((by_filename?) \ || (output_dir_structure.dump?)) \ - ? "#{output_path.html.dir}" \ + ? "#{output_path.html.dir}" : "#{output_path.html.dir}/#{@md.fnb}" fn=base_filename.html_segtoc make_path(pth) @@ -4949,104 +5222,6 @@ WOK self end end - class InfoSet #