From ba278b927a8127efaa27725ca2bcb416a2c5d25d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 28 May 2012 04:28:52 -0400 Subject: v3: options, command line control of output directory structure * --output-by-language; --output-by-filetype; --output-by-filename, or --by-language; --by-filetype; --by-filename --- lib/sisu/v3/sysenv.rb | 117 +++++++++++++++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 45 deletions(-) (limited to 'lib/sisu/v3/sysenv.rb') diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 4a91a2de..a28b4060 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -3554,14 +3554,14 @@ WOK def doc_rc #document rc, make instructions @md.make end - def cmd_rc #command-line rc - @cmd_rc=@md.opt.opt_act + def cmd_rc_act #command-line rc + @cmd_rc_act=@md.opt.opt_act end def build def ocn? - if cmd_rc[:ocn][:set]==:on + if cmd_rc_act[:ocn][:set]==:on true - elsif cmd_rc[:ocn][:set]==:off + elsif cmd_rc_act[:ocn][:set]==:off false elsif defined? @md.make.ocn? \ and @md.make.ocn? ==:off @@ -3573,9 +3573,9 @@ WOK end end def toc? - if cmd_rc[:toc][:set]==:on + if cmd_rc_act[:toc][:set]==:on true - elsif cmd_rc[:toc][:set]==:off + elsif cmd_rc_act[:toc][:set]==:off false elsif defined? @md.make.toc? \ and @md.make.toc? ==:off @@ -3587,9 +3587,9 @@ WOK end end def manifest? - if cmd_rc[:manifest][:set]==:on + if cmd_rc_act[:manifest][:set]==:on true - elsif cmd_rc[:manifest][:set]==:off + elsif cmd_rc_act[:manifest][:set]==:off false elsif defined? @md.make.manifest? \ and @md.make.manifest? ==:off @@ -3601,9 +3601,9 @@ WOK end end def links_to_manifest? - if cmd_rc[:links_to_manifest][:set]==:on + if cmd_rc_act[:links_to_manifest][:set]==:on true - elsif cmd_rc[:links_to_manifest][:set]==:off + elsif cmd_rc_act[:links_to_manifest][:set]==:off false elsif defined? @md.make.links_to_manifest? \ and @md.make.links_to_manifest? ==:off @@ -3615,9 +3615,9 @@ WOK end end def metadata? - if cmd_rc[:metadata][:set]==:on + if cmd_rc_act[:metadata][:set]==:on true - elsif cmd_rc[:metadata][:set]==:off + elsif cmd_rc_act[:metadata][:set]==:off false elsif defined? @md.make.metadata? \ and @md.make.metadata? ==:off @@ -3631,9 +3631,9 @@ WOK def minitoc? if html_top_band? == false #one form of navigation necessary true - elsif cmd_rc[:minitoc][:set]==:on + elsif cmd_rc_act[:minitoc][:set]==:on true - elsif cmd_rc[:minitoc][:set]==:off + elsif cmd_rc_act[:minitoc][:set]==:off false elsif defined? @md.make.minitoc? \ and @md.make.minitoc? ==:off @@ -3647,11 +3647,11 @@ WOK 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 + elsif cmd_rc_act[:manifest_minitoc][:set]==:on \ + || cmd_rc_act[:minitoc][:set]==:on true - elsif cmd_rc[:manifest_minitoc][:set]==:off \ - || cmd_rc[:minitoc][:set]==:off + elsif cmd_rc_act[:manifest_minitoc][:set]==:off \ + || cmd_rc_act[:minitoc][:set]==:off false elsif defined? @md.make.manifest_minitoc? \ and (@md.make.manifest_minitoc? ==:off \ @@ -3669,11 +3669,11 @@ WOK 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 + elsif cmd_rc_act[:html_minitoc][:set]==:on \ + || cmd_rc_act[:minitoc][:set]==:on true - elsif cmd_rc[:html_minitoc][:set]==:off \ - || cmd_rc[:minitoc][:set]==:off + elsif cmd_rc_act[:html_minitoc][:set]==:off \ + || cmd_rc_act[:minitoc][:set]==:off false elsif defined? @md.make.html_minitoc? \ and (@md.make.html_minitoc? ==:off \ @@ -3689,9 +3689,9 @@ WOK end end def html_top_band? - if cmd_rc[:html_top_band][:set]==:on + if cmd_rc_act[:html_top_band][:set]==:on true - elsif cmd_rc[:html_top_band][:set]==:off + elsif cmd_rc_act[:html_top_band][:set]==:off false elsif defined? @md.make.html_top_band? \ and @md.make.html_top_band? ==:off @@ -3703,9 +3703,9 @@ WOK end end def html_navigation? - if cmd_rc[:html_navigation][:set]==:on + if cmd_rc_act[:html_navigation][:set]==:on true - elsif cmd_rc[:html_navigation][:set]==:off + elsif cmd_rc_act[:html_navigation][:set]==:off false elsif defined? @md.make.html_navigation? \ and @md.make.html_navigation? ==:off @@ -3717,9 +3717,9 @@ WOK end end def html_navigation_bar? - if cmd_rc[:html_navigation_bar][:set]==:on + if cmd_rc_act[:html_navigation_bar][:set]==:on true - elsif cmd_rc[:html_navigation_bar][:set]==:off + elsif cmd_rc_act[:html_navigation_bar][:set]==:off false elsif defined? @md.make.html_navigation_bar? \ and @md.make.html_navigation_bar? ==:off @@ -3731,9 +3731,9 @@ WOK end end def search_form? - if cmd_rc[:search_form][:set]==:on + if cmd_rc_act[:search_form][:set]==:on true - elsif cmd_rc[:search_form][:set]==:off + elsif cmd_rc_act[:search_form][:set]==:off false elsif defined? @md.make.html_search_form? \ and @md.make.search_form? ==:off @@ -3745,11 +3745,11 @@ WOK end end def html_search_form? - if cmd_rc[:html_search_form][:set]==:on \ - || cmd_rc[:search_form][:set]==:on + if cmd_rc_act[:html_search_form][:set]==:on \ + || cmd_rc_act[:search_form][:set]==:on true - elsif cmd_rc[:html_search_form][:set]==:off \ - || cmd_rc[:search_form][:set]==:off + elsif cmd_rc_act[:html_search_form][:set]==:off \ + || cmd_rc_act[:search_form][:set]==:off false elsif defined? @md.make.html_search_form? \ and (@md.make.html_search_form? ==:off \ @@ -3765,9 +3765,9 @@ WOK end end def html_right_pane? - if cmd_rc[:html_right_pane][:set]==:on + if cmd_rc_act[:html_right_pane][:set]==:on true - elsif cmd_rc[:html_right_pane][:set]==:off + elsif cmd_rc_act[:html_right_pane][:set]==:off false elsif defined? @md.make.html_right_pane? \ and @md.make.html_right_pane? ==:off @@ -3779,9 +3779,9 @@ WOK end end def segsubtoc? - if cmd_rc[:segsubtoc][:set]==:on + if cmd_rc_act[:segsubtoc][:set]==:on true - elsif cmd_rc[:segsubtoc][:set]==:off + elsif cmd_rc_act[:segsubtoc][:set]==:off false elsif defined? @md.make.segsubtoc? \ and @md.make.segsubtoc? ==:off @@ -3796,27 +3796,54 @@ WOK end def output_dir_structure def by_language_code? - env_rc.output_dir_structure.by_language_code? + if cmd_rc_act[:output_by][:set] == :language + true + elsif cmd_rc_act[:output_by][:set] == :filetype \ + or cmd_rc_act[:output_by][:set] == :filename + false + elsif cmd_rc_act[:output_by][:set] == :language + true + else + env_rc.output_dir_structure.by_language_code? + end end def by_filetype? - env_rc.output_dir_structure.by_filetype? + if cmd_rc_act[:output_by][:set] == :filetype + true + elsif cmd_rc_act[:output_by][:set] == :language \ + or cmd_rc_act[:output_by][:set] == :filename + false + elsif cmd_rc_act[:output_by][:set] == :filetype + true + else + env_rc.output_dir_structure.by_filetype? + end end def by_filename? - env_rc.output_dir_structure.by_filename? + if cmd_rc_act[:output_by][:set] == :filename + true + elsif cmd_rc_act[:output_by][:set] == :language \ + or cmd_rc_act[:output_by][:set] == :filetype + false + elsif cmd_rc_act[:output_by][:set] == :filename + true + else + env_rc.output_dir_structure.by_filename? + end end def multilingual? by_language_code? end def dump? - ((cmd_rc[:dump][:bool] \ - && cmd_rc[:dump][:inst]) \ + ((cmd_rc_act[:dump][:bool] \ + && cmd_rc_act[:dump][:inst]) \ || (env_rc.output_dir_structure.dump?)) \ ? true : false end def redirect? - ((cmd_rc[:redirect][:bool] \ - && cmd_rc[:redirect][:inst]) \ + ((cmd_rc_act[:redirect][:bool] \ + && cmd_rc_act[:redirect][:inst]) \ || (env_rc.output_dir_structure.redirect?)) \ ? true : false -- cgit v1.2.3