diff options
Diffstat (limited to 'lib/sisu/v3dv')
-rw-r--r-- | lib/sisu/v3dv/html_segments.rb | 3 | ||||
-rw-r--r-- | lib/sisu/v3dv/options.rb | 64 | ||||
-rw-r--r-- | lib/sisu/v3dv/param.rb | 3 | ||||
-rw-r--r-- | lib/sisu/v3dv/sysenv.rb | 221 |
4 files changed, 288 insertions, 3 deletions
diff --git a/lib/sisu/v3dv/html_segments.rb b/lib/sisu/v3dv/html_segments.rb index 05f30cc4..b20d2271 100644 --- a/lib/sisu/v3dv/html_segments.rb +++ b/lib/sisu/v3dv/html_segments.rb @@ -138,6 +138,7 @@ module SiSU_HTML_Seg @seg_name_html=@@seg_name_html || nil @seg_name_html_tracker=@@tracker || nil @env=SiSU_Env::InfoEnv.new(@md.fns) if @md + @make=SiSU_Env::InfoSet.new(@md) if @md if @md @title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner? end @@ -244,7 +245,7 @@ module SiSU_HTML_Seg SiSU_HTML_Seg::Seg.new(@md).tail segfilename="#{@file.output_path.html_seg.dir}/#{@@seg_name_html[tracking-1]}#{@md.lang_code_insert}#{Sfx[:html]}" output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] - minitoc=(@env.html_minitoc?) \ + minitoc=(@make.html_minitoc?) \ ? @minitoc : '' if dob.is==:heading \ diff --git a/lib/sisu/v3dv/options.rb b/lib/sisu/v3dv/options.rb index fbb3261e..b2b7ff15 100644 --- a/lib/sisu/v3dv/options.rb +++ b/lib/sisu/v3dv/options.rb @@ -486,8 +486,68 @@ module SiSU_Commandline || mod.inspect =~/"--maintenance|--keep-processing-files"/) \ ? { bool: true } : { bool: false } - act[:ocn]=if mod.inspect =~/"--no-ocn"/ - { bool: false } + 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: [] } + end + act[:ocn]=if mod.inspect =~/"--no-ocn"/ \ + || act[:switch][:off].inspect =~/"ocn"/ + { bool: false } + else { bool: true } + end + act[:toc]=if mod.inspect =~/"--no-toc"/ \ + || act[:switch][:off].inspect =~/"toc"/ + { bool: false } + else { bool: true } + end + act[:manifest]=if mod.inspect =~/"--no-manifest"/ \ + || act[:switch][:off].inspect =~/"manifest"/ + #|| mod.inspect =~/"--(?:redirect|dump)/ + { bool: false } + else { bool: true } + end + act[:manifest_links]=if mod.inspect =~/"--no-manifest-links"/ \ + || act[:switch][:off].inspect =~/"manifest_links"/ \ + || mod.inspect =~/"--(?:redirect|dump)/ + { bool: false } + else { bool: true } + end + act[:manifest_minitoc]=if mod.inspect =~/"--no-manifest-minitoc"/ \ + || act[:switch][:off].inspect =~/"manifest_minitoc"|"minitoc"/ + #|| mod.inspect =~/"--(?:redirect|dump)/ + { bool: false } + else { bool: true } + end + act[:metadata]=if mod.inspect =~/"--no-metadata"/ \ + || act[:switch][:off].inspect =~/"metadata"/ + { bool: false } + else { bool: true } + end + act[:html_minitoc]=if mod.inspect =~/"--no-html-minitoc"/ \ + || act[:switch][:off].inspect =~/"html_minitoc"|"minitoc"/ + { bool: false } + else { bool: true } + end + act[:html_navigation]=if mod.inspect =~/"--no-html-navigation"/ \ + || act[:switch][:off].inspect =~/"html_navigation"|"nav"/ + { bool: false } + else { bool: true } + end + act[:html_navigation_bar]=if mod.inspect =~/"--no-html-navigation-bar"/ \ + || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/ + { bool: false } + else { bool: true } + 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 } + 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 } end act[:dal]=(cmd =~/m/ \ diff --git a/lib/sisu/v3dv/param.rb b/lib/sisu/v3dv/param.rb index fac9ad76..8d3379b7 100644 --- a/lib/sisu/v3dv/param.rb +++ b/lib/sisu/v3dv/param.rb @@ -811,6 +811,9 @@ module SiSU_Param else nil end end + def omit_list + m=@h['omit'] + end def texpdf_font def main @h['texpdf_font'] \ diff --git a/lib/sisu/v3dv/sysenv.rb b/lib/sisu/v3dv/sysenv.rb index b305dfb7..fcfc234b 100644 --- a/lib/sisu/v3dv/sysenv.rb +++ b/lib/sisu/v3dv/sysenv.rb @@ -1199,6 +1199,129 @@ 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 build + def omit_list + @off_list ||=if (defined? @rc['omit_list'] \ + and not @rc['omit_list'].nil?) + @rc['omit_list'] + elsif (defined? @rc['omit']['list'] \ + and not @rc['omit']['list'].nil?) + @rc['omit']['list'] + else + nil + end + end + def listed?(test) #fix + listed=if omit_list + x=(omit_list.scan(/\b#{test}\b/)).join + test==x \ + ? true \ + : false + else + false + end + listed + end + def ocn? + flag=if (defined? @rc['omit']['ocn'] \ + and not @rc['omit']['ocn'].nil?) \ + or listed?('ocn') + false + else + true + end + end + def toc? + flag=if (defined? @rc['omit']['toc'] \ + and not @rc['omit']['toc'].nil?) \ + or listed?('toc') + false + else + true + end + end + def manifest? + flag=if (defined? @rc['omit']['manifest'] \ + and not @rc['omit']['manifest'].nil?) \ + or listed?('manifest') + false + else + true + end + end + def manifest_links? + flag=if (defined? @rc['omit']['manifest_links'] \ + and not @rc['omit']['manifest_links'].nil?) \ + or listed?('manifest_links') + false + else + true + end + end + def manifest_minitoc? + flag=if (defined? @rc['omit']['manifest_minitoc'] \ + and not @rc['omit']['manifest_minitoc'].nil?) \ + or listed?('manifest_minitoc') + false + else + true + end + end + def html_minitoc? + flag=if (defined? @rc['omit']['html_minitoc'] \ + and not @rc['omit']['html_minitoc'].nil?) \ + or (listed?('html_minitoc') \ + || listed?('minitoc')) + false + else + true + end + end + def html_navigation? + flag=if (defined? @rc['omit']['html_navigation'] \ + and not @rc['omit']['html_navigation'].nil?) \ + or listed?('html_navigation') + false + else + true + 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 + else + true + 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 + else + true + 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 + else + true + end + end + self + end def odt_ocn? ((defined? @rc['odt']['ocn']) \ && @rc['odt']['ocn']==true) \ @@ -4826,6 +4949,104 @@ WOK self end end + class InfoSet #<InfoEnv + def initialize(md) + @md=md + @env=SiSU_Env::InfoEnv.new(md.fns) + end + def heading_omit_list + @md.make.omit_list + end + def not_heading_make_omit_listed?(test) #fix + listed=if heading_omit_list + x=(heading_omit_list.scan(/\b#{test}\b/)).join + test==x \ + ? false \ + : true + else + true + end + listed + end + def ocn? + @md.opt.opt_act[:ocn][:bool] \ + && (@env.build.ocn?) \ + ? true \ + : false + end + def toc? + @md.opt.opt_act[:toc][:bool] \ + && (not_heading_make_omit_listed?('ocn')) \ + && (@env.build.toc?) \ + ? true \ + : false + end + def manifest? + @md.opt.opt_act[:manifest][:bool] \ + && (not_heading_make_omit_listed?('manifest')) \ + && (@env.build.manifest?) \ + ? true \ + : false + end + def manifest_links? + @md.opt.opt_act[:manifest_links][:bool] \ + && (not_heading_make_omit_listed?('manifest_links')) \ + && (@env.build.manifest_links?) \ + ? true \ + : false + end + def manifest_minitoc? + @md.opt.opt_act[:manifest_minitoc][:bool] \ + && (not_heading_make_omit_listed?('manifest_minitoc')) \ + && (@env.build.manifest_minitoc?) \ + ? true \ + : false + end + def metadata? + @md.opt.opt_act[:metadata][:bool] \ + && (not_heading_make_omit_listed?('metadata')) \ + && (@env.build.metadata?) \ + ? true \ + : false + end + def html_minitoc? + @md.opt.opt_act[:html_minitoc][:bool] \ + && ((not_heading_make_omit_listed?('html_minitoc')) \ + || (not_heading_make_omit_listed?('minitoc'))) \ + && (@env.build.html_minitoc?) \ + ? true \ + : false + end + def html_navigation? + @md.opt.opt_act[:html_navigation][:bool] \ + && (not_heading_make_omit_listed?('html_navigation')) \ + && (@env.build.html_navigation?) \ + ? true \ + : false + end + def html_navigation_bar? + @md.opt.opt_act[:html_navigation_bar][:bool] \ + && (not_heading_make_omit_listed?('html_navigation_bar')) \ + && (@env.build.html_navigation_bar?) \ + ? true \ + : false + end + def html_search_form? + @md.opt.opt_act[:html_search_form][:bool] \ + && (not_heading_make_omit_listed?('html_search_form')) \ + && (@env.build.html_search_form?) \ + ? true \ + : false + end + def html_right_column? + @md.opt.opt_act[:html_right_column][:bool] \ + && ((not_heading_make_omit_listed?('html_right_column')) \ + || (not_heading_make_omit_listed?('html_promo'))) \ + && (@env.build.html_right_column?) \ + ? true \ + : false + end + end class CreateFile <InfoEnv #todo unify with FileOp def initialize(fns) begin |