From 2b884fb73428186df29bf22ff38d77e5d2f823cf Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 14 Feb 2012 21:10:19 -0500 Subject: v3dv: --redirect (--redirect=dir_path) & --dump (--dump=dir_path) + consequences * --dump places output in directory specified, if none specified in the current directory (pwd). * --redirect places output in subdirectory under specified directory, subdirectory uses the filename (without the suffix). If no output directory is specified places the subdirectory under the current directory (pwd). * html, css incorporated into each file (concordance & manifest included) * html, xhtml & xmls, css copied into css subdirectory (not used by html as embedded) * html xmls, images copied to output directory * no links to manifest * manifest with relative links only * longer html filenames given to avoid names clashing (e.g. for toc, manifest, concordance) * html, epub, remove manifest toc links * -j copy images associated with file (images used by html & xmls) * automatically invoked by --dump & redirect * v3 v3dv: document --redirect, --dump, -j update sisu_commands.sst [documents not generated until v3.2.0 (when v3dv branch is merged into v3)] --- lib/sisu/v3dv/sysenv.rb | 310 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 212 insertions(+), 98 deletions(-) (limited to 'lib/sisu/v3dv/sysenv.rb') diff --git a/lib/sisu/v3dv/sysenv.rb b/lib/sisu/v3dv/sysenv.rb index 7374d88f..b305dfb7 100644 --- a/lib/sisu/v3dv/sysenv.rb +++ b/lib/sisu/v3dv/sysenv.rb @@ -408,7 +408,15 @@ module SiSU_Env def by? output_structure=:filename #set default output structure output_structure=if defined? @rc['output_dir_structure_by'] - output_structure=if (@rc['output_dir_structure_by'] =~/language/) \ + output_structure=if (@rc['output_dir_structure_by'] =~/dump/) \ + or ((defined? @rc['output_structure']['dump']) \ + && @rc['output_structure']['dump'] ==true) + :dump + elsif (@rc['output_dir_structure_by'] =~/redirect/) \ + or ((defined? @rc['output_structure']['redirect']) \ + && @rc['output_structure']['redirect'] ==true) + :redirect + elsif (@rc['output_dir_structure_by'] =~/language/) \ or ((defined? @rc['output_structure']['by_language']) \ && @rc['output_structure']['by_language'] ==true) :language @@ -420,9 +428,21 @@ module SiSU_Env or ((defined? @rc['output_structure']['by_filename']) \ && @rc['output_structure']['by_filename'] ==true) :filename + else #recheck current default + :language end end end + def dump? + ((by?) ==:dump) \ + ? true \ + : false + end + def redirect? + ((by?) ==:redirect) \ + ? true \ + : false + end def by_language_code? ((by?) ==:language) \ ? true \ @@ -1568,7 +1588,12 @@ WOK end end def default_output_css - if @env.output_dir_structure.by_language_code? + if (@md.opt.opt_act[:dump][:bool] \ + && @md.opt.opt_act[:dump][:inst]) \ + || (@md.opt.opt_act[:redirect][:bool] \ + && @md.opt.opt_act[:redirect][:inst]) + './' + elsif @env.output_dir_structure.by_language_code? '../../' elsif @env.output_dir_structure.by_filetype? '../' @@ -1664,7 +1689,14 @@ WOK defaults[:sisu_share] end def style - defaults[:stylesheet_stub] + if (@md.opt.opt_act[:dump][:bool] \ + && @md.opt.opt_act[:dump][:inst]) \ + || (@md.opt.opt_act[:redirect][:bool] \ + && @md.opt.opt_act[:redirect][:inst]) + 'css' + else + defaults[:stylesheet_stub] + end end def sample_data #sample data repository source directory defaults[:sample_data_path] @@ -3312,14 +3344,10 @@ WOK end end end - class FileOp