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/html.rb | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'lib/sisu/v3dv/html.rb') diff --git a/lib/sisu/v3dv/html.rb b/lib/sisu/v3dv/html.rb index ec7b0573..75d89382 100644 --- a/lib/sisu/v3dv/html.rb +++ b/lib/sisu/v3dv/html.rb @@ -138,14 +138,10 @@ module SiSU_HTML def link_images @symlnk.images end - def directories - title=File.basename(@md.fns,'.rb') - end def tuned_file_instructions @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) @md.opt.cmd=@md.opt.cmd.gsub(/H/,'h') - @md.file_type='html' if @md.opt.cmd =~/[hon]/ - directories + @md.file_type='html' if @md.opt.cmd =~/[hw]/ newfilename=%{#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_segtoc}} if @md.file_type =~/html/ dal_array=@particulars.dal_array # dal file drawn here @tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet @@ -611,7 +607,8 @@ WOK class Output def initialize(data='',md='') @data,@md=data,md - @file=SiSU_Env::FileOp.new(@md) + @file=SiSU_Env::FileOp.new(md) + @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure end def scroll begin @@ -646,15 +643,17 @@ WOK rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure @filename_html_segtoc.close - unless FileTest.file?("#{@file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg_index}") - pwd_set=Dir.pwd - idx_lnk=@file.base_filename.html_segtoc - mlnk=@file.base_filename.html_seg_index - Dir.chdir(@file.output_path.html_seg.dir) - FileUtils::rm_f(mlnk) - FileUtils::ln_s(idx_lnk, mlnk) - Dir.chdir(pwd_set) + pwd_set=Dir.pwd + idx_lnk=if @o_str.dump_or_redirect? + @file.base_filename.manifest + else + @file.base_filename.html_segtoc end + mlnk=@file.base_filename.html_seg_index + Dir.chdir(@file.output_path.html_seg.dir) + FileUtils::rm_f(mlnk) + FileUtils::ln_s(idx_lnk,mlnk) + Dir.chdir(pwd_set) end end end -- cgit v1.2.3