From 8c67d466ead2096d713515c88fcee17c473ecde5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 19 Oct 2007 20:28:48 +0100 Subject: mostly paths for shared markup source (txt and pod), also... also current Debian/Sid ruby1.9 upgrade removes a bug, so a related test/warning in options.rb removed --- lib/sisu/v0/dal.rb | 16 +++++++------ lib/sisu/v0/embedded.rb | 45 ------------------------------------ lib/sisu/v0/help.rb | 2 +- lib/sisu/v0/manifest.rb | 26 ++++++++++++++------- lib/sisu/v0/options.rb | 9 +------- lib/sisu/v0/sisupod_make.rb | 6 ++--- lib/sisu/v0/sysenv.rb | 55 +++++++++++++++++++++++++++++++------------- lib/sisu/v0/texpdf_format.rb | 6 ++--- lib/sisu/v0/urls.rb | 12 +++++++--- 9 files changed, 83 insertions(+), 94 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 0b445832..47d3750d 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -364,15 +364,14 @@ module SiSU_DAL if para !~/^%+\s/ and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/ txt,cmd,source,url_dir,note,manifest=nil,nil,nil,nil,nil,nil - url_and_stub=SiSU_Env::Info_env.new.url - if defined? url_and_stub.remote - @output_url="#{url_and_stub.remote}" + @u=SiSU_Env::Info_env.new.url + if defined? @u.remote if para =~/(.+?)\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/m pre,txt,cmd,source,url_dir,note="#{$1.strip} ",$2,$3,$4,$5,$6 elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/ pre,txt,cmd,source,url_dir,note='',$1,$2,$3,$4,$5 end - manifest="#{pre}{#{txt} }#@output_url/#{url_dir}/toc.html#{note}\n\n" + manifest="#{pre}{#{txt} }#{@u.remote}/#{url_dir}/toc.html#{note}\n\n" else puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}" if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+~\{.+?\}~)?/ @@ -402,20 +401,23 @@ module SiSU_DAL end if describe tuned_file_tmp << if @output_url #to double space <:br> at beginning of entry - "     {#{describe} }#@output_url/#{url_dir}/#{o_f}" if describe + "     {#{describe} }#{@u.remote}/#{url_dir}/#{o_f}" else "     { #{describe} }../#{url_dir}/#{o_f}" end end end output_filetypes[:src].each do |o_f| - describe = case o_f + describe=case o_f when /#{source}\.zip/; ' markup source (zipped) pod' when /#{source}/; ' markup source text' else nil end if describe tuned_file_tmp << if @output_url - "     {#{describe} }#@output_url/src/#{o_f}" if describe + x=if describe =~/\.zip/ + "     {#{describe} }#{@u.src_pod}/#{o_f}" + else "     {#{describe} }#{@u.src_txt}/#{o_f}" + end else "     { #{describe} }../#{url_dir}/#{o_f}" end end diff --git a/lib/sisu/v0/embedded.rb b/lib/sisu/v0/embedded.rb index b5d33ac2..f03f0aab 100644 --- a/lib/sisu/v0/embedded.rb +++ b/lib/sisu/v0/embedded.rb @@ -133,48 +133,3 @@ module SiSU_Embedded end end __END__ -def images # alternative may be preferable as source taken from local destination, and not sent remotely unless found there - src="#{Dir.pwd}/_sisu/image" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" - rdest="#@rhost/#{@env.path.stub_pwd}/_sisu/image" - if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src) - File.mkpath(ldest) unless FileTest.directory?(ldest) - @md.ec[:image].each do |i| - SiSU_Env::System_call.new("#{src}/#{i}","#{ldest}/.",'q').rsync - #cp("#{src}/#{i}","#{ldest}/.") #use rysnc - if @md.cmd.inspect =~/R/ #rsync to remote image directory #ldest used as source, if not in local repo, don't share - SiSU_Env::System_call.new("#{ldest}/#{i}","#{rdest}/.",'q').rsync - end - end - end -end -def audio - #p @md.ec[:audio] - src="#{Dir.pwd}/_sisu/mm/audio" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio" - if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src) - File.mkpath(ldest) unless FileTest.directory?(ldest) - @md.ec[:audio].each do |i| - SiSU_Env::System_call.new("#{src}/#{i}","#{ldest}/.",'q').rsync - #cp("#{src}/#{i}","#{ldest}/.") #use rysnc - if @md.cmd.inspect =~/R/ - #rsync to remote audio directory - end - end - end -end -def multimedia - #p @md.ec[:multimedia] - src="#{Dir.pwd}/_sisu/mm/video" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video" - if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src) - File.mkpath(ldest) unless FileTest.directory?(ldest) - @md.ec[:multimedia].each do |i| - SiSU_Env::System_call.new("#{src}/#{i}","#{ldest}/.",'q').rsync - #cp("#{src}/#{i}","#{ldest}/.") #use rysnc - if @md.cmd.inspect =~/R/ - #rsync to remote multimedia directory - end - end - end -end diff --git a/lib/sisu/v0/help.rb b/lib/sisu/v0/help.rb index b5077fa1..84a7391d 100644 --- a/lib/sisu/v0/help.rb +++ b/lib/sisu/v0/help.rb @@ -67,7 +67,7 @@ module SiSU_Help fns='help_example_dummy_file_name.sst' @env=SiSU_Env::Info_env.new(fns) @db=SiSU_Env::Info_db.new - m=/.+\/(\S+)/m + m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m @output_stub=Dir.pwd[m,1] end def help_request diff --git a/lib/sisu/v0/manifest.rb b/lib/sisu/v0/manifest.rb index e0617fec..891d6f41 100644 --- a/lib/sisu/v0/manifest.rb +++ b/lib/sisu/v0/manifest.rb @@ -91,11 +91,8 @@ module SiSU_Manifest @md,@fns=md @env=SiSU_Env::Info_env.new(@md.fns) @fnb=@md.fnb - out=@env.path.output - @base_url="#{@env.url.root}/#@fnb" - @base_url_src="#{@env.url.root}/src" - @base_path="#{out}/#@fnb" - @base_path_src="#{out}/src" + @base_url,@base_url_src,@base_url_pod="#{@env.url.root}/#@fnb","#{@env.url.src_txt}","#{@env.url.src_pod}" + @base_path,@base_path_src,@base_path_pod="#{@env.path.output}/#@fnb","#{@env.path.output_src}","#{@env.path.output_pod}" @@dg ||=SiSU_Env::Info_env.new.digest.type @dg=@@dg l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns) @@ -129,6 +126,19 @@ module SiSU_Manifest @manifest[:html] << %{

#{id}

#{file}   #{dgst[1]}
#{@url_brace.xml_open}#@base_url_src/#{file}#{@url_brace.xml_close}

#{kb}

\n} if kb and kb =~/\d+/ end + def summarize_pod(id,file) + sys=SiSU_Env::System_call.new + dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{@base_path_pod}/#{file}") + else sys.md5("#{@base_path_pod}/#{file}") + end + tell=SiSU_Screen::Ansi.new(@md.cmd,"#{dgst[1]} #{file}") + tell.warn if @md.cmd =~/[vVM]/ + size=(File.size("#{@base_path_pod}/#{file}")/1024.00).to_s + kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] + @manifest[:txt] << "#{file} #{id} #{kb}\n" + @manifest[:html] << %{

#{id}

#{file}   #{dgst[1]}
#{@url_brace.xml_open}#@base_url_pod/#{file}#{@url_brace.xml_close}

#{kb}

+ \n} if kb and kb =~/\d+/ + end def languages(id,file) flv=@env.published_manifests?(@base_path) @manifest[:html] << %{