diff options
author | Ralph Amissah <ralph@amissah.com> | 2012-02-14 21:32:53 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2012-02-14 21:33:13 -0500 |
commit | 6d898f1eb74160fbc7d6365b3ad8d6b9417d2f19 (patch) | |
tree | 066bf34901b3169eec6a573e58ce971ec2fbde8e /lib/sisu/v3dv/sysenv.rb | |
parent | v3dv: dal, remove sisu_manifest from document structure & toc (diff) |
v3dv: control hookssisu_3.1.14
* hooks to make it possible to control (via: the command line; the document
markup header, or; the command line) the likes of: toc, manifest,
manifest-links, metadata, html-minitoc, html-navigation, html-navigation-bar;
these are switched on by default and control takes the form of making it
possible to switch them off.
Diffstat (limited to 'lib/sisu/v3dv/sysenv.rb')
-rw-r--r-- | lib/sisu/v3dv/sysenv.rb | 221 |
1 files changed, 221 insertions, 0 deletions
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 |