diff options
Diffstat (limited to 'lib/sisu/v3/sysenv.rb')
-rw-r--r-- | lib/sisu/v3/sysenv.rb | 84 |
1 files changed, 63 insertions, 21 deletions
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 475a8369..7463cb4b 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -217,9 +217,10 @@ module SiSU_Env m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m stub_pwd=@@pwd[m,1] @@rc_path=["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] - @@yamlrc_path=(stub_pwd !~/^sisupod$/) \ - ? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]) - : ["#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] #security policy: prevent reading of sisurc.yml in sisupod + @@yamlrc_path=["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] + #@@yamlrc_path=(stub_pwd !~/^sisupod$/) \ + #? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]) + #: ["#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] #security policy: prevent reading of sisurc.yml in sisupod @@ad_path=(stub_pwd !~/^sisupod$/) \ ? (["#{@@pwd}/_sisu/skin/yml","#{@@home}/.sisu/skin/yml","#{@@sisu_etc}/skin/yml"]) : ["#{@@home}/.sisu",@@sisu_etc] @@ -381,9 +382,9 @@ module SiSU_Env @@fnb ||=@fns[m,2] @@fnt ||=@fns[m,3] @@flv ||=document_language_versions_found[:f] - unless @@fns =~/\S+?\.zip/ - @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' - elsif @@fnb; @@fnb + '.sst.zip' + unless @@fns =~/\S+?\.txz/ + @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.txz' + elsif @@fnb; @@fnb + '.sst.txz' else '' # e.g. termsheet end end @@ -2496,11 +2497,9 @@ WOK unless FileTest.directory?(sisupod_processing_path) mkdir_p(sisupod_processing_path) end - if FileTest.file?("#{Dir.pwd}/#{fns_pod}") - system("unzip -q #{Dir.pwd}/#{fns_pod} -d #{processing_path.processing}") - else - SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/ - end + (FileTest.file?(fns_pod)) \ + ? system("unzip -q #{fns_pod} -d #{processing_path.processing}") + : (SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/) sisupod_processing_path end end @@ -2563,10 +2562,14 @@ WOK end class Info_settings < Info_env def permission?(prog) #program defaults - (defined? @rc['permission_set'][prog]) ? @rc['permission_set'][prog] : false + (defined? @rc['permission_set'][prog]) \ + ? @rc['permission_set'][prog] + : false end def program?(prog) #program defaults - (defined? @rc['program_set'][prog]) ? @rc['program_set'][prog] : false + (defined? @rc['program_set'][prog]) \ + ? @rc['program_set'][prog] + : false end end class File_map < Info_env @@ -2731,7 +2734,7 @@ WOK def src # consider if @opt.fnb \ and not @opt.fnb.empty? - sm="#{@env.path.output}/pod/#{@opt.fns}.zip" + sm="#{@env.path.output}/src/pod/#{@opt.fns}.txz" rm(sm) if FileTest.file?(sm) sm="#{@env.path.output}/src/#{@opt.fns}" rm(sm) if FileTest.file?(sm) @@ -2853,7 +2856,7 @@ WOK remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/." src_txt=@opt.fnc - src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip') + src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.txz') if (local_gen =~/\S/ \ and local_gen !~/\/\//) \ and (remote_gen =~/\S/ \ @@ -2876,7 +2879,7 @@ WOK if FileTest.file?("#{local_src}/#{src_doc}") puts "#{local_src}/#{src_doc}* -> #{remote_src}" end - if FileTest.file?("#{local_pod}/#{src_doc}.zip") + if FileTest.file?("#{local_pod}/#{src_doc}.txz") puts "#{local_pod}/#{src_doc}* -> #{remote_pod}" end else @@ -3051,7 +3054,7 @@ WOK puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "#{local_gen} -> #{remote_gen}" if FileTest.file?("#{local_src}/#{src_doc}") \ - or FileTest.file?("#{local_src}/#{src_doc}.zip") + or FileTest.file?("#{local_src}/#{src_doc}.txz") puts "#{local_src}/#{src_doc}* -> #{remote_src}" end else @@ -4172,6 +4175,15 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + if @env.output_dir_structure.by_language_code? + '../../_sisu/image' + elsif @env.output_dir_structure.by_filetype? + '../_sisu/image' + else + '../_sisu/image' + end + end self end def html_seg @@ -4193,6 +4205,15 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + if @env.output_dir_structure.by_language_code? + '../../../_sisu/image' + elsif @env.output_dir_structure.by_filetype? + '../../_sisu/image' + else + '../_sisu/image' + end + end self end def html_concordance @@ -4218,6 +4239,15 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + if @env.output_dir_structure.by_language_code? + '../../_sisu/image' + elsif @env.output_dir_structure.by_filetype? + '../_sisu/image' + else + '../_sisu/image' + end + end self end def xhtml @@ -4239,6 +4269,9 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + '../../_sisu/image' + end self end def epub @@ -4260,6 +4293,9 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + './image' + end self end def odt @@ -4302,6 +4338,9 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + '../../_sisu/image' + end self end def xml_sax @@ -4783,10 +4822,13 @@ WOK skin_path=[] @env.sys.rc_path.each {|x| skin_path << "#{x}/skin"} skin_path << "#{@env.processing_path.processing}/external_document/skin" - skin=true - if @pwd_stub =~/^sisupod$/ \ - and @md.opt.mod.inspect !~/--trust/ - skin=false #security only run skins on sisupod if --trust flag is provided + skin=if @pwd_stub =~/^(?:doc|sisupod)$/ \ + and ((! @md.nil?) \ + && (defined? @md.opt) \ + && (defined? @md.opt.mod) \ + && @md.opt.mod.inspect =~/--trust/) + true #security only run skins on sisupod if --trust flag is provided + else false end doc_skin,dir_skin=nil,nil if skin |