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/options.rb | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'lib/sisu/v3dv/options.rb') diff --git a/lib/sisu/v3dv/options.rb b/lib/sisu/v3dv/options.rb index 4cd071ac..fbb3261e 100644 --- a/lib/sisu/v3dv/options.rb +++ b/lib/sisu/v3dv/options.rb @@ -362,6 +362,7 @@ module SiSU_Commandline when /^--(?:xhtml)$/; c=c+'b' when /^--(?:xml-sax)$/; c=c+'x' when /^--(?:xml-dom)$/; c=c+'X' + when /^--(?:images)$/; c=c+'j' when /^--(?:hash-digests)$/; c=c+'N' when /^--(?:po4a|pot?)$/; c=c+'P' when /^--(?:termsheet)$/; c=c+'T' @@ -406,6 +407,13 @@ module SiSU_Commandline else '' end end + if cmd !~/j/ + extra+=if cmd =~/[bHhwXxyz]/ \ + and cmd !~/[j]/ + 'j' #% copy images + else '' + end + end if cmd !~/y/ extra+=if cmd =~/[abeHhIiNopsSstwXxz]/ \ and cmd !~/y/ @@ -435,10 +443,26 @@ module SiSU_Commandline : { bool: false } act[:rc]=if mod.inspect =~/"--rc=/ x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'') - { bool: true, inst: x } + { bool: true, inst: x } else { bool: false, inst: '' } end + act[:dump]=if mod.inspect =~/"--dump=/ + base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1') + { bool: true, inst: base_pth } + elsif mod.inspect =~/"--dump/ + { bool: true, inst: @base_path } + else + { bool: false, inst: nil } + end + act[:redirect]=if mod.inspect =~/"--redirect=/ + base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1') + { bool: true, inst: base_pth } + elsif mod.inspect =~/"--redirect/ + { bool: true, inst: @base_path } + else + { bool: false, inst: nil } + end act[:verbose]=(cmd =~/v/ \ || mod.inspect =~/"--verbose"/) \ ? { bool: true } @@ -478,6 +502,10 @@ module SiSU_Commandline || mod.inspect =~/"--concordance"/) \ ? { bool: true } : { bool: false } + act[:images]=(cmd =~/j/ \ + || mod.inspect =~/"--images"/) \ + ? { bool: true } + : { bool: false } act[:pdf]=(cmd =~/p/ \ || mod.inspect =~/"--pdf"/) \ ? { bool: true } -- cgit v1.2.3