From e48ecd9e08346fed36599e67701a59bb05ec9118 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 28 May 2012 05:51:48 -0400 Subject: sha256 (3.2.10) --- data/doc/sisu/CHANGELOG_v3 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 0dce0ec0..934a0bef 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -17,9 +17,9 @@ v3 branch once stable will supersede & replace current stable v2 branch http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.10 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.10-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.10.orig.tar.xz - sisu_3.2.10.orig.tar.xz - sisu_3.2.10-1.dsc - sisu_3.2.10-1.debian.tar.gz + d09ce78ca03342efd66b19623ed5275ef6e59caa47027540a7b9da1cf7eda834 1687428 sisu_3.2.10.orig.tar.xz + 1d17dea47e3be8b82edd4f1d92c7c0de51d115c784005fcf3ddc8df7cea047fc 1389 sisu_3.2.10-1.dsc + 696bba112c638be0af185f1b185709c7a57822d75e31b7aa4cd22321bf786be3 296725 sisu_3.2.10-1.debian.tar.gz * v3: hub * "requires", fix -- cgit v1.2.3 From c3a4d655a1ce53c79efabdaf89d3d1f629327575 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 3 Jun 2012 14:12:05 -0400 Subject: v3: 3.2.11 version & changelog "opened" --- data/doc/sisu/CHANGELOG_v3 | 8 ++++++++ data/sisu/v3/v/version.yml | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 934a0bef..1f00bbc6 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -13,6 +13,14 @@ Reverse Chronological: %% Development branch UNSTABLE v3 branch once stable will supersede & replace current stable v2 branch +%% 3.2.11.orig.tar.xz (2012-06-03:22/7) +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.11 +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.11-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.11.orig.tar.xz + sisu_3.2.11.orig.tar.xz + sisu_3.2.11-1.dsc + sisu_3.2.11-1.debian.tar.gz + %% 3.2.10.orig.tar.xz (2012-05-28:22/1) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.10 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.10-1 diff --git a/data/sisu/v3/v/version.yml b/data/sisu/v3/v/version.yml index bfbcd100..e6a783cd 100644 --- a/data/sisu/v3/v/version.yml +++ b/data/sisu/v3/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 3.2.10 -:date_stamp: 2012w22/1 -:date: "2012-05-28" +:version: 3.2.11 +:date_stamp: 2012w22/7 +:date: "2012-06-03" :project: SiSU -- cgit v1.2.3 From 2cd635d524721efaf5cf170b7bde79c1e910b096 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 3 Jun 2012 14:20:18 -0400 Subject: v3: error & warning messages touched, revisit --- data/doc/sisu/CHANGELOG_v3 | 2 ++ lib/sisu/v3/cgi_pgsql.rb | 2 +- lib/sisu/v3/composite.rb | 4 +-- lib/sisu/v3/dal_hash_digest.rb | 2 +- lib/sisu/v3/dal_images.rb | 6 ++-- lib/sisu/v3/db_import.rb | 16 +++++++--- lib/sisu/v3/digests.rb | 5 ++- lib/sisu/v3/embedded.rb | 5 ++- lib/sisu/v3/epub_concordance.rb | 4 +-- lib/sisu/v3/html_promo.rb | 2 +- lib/sisu/v3/param.rb | 24 +++++++------- lib/sisu/v3/plaintext.rb | 5 ++- lib/sisu/v3/rexml.rb | 5 ++- lib/sisu/v3/screen_text_color.rb | 6 ++-- lib/sisu/v3/share_src.rb | 2 +- lib/sisu/v3/shared_sem.rb | 3 +- lib/sisu/v3/sitemaps.rb | 5 ++- lib/sisu/v3/sst_do_inline_footnotes.rb | 12 +++++-- lib/sisu/v3/sst_to_s_xml_sax.rb | 12 +++++-- lib/sisu/v3/sysenv.rb | 58 +++++++++++++++++----------------- lib/sisu/v3/texpdf.rb | 2 +- lib/sisu/v3/update.rb | 5 ++- lib/sisu/v3/webrick.rb | 9 ++++-- lib/sisu/v3/wikispeak.rb | 5 ++- 24 files changed, 124 insertions(+), 77 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 1f00bbc6..358c0f2f 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.11.orig.tar.xz sisu_3.2.11-1.dsc sisu_3.2.11-1.debian.tar.gz +* v3: error & warning messages touched, revisit + %% 3.2.10.orig.tar.xz (2012-05-28:22/1) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.2.10 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.2.10-1 diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb index bcc854aa..f78f65f5 100644 --- a/lib/sisu/v3/cgi_pgsql.rb +++ b/lib/sisu/v3/cgi_pgsql.rb @@ -79,7 +79,7 @@ module SiSU_CGI_PgSQL available_db.flatten.each do |x| serve << x.gsub(/#{Db[:name_prefix]}(\S+)/,'\1') end - else put "WARNING: no postgresql database available, (have you created one?)" + else STDERR.puts "WARNING: no postgresql database available, (have you created one?)" end serve=serve.sort f1,f2,f3='','','' diff --git a/lib/sisu/v3/composite.rb b/lib/sisu/v3/composite.rb index a104d281..90ec28dc 100644 --- a/lib/sisu/v3/composite.rb +++ b/lib/sisu/v3/composite.rb @@ -217,7 +217,7 @@ module SiSU_Assemble file[:prepared] else cX=SiSU_Screen::Ansi.new(@opt.cmd).cX - puts "\t #{cX.fuschia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuschia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}" + STDERR.puts "\t #{cX.fuschia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuschia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}" para end else tuned_file << para @@ -268,7 +268,7 @@ module SiSU_Assemble @ssm << loadfile else cX=SiSU_Screen::Ansi.new(@opt.cmd).cX - puts "\t #{cX.fuschia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuschia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}" + STDERR.puts "\t #{cX.fuschia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuschia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}" para end end diff --git a/lib/sisu/v3/dal_hash_digest.rb b/lib/sisu/v3/dal_hash_digest.rb index 039dc537..c30048db 100644 --- a/lib/sisu/v3/dal_hash_digest.rb +++ b/lib/sisu/v3/dal_hash_digest.rb @@ -108,7 +108,7 @@ module SiSU_DAL_Hash Digest::MD5.hexdigest(stripped_en) end t_o_txt + en_open + en_txt + Mx[:id_o] + digest_en_strip + Mx[:id_c] + en_close - else puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up + else STDERR.puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up end else en_plus end diff --git a/lib/sisu/v3/dal_images.rb b/lib/sisu/v3/dal_images.rb index e112636f..9c6dd872 100644 --- a/lib/sisu/v3/dal_images.rb +++ b/lib/sisu/v3/dal_images.rb @@ -75,7 +75,7 @@ module SiSU_DAL_Images end else if @md.opt.cmd =~/[vVM]/ - SiSU_Screen::Ansi.new(@md.opt.cmd,'use of RMagick is not enabled in sisurc.yml').warn + SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* use of RMagick is not enabled in sisurc.yml').warn end end data.each do |dob| @@ -101,7 +101,7 @@ module SiSU_DAL_Images img_col,img_row=img.columns,img.rows else if @md.opt.cmd =~/[vVM]/ - SiSU_Screen::Ansi.new(@md.opt.cmd,'RMagick not present, will attempt to use imagemagick (identify) directly').warn + SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* RMagick not present, will attempt to use imagemagick (identify) directly').warn end imgk=SiSU_Env::SystemCall.new.imagemagick gmgk=SiSU_Env::SystemCall.new.graphicksmagick @@ -138,7 +138,7 @@ module SiSU_DAL_Images end else images=dob.obj.scan(m) do |image| - SiSU_Screen::Ansi.new(@md.opt.cmd,'where image dimensions have not been provided RMagick or imagemagick is required',image).warn #unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image).warn #unless @opt.cmd =~/q/ end end end diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb index 5cb12cde..03f5d221 100644 --- a/lib/sisu/v3/db_import.rb +++ b/lib/sisu/v3/db_import.rb @@ -164,9 +164,9 @@ module SiSU_DbImport @conn.do("COMMIT") end rescue DBI::DatabaseError => e - puts "Error code: #{e.err}" - puts "Error message: #{e.errstr}" - puts "Error SQLSTATE: #{e.state}" + STDERR.puts "Error code: #{e.err}" + STDERR.puts "Error message: #{e.errstr}" + STDERR.puts "Error SQLSTATE: #{e.state}" SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do __LINE__.to_s + ':' + __FILE__ end @@ -554,7 +554,10 @@ module SiSU_DbImport end end end - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end @tuple_array @@ -686,7 +689,10 @@ module SiSU_DbImport end t=SiSU_DbTuple::LoadUrls.new(@conn,f,u,@@id_t,@opt,@file_maint) tuple=t.tuple - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end tuple diff --git a/lib/sisu/v3/digests.rb b/lib/sisu/v3/digests.rb index 169f9d2b..5ffabb58 100644 --- a/lib/sisu/v3/digests.rb +++ b/lib/sisu/v3/digests.rb @@ -84,7 +84,10 @@ module SiSU_DigestView end SiSU_DigestView::Source::Scroll.new(@particulars).songsheet SiSU_Env::InfoSkin.new(@md).select - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/embedded.rb b/lib/sisu/v3/embedded.rb index 861bdd08..87b37fc0 100644 --- a/lib/sisu/v3/embedded.rb +++ b/lib/sisu/v3/embedded.rb @@ -77,7 +77,10 @@ module SiSU_Embedded audio multimedia begin - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb index 8a4d4136..df975a48 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v3/epub_concordance.rb @@ -78,10 +78,10 @@ module SiSU_EPUB_Concordance if @md.wc_words < wordmax SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet else - SiSU_Screen::Ansi.new(@md.opt.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.cmd =~/q/ end else - SiSU_Screen::Ansi.new(@md.opt.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/ SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet end rescue diff --git a/lib/sisu/v3/html_promo.rb b/lib/sisu/v3/html_promo.rb index 9e5040c4..a2edea47 100644 --- a/lib/sisu/v3/html_promo.rb +++ b/lib/sisu/v3/html_promo.rb @@ -415,7 +415,7 @@ WOK end end else - SiSU_Screen::Ansi.new(@md.opt.cmd,"category not found: #{category}").warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* category not found: #{category}").warn unless @md.opt.cmd =~/q/ end adverts.join end diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index f1c4aa3a..78e42bd4 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -170,10 +170,10 @@ module SiSU_Param s elsif s.class==NilClass; nil elsif s.class !=String - puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" + STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" s else - SiSU_Screen::Ansi.new('v',"#{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.cmd =~/q/ nil end end @@ -197,11 +197,11 @@ module SiSU_Param end b.delete_at(0) b.each do |d| - k,c=nil - k,c=/^(\S+)\s+(.*)/.match(d)[1,2] if d - @name_a_h[i][:hon]=c.strip if k=='hon' - @name_a_h[i][:affiliation]=c.strip if k=='affiliation' - @name_a_h[i][:nationality]=c.strip if k=='nationality' + k,c=nil + k,c=/^(\S+)\s+(.*)/.match(d)[1,2] if d + @name_a_h[i][:hon]=c.strip if k=='hon' + @name_a_h[i][:affiliation]=c.strip if k=='affiliation' + @name_a_h[i][:nationality]=c.strip if k=='nationality' end end l=@name_a_h.length @@ -1179,7 +1179,7 @@ module SiSU_Param if ok tell.txt_green if @opt.cmd =~/[vVM]/ else - SiSU_Screen::Ansi.new(@opt.cmd,"Warning: markup version determined (#{@markup_version.determined}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})").warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,"WARNING: markup version determined (#{@markup_version.determined}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})").warn unless @opt.cmd =~/q/ end else SiSU_Screen::Ansi.new(@opt.cmd,'No SiSU markup version provided').warn if @opt.cmd =~/[VM]/ @@ -1518,13 +1518,13 @@ module SiSU_Param if @en[:note] > 0 \ and @en[:sum] > 0 if @en[:sum] > 0 - else SiSU_Screen::Ansi.new(@opt.cmd,'both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @opt.cmd !~/q/ + else SiSU_Screen::Ansi.new(@opt.cmd,'*WARN* both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @opt.cmd !~/q/ end end if @en[:mark] != @en[:note] \ and @en[:note] > 0 @en[:mismatch]=@en[:note] - @en[:mark] - SiSU_Screen::Ansi.new(@opt.cmd,'endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @opt.cmd !~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'*WARN* endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @opt.cmd !~/q/ footnote_conversion_errors=File.new("#{Dir.pwd}/footnote_conversion_errors.txt",'a') footnote_conversion_errors << "#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})\n" end @@ -1535,7 +1535,7 @@ module SiSU_Param and @opt.inspect =~/P/ #@title=Md.new('Text Insert',@opt,@env).title else - SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Title missing','please provide @title:').warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'WARNING: Document Title missing','please provide @title:').warn unless @opt.cmd =~/q/ end end if @author !~/[\S]/ @@ -1543,7 +1543,7 @@ module SiSU_Param and @opt.inspect =~/P/ #@creator=SiSU_Param::Md.new('Text Insert',@opt,@env).creator else - SiSU_Screen::Ansi.new(@opt.cmd,'Warning Document Author missing','please provide @creator: :author:').warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,'WARNING: Document Author missing','please provide @creator: :author:').warn unless @opt.cmd =~/q/ end end @struct={} diff --git a/lib/sisu/v3/plaintext.rb b/lib/sisu/v3/plaintext.rb index fa87da6d..2fa98883 100644 --- a/lib/sisu/v3/plaintext.rb +++ b/lib/sisu/v3/plaintext.rb @@ -102,7 +102,10 @@ module SiSU_Plaintext #wrap_width=(defined? md.make.plaintext_wrap) ? md.make.plaintext_wrap : 78 SiSU_Plaintext::Source::Scroll.new(dal_array,md,wrap_width).songsheet SiSU_Env::InfoSkin.new(md).select #watch - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/rexml.rb b/lib/sisu/v3/rexml.rb index 34a2acd9..886d7eab 100644 --- a/lib/sisu/v3/rexml.rb +++ b/lib/sisu/v3/rexml.rb @@ -101,7 +101,10 @@ module SiSU_Rexml SiSU_Screen::Ansi.new(@md.opt.cmd,'fuschia',"File Not Found #{xmlfile}",'requested XML processing skipped').colorize unless @md.opt.cmd =~/q/ exit end - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/screen_text_color.rb b/lib/sisu/v3/screen_text_color.rb index 073fbf37..67022087 100644 --- a/lib/sisu/v3/screen_text_color.rb +++ b/lib/sisu/v3/screen_text_color.rb @@ -208,13 +208,13 @@ module SiSU_Screen STDERR.puts %{\t #{@cX.orange}Rescued#{@cX.off} #{@cX.grey}#{yield if block_given?}\n\t An#{@cX.off} #{@cX.fuschia}ERROR#{@cX.off} #{@cX.grey}occurred, message:#{@cX.off} #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.brown}#{@txt[2]}#{@cX.off}} end def warn - puts "\t #{@cX.brown}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}" + STDERR.puts "\t #{@cX.brown}#{@txt[0]}#{@cX.off} #{@cX.grey}#{@txt[1]}#{@cX.off}" end def error - puts "\t #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.brown}#{@txt[1]}#{@cX.off}" + STDERR.puts "\t #{@cX.fuschia}#{@txt[0]}#{@cX.off} #{@cX.brown}#{@txt[1]}#{@cX.off}" end def error2 - puts "\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.fuschia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" + STDERR.puts "\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.fuschia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" end def version puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}]) &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[4]})#{@cX.off}\n" diff --git a/lib/sisu/v3/share_src.rb b/lib/sisu/v3/share_src.rb index bb4d2a56..ac466d33 100644 --- a/lib/sisu/v3/share_src.rb +++ b/lib/sisu/v3/share_src.rb @@ -85,7 +85,7 @@ module SiSU_Markup end end else - SiSU_Screen::Ansi.new(@opt.cmd,"Output directory does not exist","#{@opt.fns} -> #{@file.output_path.src.dir}").warn if @opt.cmd =~/[MVv]/ + SiSU_Screen::Ansi.new(@opt.cmd,"*WARN* Output directory does not exist","#{@opt.fns} -> #{@file.output_path.src.dir}").warn if @opt.cmd =~/[MVv]/ exit end end diff --git a/lib/sisu/v3/shared_sem.rb b/lib/sisu/v3/shared_sem.rb index 98c8483b..bd906efc 100644 --- a/lib/sisu/v3/shared_sem.rb +++ b/lib/sisu/v3/shared_sem.rb @@ -136,7 +136,8 @@ module SiSU_Sem def sem_marker_added_extra_parts unless @para =~ rgx.exclude @para.gsub!(rgx.whole_csc_ae,'') - if @para =~rgx.each_csc_ae; puts "WARNING semantic taggin error: #{@para}" + if @para =~rgx.each_csc_ae + STDERR.puts "WARNING semantic tagging error: #{@para}" end end @para diff --git a/lib/sisu/v3/sitemaps.rb b/lib/sisu/v3/sitemaps.rb index fa06a688..86a8e2fb 100644 --- a/lib/sisu/v3/sitemaps.rb +++ b/lib/sisu/v3/sitemaps.rb @@ -89,7 +89,10 @@ module SiSU_Sitemaps output_idx(sitemap_index) SiSU_Screen::Ansi.new(@opt.cmd,"sitemap index:","#{@env.path.output}/#{@sitemap_idx_fn}").result unless @opt.cmd =~/q/ end - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/sst_do_inline_footnotes.rb b/lib/sisu/v3/sst_do_inline_footnotes.rb index 389871fc..ab9fbbce 100644 --- a/lib/sisu/v3/sst_do_inline_footnotes.rb +++ b/lib/sisu/v3/sst_do_inline_footnotes.rb @@ -93,7 +93,10 @@ module SiSU_ConvertFootnotes @@dal_array=[] @@fns=@opt.fns create_dal - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure Instantiate.new end @@ -108,7 +111,10 @@ module SiSU_ConvertFootnotes dal=if @@dal_array.empty?; read_fnm else @@dal_array.dup #check end - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure Instantiate.new end @@ -134,7 +140,7 @@ module SiSU_ConvertFootnotes dal.each {|s| dal_array << "#{s.strip}\n\n" unless s.strip.empty?} dal_array else - SiSU_Screen::Ansi.new(@md.opt.cmd,'no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn if @cmd !~/q/ + SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn if @cmd !~/q/ '' end end diff --git a/lib/sisu/v3/sst_to_s_xml_sax.rb b/lib/sisu/v3/sst_to_s_xml_sax.rb index ff9493b4..20f68aca 100644 --- a/lib/sisu/v3/sst_to_s_xml_sax.rb +++ b/lib/sisu/v3/sst_to_s_xml_sax.rb @@ -100,7 +100,10 @@ module SiSU_SimpleXML_ModelSax else @@fns_array.dup #check end SiSU_SimpleXML_ModelSax::Convert::Songsheet.new(@fns_array,@particulars).songsheet - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure #file closed in songsheet end end @@ -108,7 +111,7 @@ module SiSU_SimpleXML_ModelSax dal=[] if FileTest.file?("#{Dir.pwd}/#{@opt.fns}") dal=IO.readlines("#{Dir.pwd}/#{@opt.fns}","\n\n") - else puts 'Error' + else STDERR.puts 'Error' end end private @@ -121,7 +124,10 @@ module SiSU_SimpleXML_ModelSax SiSU_SimpleXML_ModelSax::Convert::Scroll.new(@data,@particulars).songsheet SiSU_SimpleXML_ModelSax::Convert::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@md.fn[:sxs]).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index acc38507..977fd3fe 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -264,8 +264,8 @@ module SiSU_Env require @prog else @mandatory \ - ? (SiSU_Screen::Ansi.new(@cmd,"module required: #{@prog}").warn) - : (SiSU_Screen::Ansi.new(@cmd,"#{@prog} load requested").warn) + ? (SiSU_Screen::Ansi.new(@cmd,"*WARN* module required: #{@prog}").warn) + : (SiSU_Screen::Ansi.new(@cmd,"*WARN* #{@prog} load requested").warn) end load_prog end @@ -300,7 +300,7 @@ module SiSU_Env @yamlrc_path.each do |v| if @@noyaml \ or FileTest.exist?("#{v}/noyaml") - puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml + STDERR.puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml @@noyaml=true break else @@ -657,7 +657,7 @@ module SiSU_Env program='rcs' program_ref="\n\t\tdocument version information requested" if program_found?(program); true - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -665,7 +665,7 @@ module SiSU_Env program='cvs' program_ref="\n\t\tdocument version information requested" if program_found?(program); true - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -673,7 +673,7 @@ module SiSU_Env program='openssl' program_ref="\n\t\tused to generate requested source document identification digest" if program_found?(program); true - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -686,7 +686,7 @@ module SiSU_Env dgst=%x{openssl dgst -md5 #{File.basename(filename)}}.strip #use file name without file path Dir.chdir(pwd) dgst.scan(/\S+/) - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -699,7 +699,7 @@ module SiSU_Env dgst=%x{openssl dgst -sha256 #{File.basename(filename)}}.strip #use file name without file path Dir.chdir(pwd) dgst.scan(/\S+/) - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -707,7 +707,7 @@ module SiSU_Env program='psql' program_ref="\n\t\tpsql requested" if program_found?(program); true - else puts "\tWARN: #{program} is not installed #{program_ref}" #if @cmd =~/v/ + else STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" #if @cmd =~/v/ false end end @@ -722,14 +722,14 @@ module SiSU_Env program_ref="\n\t\tcreatedb dbname #{db_name} #for postgresql database creation" (program_found?(program)) \ ? system("#{program} #{dbname_name}") - : (puts "\tWARN: #{program} is not available #{program_ref}") + : (STDERR.puts "\t*WARN* #{program} is not available #{program_ref}") end def relaxng(cmd='') #trang - convert between different schema languages for XML program='trang' program_ref="\n\t\tsee " (program_found?(program)) \ ? system("#{program} #{@input} #{@output}") - : (puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/) + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) end def qrencode #qrcode - for generating QR code program='qrencode' @@ -739,21 +739,21 @@ module SiSU_Env ? (system(%{ echo "#{@input}" | #{program} -s 3 -o #{@output} })) - : (puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/) + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" if cmd =~/V/) #found end def imagemagick #imagemagick is a image manipulation program program='identify' program_ref="\n\t\tsee " found=(program_found?(program)) ? true : false - puts "\tWARN: #{program} is not installed #{program_ref}" unless found + STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found found end def graphicksmagick #graphicsmagick is a image manipulation program program='gm' program_ref="\n\t\tsee " found=(program_found?(program)) ? true : false - puts "\tWARN: #{program} is not installed #{program_ref}" unless found + STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}" unless found found end def well_formed? #tidy - check for well formed xml xhtml etc. @@ -761,7 +761,7 @@ module SiSU_Env program_ref="\n\t\tsee " (program_found?(program)) \ ? system("#{@prog.tidy} -xml #{@input} > #{@output}") - : (puts "\tWARN: #{program} is not installed #{program_ref}") + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") end def tex2pdf_engine prog=['xetex','xelatex','pdflatex','pdfetex','pdftex'] @@ -799,7 +799,7 @@ module SiSU_Env when /pdflatex/; "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n" end system(texpdf_cmd) - else puts "\tWARN: none of the following programs are installed: #{program[0]}, #{program[1]}, #{program[2]} is installed. #{program_ref}" + else STDERR.puts "\t*WARN* none of the following programs are installed: #{program[0]}, #{program[1]}, #{program[2]} is installed. #{program_ref}" end end def makeinfo #texinfo @@ -808,7 +808,7 @@ module SiSU_Env program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/" (program_found?(program)) \ ? system("#{program} #{options} #{@input}\n") - : (puts "\tWARN: #{program} is not installed #{program_ref}") + : (STDERR.puts "\t*WARN* #{program} is not installed #{program_ref}") end def scp program='scp' @@ -816,7 +816,7 @@ module SiSU_Env puts "scp disabled" #(program_found?(program)) \ #? system("scp -Cr #{@input} #{@output}") \ - #: (puts "\tWARN: #{program} not found" ) + #: (STDERR.puts "\t*WARN* #{program} not found" ) end def rsync(action='',chdir=nil) program='rsync' @@ -840,7 +840,7 @@ module SiSU_Env #{rsync_cmd} #{msg} ") dir_return - else puts "\tWARN: #{program} not found" + else STDERR.puts "\t*WARN* #{program} not found" end end def rm @@ -848,7 +848,7 @@ module SiSU_Env elsif @cmd =~/V/; FileUtils::rm(@input) elsif @cmd !~/q/; FileUtils::rm(@input) elsif @cmd =~/q/; FileUtils::rm(@input) - else puts "\tWARN: operation ignored" + else STDERR.puts "\t*WARN* operation ignored" end end end @@ -2694,7 +2694,7 @@ WOK end #system(tree) #enable if (/[vVM]/) else - SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/ + SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/ end sisupod_processing_path end @@ -2710,7 +2710,7 @@ WOK 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/) + : (SiSU_Screen::Ansi.new('',"*WARN* file not found: #{fns_pod}").warn unless @cmd=~/q/) sisupod_processing_path end end @@ -3445,12 +3445,12 @@ WOK def make_file(path,filename) (File.writable?("#{path}/.")) \ ? File.new("#{path}/#{filename}",'w+') - : (SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn) + : (SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn) end def touch_file(path,filename) if File.writable?("#{path}/."); FileUtils::touch("#{path}/#{filename}") - else SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn + else SiSU_Screen::Ansi.new('',"*WARN* is the file or directory writable?, could not create #{filename}").warn end end def make_path(path) @@ -4276,10 +4276,10 @@ WOK self end def pdf_p - puts 'ERROR not available due to multiple page format sizes' + STDERR.puts 'ERROR not available due to multiple page format sizes' end def pdf_l - puts 'ERROR not available due to multiple page format sizes' + STDERR.puts 'ERROR not available due to multiple page format sizes' end def xhtml def dir @@ -5886,7 +5886,7 @@ WOK FileUtils::chmod(0644,"#{dest_path}/#{i}") end FileUtils::cd(@pwd) - else puts "\tWARN, did not find - #{src_path}" + else STDERR.puts %{\t*WARN* did not find - #{src_path} [#{__FILE__}:#{__LINE__}]} end end def cp_local_images @@ -5921,7 +5921,7 @@ WOK css_path=['/etc/sisu/css',"#{@home}/.sisu/css","#{@pwd}/_sisu/css"] #BROKEN if defined? @rc['permission_set']['css_modify'] \ and @rc['permission_set']['css_modify'] - SiSU_Screen::Ansi.new(@cmd,"modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/ + SiSU_Screen::Ansi.new(@cmd,"*WARN* modify is css set to: #{@rc['permission_set']['css_modify']}").warn if @cmd=~/[MV]/ css_path.each do |x| if FileTest.directory?(x) FileUtils::cd(x) @@ -5932,7 +5932,7 @@ WOK FileUtils::cd(@pwd) end end - else SiSU_Screen::Ansi.new(@cmd,"modify css is not set or is set to: false").warn if @cmd=~/[MV]/ + else SiSU_Screen::Ansi.new(@cmd,"*WARN* modify css is not set or is set to: false").warn if @cmd=~/[MV]/ end fn_css=SiSU_Env::CSS_Default.new css=SiSU_Style::CSS.new diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 14755300..4c224b22 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -262,7 +262,7 @@ module SiSU_TeX Dir.chdir(pwd_set) end else - SiSU_Screen::Ansi.new(@md.opt.cmd,"FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn + SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn end lst=Dir["*.{aux,log,out}"] lst.each {|file| File.unlink(file)} if lst diff --git a/lib/sisu/v3/update.rb b/lib/sisu/v3/update.rb index 9ba67e75..4630d640 100644 --- a/lib/sisu/v3/update.rb +++ b/lib/sisu/v3/update.rb @@ -71,7 +71,10 @@ module SiSU_UpdateControlFlag base_path="#{out}/#{@md.fnb}" SiSU_Screen::Ansi.new(@md.opt.cmd,'Checking previous output',base_path).green_hi_blue unless @md.opt.cmd =~/q/ SetCF.new(@md).set_flags - rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end diff --git a/lib/sisu/v3/webrick.rb b/lib/sisu/v3/webrick.rb index ea0a494f..f8189bba 100644 --- a/lib/sisu/v3/webrick.rb +++ b/lib/sisu/v3/webrick.rb @@ -74,7 +74,10 @@ def brick(port,get='') s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, { FancyIndexing: true }) trap("INT"){ s.shutdown } s.start - rescue; SiSU_Errors::InfoError.new($!,$@,'-W',nil).error #fix + rescue + SiSU_Errors::InfoError.new($!,$@,'-W',nil).error do #fix + __LINE__.to_s + ':' + __FILE__ + end ensure end end @@ -167,7 +170,9 @@ WOK brick(@port,get) rescue; require_relative 'sysenv' # sysenv.rb - SiSU_Errors::InfoError.new($!,$@,'-W',nil).error #fix + SiSU_Errors::InfoError.new($!,$@,'-W',nil).error do #fix + __LINE__.to_s + ':' + __FILE__ + end ensure end __END__ diff --git a/lib/sisu/v3/wikispeak.rb b/lib/sisu/v3/wikispeak.rb index bde2527e..725be0a5 100644 --- a/lib/sisu/v3/wikispeak.rb +++ b/lib/sisu/v3/wikispeak.rb @@ -85,7 +85,10 @@ module SiSU_Wikispeak @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here SiSU_Wikispeak::Source::Scroll.new(@dal_array,@md).songsheet SiSU_Env::InfoSkin.new(@md).select #watch - rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error + rescue + SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do + __LINE__.to_s + ':' + __FILE__ + end ensure end end -- cgit v1.2.3 From 33417c59a25d9c68698d319d298da1fecaec1673 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 3 Jun 2012 14:28:19 -0400 Subject: v3: warn when files to be copied not found, add --- data/doc/sisu/CHANGELOG_v3 | 2 ++ lib/sisu/v3/conf.rb | 21 +++++++++++++++------ lib/sisu/v3/odf.rb | 10 ++++++++-- lib/sisu/v3/share_src.rb | 11 ++++++++--- lib/sisu/v3/shared_images.rb | 31 +++++++++++++++++-------------- lib/sisu/v3/sisupod_make.rb | 13 ++++++++++--- lib/sisu/v3/sysenv.rb | 17 +++++++++++++---- 7 files changed, 73 insertions(+), 32 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 358c0f2f..555be6c0 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.11.orig.tar.xz sisu_3.2.11-1.dsc sisu_3.2.11-1.debian.tar.gz +* v3: warn when files to be copied not found, add + * v3: error & warning messages touched, revisit %% 3.2.10.orig.tar.xz (2012-05-28:22/1) diff --git a/lib/sisu/v3/conf.rb b/lib/sisu/v3/conf.rb index 51aeb005..8a323ac4 100644 --- a/lib/sisu/v3/conf.rb +++ b/lib/sisu/v3/conf.rb @@ -172,8 +172,11 @@ module SiSU_Initialize schema=SiSU_Env::SystemCall.new(rnc_src,rng_file) schema.relaxng(@opt.cmd) #rnc - FileUtils::cp(rnc_src,rnc_file) - FileUtils::chmod(0644,rnc_file) + if FileTest.file?(rnc_src) + FileUtils::cp(rnc_src,rnc_file) + FileUtils::chmod(0644,rnc_file) + else STDERR.puts %{\t*WARN* did not find rnc - "#{rnc_src}" [#{__FILE__}:#{__LINE__}]} + end end def trang_rnc_model_output_dom s=@suffix @@ -191,8 +194,11 @@ module SiSU_Initialize schema=SiSU_Env::SystemCall.new(rnc_src,rng_file) schema.relaxng(@opt.cmd) #rnc - FileUtils::cp(rnc_src,rnc_file) - FileUtils::chmod(0644,rnc_file) + if FileTest.file?(rnc_src) + FileUtils::cp(rnc_src,rnc_file) + FileUtils::chmod(0644,rnc_file) + else STDERR.puts %{\t*WARN* did not find rnc - "#{rnc_src}" [#{__FILE__}:#{__LINE__}]} + end end def trang_rnc_model_output_xhtml s=@suffix @@ -210,8 +216,11 @@ module SiSU_Initialize schema=SiSU_Env::SystemCall.new(rnc_src,rng_file) schema.relaxng(@opt.cmd) #rnc - FileUtils::cp(rnc_src,rnc_file) - FileUtils::chmod(0644,rnc_file) + if FileTest.file?(rnc_src) + FileUtils::cp(rnc_src,rnc_file) + FileUtils::chmod(0644,rnc_file) + else STDERR.puts %{\t*WARN* did not find rnc - "#{rnc_src}" [#{__FILE__}:#{__LINE__}]} + end end def trang_rnc_model_input_sax rnc_file=@env.processing_path.dal + '/sax.rnc' diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index c7b60bb5..57994a28 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -215,7 +215,10 @@ module SiSU_ODF image_source=image_src(i) pwd=Dir.pwd if image_source - FileUtils::cp("#{image_source}/#{i}","#{@env.processing_path.odt}/Pictures/#{i}") + if FileTest.file?("#{image_source}/#{i}") + FileUtils::cp("#{image_source}/#{i}","#{@env.processing_path.odt}/Pictures/#{i}") + else STDERR.puts %{\t*WARN* did not find image - "#{image_source}/#{i}" [#{__FILE__}:#{__LINE__}]} + end end img=if i.to_s =~/jpg|png|gif/ \ and h.to_s =~/\d/ \ @@ -522,7 +525,10 @@ module SiSU_ODF fix=[] bullet=image_src('bullet_09.png') if bullet - FileUtils::cp("#{bullet}/bullet_09.png","#{@env.processing_path.odt}/Pictures/.") + if FileTest.file?("#{bullet}/bullet_09.png") + FileUtils::cp("#{bullet}/bullet_09.png","#{@env.processing_path.odt}/Pictures/.") + else STDERR.puts %{\t*WARN* did not find image - "#{bullet}/bullet_09.png" [#{__FILE__}:#{__LINE__}]} + end end odf_metadata data.each do |dob| diff --git a/lib/sisu/v3/share_src.rb b/lib/sisu/v3/share_src.rb index ac466d33..c4900f5f 100644 --- a/lib/sisu/v3/share_src.rb +++ b/lib/sisu/v3/share_src.rb @@ -76,12 +76,17 @@ module SiSU_Markup end FileUtils::mkdir_p(@file.output_path.src.dir) unless FileTest.directory?(@file.output_path.src.dir) if FileTest.directory?(@file.output_path.src.dir) - unless @opt.fns =~/\.ssm$/; FileUtils::cp(@opt.fns,@file.output_path.src.dir) + unless @opt.fns =~/\.ssm$/ + if FileTest.file?(@opt.fns) + FileUtils::cp(@opt.fns,@file.output_path.src.dir) + else STDERR.puts %{\t*WARN* did not find - "#{@opt.fns}"} + end else req=@opt.fns.gsub(/(.+?\.ssm)$/,'\1.sst') file="#{@env.processing_path.composite_file}/#{@opt.fnb}.ssm.sst" - if FileTest.file?(file); FileUtils::cp(file,"#{@file.output_path.src.dir}/#{req}") - else print "did not find #{file} to copy" + if FileTest.file?(file) + FileUtils::cp(file,"#{@file.output_path.src.dir}/#{req}") + else STDERR.puts "*WARN* did not find #{file} to copy" end end else diff --git a/lib/sisu/v3/shared_images.rb b/lib/sisu/v3/shared_images.rb index 8f971a04..46b568d8 100644 --- a/lib/sisu/v3/shared_images.rb +++ b/lib/sisu/v3/shared_images.rb @@ -77,22 +77,25 @@ module SiSU_Images def images_set @pwd=ENV['PWD'] def copy(src_path,dest_path,images=nil) - if FileTest.directory?(src_path) - FileUtils::cd(src_path) - unless images - images=Dir.glob("*.{png,jpg,gif,ico}") - end - FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path) - FileUtils::chmod(0755,dest_path) - if images.length > 0 - images.each do |i| - FileUtils::cp_r(i,"#{dest_path}/#{i}") - FileUtils::chmod(0644,"#{dest_path}/#{i}") + if FileTest.directory?(src_path) + FileUtils::cd(src_path) + unless images + images=Dir.glob("*.{png,jpg,gif,ico}") + end + FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path) + FileUtils::chmod(0755,dest_path) + if images.length > 0 + images.each do |i| + if FileTest.file?(i) + FileUtils::cp_r(i,"#{dest_path}/#{i}") + FileUtils::chmod(0644,"#{dest_path}/#{i}") + else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} + end + end end + FileUtils::cd(@pwd) + else STDERR.puts %{\t*WARN* did not find - "#{src_path}" [#{__FILE__}:#{__LINE__}]} end - FileUtils::cd(@pwd) - else puts "\tWARN, did not find - #{src_path}" - end end def dest_path(image_type) pth=if image_type==:image_sys diff --git a/lib/sisu/v3/sisupod_make.rb b/lib/sisu/v3/sisupod_make.rb index 33ae8db2..54376271 100644 --- a/lib/sisu/v3/sisupod_make.rb +++ b/lib/sisu/v3/sisupod_make.rb @@ -226,6 +226,7 @@ module SiSU_Doc images << f.scan(@rgx_rb_image).uniq if f =~@rgx_rb_image #does not really discriminate, may duplicate images in sisu file, and may take images from default image pool end + else STDERR.puts %{\t*WARN* did not find - "#{skin_source[:name_path]}" [#{__FILE__}:#{__LINE__}]} end end end @@ -255,15 +256,21 @@ module SiSU_Doc if FileTest.directory?(images_pwd) images=images.uniq images.each do |i| - FileUtils::cp_r("#{images_pwd}/#{i}","#{images_path_pod}/#{i}") if FileTest.file?("#{images_pwd}/#{i}") + if FileTest.file?("#{images_pwd}/#{i}") + FileUtils::cp("#{images_pwd}/#{i}","#{images_path_pod}/#{i}") if FileTest.file?("#{images_pwd}/#{i}") + else STDERR.puts %{\t*WARN* did not find image - "#{images_pwd}/#{i}" [#{__FILE__}:#{__LINE__}]} + end end - else puts "\tWARN, did not find - #{images_pwd} #{images_path_pod}" + else STDERR.puts %{\t*WARN* did not find - #{images_pwd} #{images_path_pod} [#{__FILE__}:#{__LINE__}]} end end if doc_import.length > 0 \ and @opt.fno =~/\.ssm$/ doc_import.each do |f| - FileUtils::cp_r("#{@env.path.pwd}#{doc_import_dir}/#{f}","#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}/#{f}") + if FileTest.file?("#{@env.path.pwd}#{doc_import_dir}/#{f}") + FileUtils::cp("#{@env.path.pwd}#{doc_import_dir}/#{f}","#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}/#{f}") + else STDERR.puts %{\t*WARN* did not find image - "#{@env.path.pwd}#{doc_import_dir}/#{f}" [#{__FILE__}:#{__LINE__}]} + end end end x=@env.document_language_versions_found #check multiple document language versions (param not used) diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 977fd3fe..e03c668d 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -2141,7 +2141,10 @@ WOK src="#{path.share}/image" images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png] images.each do |i| #move to avoid repeated tests - FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") unless FileTest.file?("#{pth}/#{i}") + if FileTest.file?("#{src}/#{i}") + FileUtils::cp("#{src}/#{i}","#{pth}/#{i}") unless FileTest.file?("#{pth}/#{i}") + else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} + end end pth end @@ -5882,8 +5885,11 @@ WOK FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path) FileUtils::chmod(0755,dest_path) source.each do |i| - FileUtils::cp_r(i,"#{dest_path}/#{i}") - FileUtils::chmod(0644,"#{dest_path}/#{i}") + if FileTest.file?(i) + FileUtils::cp(i,"#{dest_path}/#{i}") + FileUtils::chmod(0644,"#{dest_path}/#{i}") + else STDERR.puts %{\t*WARN* did not find image - "#{i}" [#{__FILE__}:#{__LINE__}]} + end end FileUtils::cd(@pwd) else STDERR.puts %{\t*WARN* did not find - #{src_path} [#{__FILE__}:#{__LINE__}]} @@ -5927,7 +5933,10 @@ WOK FileUtils::cd(x) source=Dir.glob("*.{css}") source.each do |i| - FileUtils::cp(i,"#{@env.path.output}/#{@env.path.style}") + if FileTest.file?(i) + FileUtils::cp(i,"#{@env.path.output}/#{@env.path.style}") + else STDERR.puts %{\t*WARN* did not find css - "#{i}" [#{__FILE__}:#{__LINE__}]} + end end FileUtils::cd(@pwd) end -- cgit v1.2.3 From 9c234e6f37d3ce7a9fff56b30f9bd6724f7c996f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 3 Jun 2012 14:30:07 -0400 Subject: v3: urls, sisupod, fix --- data/doc/sisu/CHANGELOG_v3 | 2 ++ lib/sisu/v3/urls.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 555be6c0..b05c139f 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.11.orig.tar.xz sisu_3.2.11-1.dsc sisu_3.2.11-1.debian.tar.gz +* v3: urls, sisupod, fix + * v3: warn when files to be copied not found, add * v3: error & warning messages touched, revisit diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index 116fce98..a75cfc1a 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -138,7 +138,7 @@ module SiSU_Urls SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} #{@md.file.output_path.src.dir}/#{y}").result end def pod(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} #{@env.url.output_tell}/src/pod/#{y}").result + SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sisupod.dir}/#{y}").result end self end -- cgit v1.2.3 From a887643888fb60fdab43ffb968ab9d681884355d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 3 Jun 2012 14:32:09 -0400 Subject: v3: manifest, paths, (for command line selection of output type) fix --- data/doc/sisu/CHANGELOG_v3 | 2 ++ lib/sisu/v3/manifest.rb | 29 ++++++++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index b05c139f..4254d7b6 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.11.orig.tar.xz sisu_3.2.11-1.dsc sisu_3.2.11-1.debian.tar.gz +* v3: manifest, paths, (for command line selection of output type) fix + * v3: urls, sisupod, fix * v3: warn when files to be copied not found, add diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index 4d51d76c..b2982aae 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -72,7 +72,7 @@ module SiSU_Manifest def initialize(opt) @opt=opt @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) - l=SiSU_Env::StandardiseLanguage.new(@opt.lng).language + l=SiSU_Env::StandardiseLanguage.new(opt.lng).language @doc_language=l[:n] end def read @@ -105,12 +105,11 @@ module SiSU_Manifest def initialize(md) @manifest={ txt: [], html: [] } @md,@fns=md,md.fns - @env=SiSU_Env::InfoEnv.new(@md.fns) - @make=SiSU_Env::ProcessingSettings.new(@md) - @fnb=@md.fnb + @env=SiSU_Env::InfoEnv.new(md.fns) + @f=SiSU_Env::FileOp.new(md) + @fnb=md.fnb @base_url="#{@env.url.root}/#{@fnb}" - @f=SiSU_Env::FileOp.new(@md) - @o_str=SiSU_Env::ProcessingSettings.new(md).output_dir_structure + @o_str=SiSU_Env::FileOp.new(md).output_dir_structure @image_path=if @o_str.dump_or_redirect? %{./image} else @@ -119,9 +118,9 @@ module SiSU_Manifest @base_path=@f.output_path.manifest.dir @@dg ||=SiSU_Env::InfoEnv.new.digest.type @dg=@@dg - l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language + l=SiSU_Env::StandardiseLanguage.new(md.opt.lng).language @language=l[:n] - @translate=SiSU_Translate::Source.new(@md,@language) + @translate=SiSU_Translate::Source.new(md,@language) @brace_url=SiSU_Viz::Skin.new.url_decoration @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet end @@ -179,13 +178,13 @@ module SiSU_Manifest mt="#{mp}/#{mn}" mr="../../#{lc}/manifest/#{mn}" mu="#{url}/#{mn}" - elsif @env.output_dir_structure.by_language_code? + elsif @f.output_dir_structure.by_language_code? mp="#{@f.output_path.base.dir}/#{lc}/manifest" mn="#{@md.fnb}.html" mt="#{mp}/#{mn}" mr="../../#{lc}/manifest/#{mn}" mu="#{url}/#{lc}/manifest/#{mn}" - elsif @env.output_dir_structure.by_filetype? + elsif @f.output_dir_structure.by_filetype? mp="#{@f.output_path.base.dir}/manifest" mn="#{@md.fnb}.#{lc}.html" mt="#{mp}/#{mn}" @@ -497,7 +496,7 @@ WOK end if FileTest.file?(@f.place_file.sisupod.dir)==true pth=@f.output_path.sisupod.dir - rel=@f.output_path.sisupod.rel_sm + rel=@f.output_path.sisupod.ab_pod url=@f.output_path.sisupod.url id,file='SiSU doc (tar.xz)',@f.base_filename.sisupod summarize_sources(id,file,pth,rel,url) @@ -769,7 +768,7 @@ WOK minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n") id,file='','' vz=SiSU_Env::GetInit.instance.skin - search_form=if @make.build.search_form? + search_form=if @f.build.search_form? "#{@env.widget_static.search_form}" else '' end @@ -808,10 +807,10 @@ SiSU manifest: #{@md.title.full} #{banner_table} WOK - if @make.build.manifest_minitoc? + if @f.build.manifest_minitoc? if @o_str.dump_or_redirect? - elsif @env.output_dir_structure.by_language_code? \ - or @env.output_dir_structure.by_filetype? + elsif @f.output_dir_structure.by_language_code? \ + or @f.output_dir_structure.by_filetype? minitoc=minitoc.gsub(/ Date: Sun, 3 Jun 2012 14:39:42 -0400 Subject: v3: images, regular & sisupod --- data/doc/sisu/CHANGELOG_v3 | 4 ++ lib/sisu/v3/epub.rb | 11 ++++- lib/sisu/v3/odf.rb | 9 ++++ lib/sisu/v3/shared_images.rb | 47 ++++++++++++++++++-- lib/sisu/v3/sisupod_make.rb | 66 +++++++++++++++++----------- lib/sisu/v3/sysenv.rb | 32 ++++++++++++++ lib/sisu/v3/texpdf_format.rb | 100 ++++++++++++------------------------------- 7 files changed, 168 insertions(+), 101 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 4254d7b6..c322e750 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.11.orig.tar.xz sisu_3.2.11-1.dsc sisu_3.2.11-1.debian.tar.gz +* v3: images, regular & sisupod + * shared_images, --html, --xhtml, --xml* + * sisupod images done: --html including skin images; --epub; --odf; --pdf + * v3: manifest, paths, (for command line selection of output type) fix * v3: urls, sisupod, fix diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index 70b86f25..a2530cbb 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -631,13 +631,20 @@ module SiSU_EPUB end def images img_pth=@md.env.path.image_source_include + img_src_pth=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/ + @md.file.output_path.epub.rel_image + else + pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1] + pt + '/image' + end @md.ec[:image].each do |x| if FileTest.directory?("#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") \ - && FileTest.file?("#{@md.file.output_path.epub.rel_image}/#{x}") - FileUtils::cp("#{@md.file.output_path.epub.rel_image}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") + && FileTest.file?("#{img_src_pth}/#{x}") + FileUtils::cp("#{img_src_pth}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") elsif FileTest.directory?("#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") \ && FileTest.file?("#{img_pth}/#{x}") FileUtils::cp("#{img_pth}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") + else STDERR.puts %{\t*WARN* did not find image - "#{x}" in #{img_src_pth} or #{img_pth} [#{__FILE__}:#{__LINE__}]} end end end diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index 57994a28..4985b3dd 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -187,6 +187,15 @@ module SiSU_ODF image_source=if @md.fns =~/\.ss[tm]$/ \ and FileTest.file?("#{@env.path.image_source_include}/#{i}") #review @env.path.image_source_include + elsif @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/ + pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1] + img_src=pt + '/image' + if FileTest.file?("#{img_src}/#{i}") + img_src + else + SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_include_local},#{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.cmd =~/q/ + nil + end elsif @md.fns =~/\.ss[tm]$/ \ and FileTest.file?("#{@env.path.image_source_include_local}/#{i}") #review @env.path.image_source_include_local diff --git a/lib/sisu/v3/shared_images.rb b/lib/sisu/v3/shared_images.rb index 46b568d8..a5a412b8 100644 --- a/lib/sisu/v3/shared_images.rb +++ b/lib/sisu/v3/shared_images.rb @@ -73,6 +73,9 @@ module SiSU_Images def songsheet images_set.select_sisu_base images_set.select_with_document + if @md.opt.cmd =~/h/ + images_set.select_with_document_skin + end end def images_set @pwd=ENV['PWD'] @@ -101,19 +104,57 @@ module SiSU_Images pth=if image_type==:image_sys pth=(@o_str.dump_or_redirect?) \ ? "#{@md.file.output_path.html.dir}/image" - : "#{@env.path.webserv}/_sisu/image_sys" + : "#{@md.file.output_path.base.dir}/_sisu/image_sys" elsif image_type==:image pth=(@o_str.dump_or_redirect?) \ ? "#{@md.file.output_path.html.dir}/image" - : "#{@env.path.webserv}/_sisu/image" + : "#{@md.file.output_path.base.dir}/_sisu/image" end + pth end def select_with_document images=@md.ec[:image] - src_path="#{@pwd}/_sisu/image" + src_path=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/ + "#{@pwd}/_sisu/image" + else #sisupod + pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1] + pt + '/image' + end dest=dest_path(:image) copy(src_path,dest,images) end + def select_with_document_skin + rgx_rb_image=/["']\S*?([a-zA-Z0-9_-]+?\.(?:png|jpg|gif))["']/ + skin_source=SiSU_Env::InfoSkin.new(@md).apply + docskin=nil + if skin_source[:type] == :dir + docskin_with_path="#{docskin_place}/skin_#{@env.stub_pwd}.rb" + docskin=[docskin_with_path.gsub(/.+?\/(skin_\S+?)\.rb/,'\1')] + #docskin='skin_sisupod' + end + images=[] + if skin_source \ + and skin_source[:name_path] #imperfect, revisit + unless (skin_source[:name_path].nil? \ + or skin_source[:name_path].empty?) + skinfile_array=IO.readlines(skin_source[:name_path],'') + skinfile_array.each do |f| #% work area + unless f =~/^%+ / #hmmm + images << f.scan(rgx_rb_image).uniq if f =~rgx_rb_image + #does not really discriminate, may duplicate images in sisu file, and may take images from default image pool + end + end + end + end + src_path=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/ + "#{@pwd}/_sisu/image" + else #sisupod + pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1] + pt + '/image' + end + dest=dest_path(:image) + copy(src_path,dest,images.flatten) + end def select_sisu_base images=%w[arrow_next_red.png arrow_prev_red.png arrow_up_red.png dot_clear.png dot_white.png b_doc.png b_epub.png b_odf.png b_pdf.png b_toc.png] src_path="#{@env.path.share}/image" diff --git a/lib/sisu/v3/sisupod_make.rb b/lib/sisu/v3/sisupod_make.rb index 54376271..984d807d 100644 --- a/lib/sisu/v3/sisupod_make.rb +++ b/lib/sisu/v3/sisupod_make.rb @@ -143,14 +143,14 @@ module SiSU_Doc sk_doc,sk_dir="doc/#{skin}.rb","dir/skin_#{@env.stub_pwd}.rb" skin_path.each do |v| #document skin priority 1 if FileTest.file?("#{v}/#{sk_doc}") - @skin[:name],@skin[:type]="#{v}/#{sk_doc}",'doc' + @skin={ name_path: "#{v}/#{sk_doc}", type: :doc } break end end unless @skin.length > 0 skin_path.each do |v| #directory skin priority 2 if FileTest.file?("#{v}/#{sk_dir}") - @skin[:name],@skin[:type]="#{v}/#{sk_dir}",'dir' + @skin={ name_path: "#{v}/#{sk_dir}", type: :dir } break end end @@ -167,7 +167,7 @@ module SiSU_Doc end def sisupod_build #see also sisupod in sysenv @pwd=Dir.pwd - @rgx_rb_image=/["'](\S+?\.(?:png|jpg|gif))["']/ + @rgx_rb_image=/["']\S*?([a-zA-Z0-9_-]+?\.(?:png|jpg|gif))["']/ @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ @rgx_skin=/^\s+:skin:\s+(\S+)/ @rgx_doc_import=/^<<\s*(\S+?\.ss[ti])/ @@ -207,24 +207,26 @@ module SiSU_Doc else skin_source=select_skin end - docskin_place="#{@env.processing_path.processing_sisupod(@opt)}/doc/_sisu/skin/#{skin_source[:type]}" + docskin_place="#{@env.processing_path.processing_sisupod(@opt)}/doc/_sisu/skin/#{skin_source[:type].to_s}" FileUtils::mkdir_p(docskin_place) - if skin_source[:type] =~/dir/ + if skin_source[:type] == :dir docskin_with_path="#{docskin_place}/skin_#{@env.stub_pwd}.rb" docskin=[docskin_with_path.gsub(/.+?\/(skin_\S+?)\.rb/,'\1')] docskin='skin_sisupod' end if skin_source \ - and docskin #imperfect, revisit - unless skin_source[:name].nil? \ - or skin_source[:name].empty? - FileUtils::cp_r(skin_source[:name],"#{docskin_place}/#{docskin}.rb") - skinfile_array=IO.readlines(skin_source[:name],'') - para_images=[] - skinfile_array.each do |f| #% work area - unless f =~/^%+ / #hmmm - images << f.scan(@rgx_rb_image).uniq if f =~@rgx_rb_image - #does not really discriminate, may duplicate images in sisu file, and may take images from default image pool + and skin_source[:name_path] + unless skin_source[:name_path].nil? \ + or skin_source[:name_path].empty? + if FileTest.file?(skin_source[:name_path]) + FileUtils::cp(skin_source[:name_path],"#{docskin_place}/#{docskin}.rb") + skinfile_array=IO.readlines(skin_source[:name_path],'') + para_images=[] + skinfile_array.each do |f| #% work area + unless f =~/^%+ / #hmmm + images << f.scan(@rgx_rb_image).uniq if f =~@rgx_rb_image + #does not really discriminate, may duplicate images in sisu file, and may take images from default image pool + end end else STDERR.puts %{\t*WARN* did not find - "#{skin_source[:name_path]}" [#{__FILE__}:#{__LINE__}]} end @@ -282,18 +284,34 @@ module SiSU_Doc if f[:f] =~/\~(\S{2,3})\.ss[tm]$/ lng_f=$1 if @opt.lng == lng_f - (@opt.fno =~/\.ssm$/) \ - ? FileUtils::cp_r("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}", + if @opt.fno =~/\.ssm$/ + if FileTest.file?("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}") + FileUtils::cp("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}", + "#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}/#{f[:n]}") + else STDERR.puts %{\t*WARN* did not find - "#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} + end + else + if FileTest.file?("#{@env.path.pwd}/#{f[:f]}") + FileUtils::cp("#{@env.path.pwd}/#{f[:f]}", + "#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}/#{f[:n]}") + else STDERR.puts %{\t*WARN* did not find - "#{@env.path.pwd}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} + end + end + end + else + if @opt.fno =~/\.ssm$/ + if FileTest.file?("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}") + FileUtils::cp_r("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}", "#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}/#{f[:n]}") - : FileUtils::cp_r("#{@env.path.pwd}/#{f[:f]}", + else STDERR.puts %{\t*WARN* did not find - "#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} + end + else + if FileTest.file?("#{@env.path.pwd}/#{f[:f]}") + FileUtils::cp("#{@env.path.pwd}/#{f[:f]}", "#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}/#{f[:n]}") + else STDERR.puts %{\t*WARN* did not find - "#{@env.path.pwd}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} + end end - else - (@opt.fno =~/\.ssm$/) \ - ? FileUtils::cp_r("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}", - "#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}/#{f[:n]}") - : FileUtils::cp_r("#{@env.path.pwd}/#{f[:f]}", - "#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}/#{f[:n]}") end end end #NB not all possibilies met, revisit, also in case of composite file may wish to add README diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index e03c668d..f57185fc 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -5668,6 +5668,38 @@ WOK @pwd_stub=@pwd[m,1] @env=SiSU_Env::InfoEnv.new end + def apply + if @md.make.skin + skin_path=unless @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/ + [ + "#{@env.path.pwd}/_sisu/skin", + "#{@env.path.home}/.sisu/skin", + '/etc/sisu/skin', + "#{@env.processing_path.processing_sisupod(@md.opt)}/external_document/skin" + ] + else #sisupod + pt=/(\/\S+?\/sisupod\/\S+?\/sisupod\/doc)/.match(@md.opt.f_pth[:pth])[1] + [ "#{pt}/_sisu/skin" ] + end + sk_doc,sk_dir="doc/#{@md.make.skin}.rb","dir/skin_#{@env.stub_pwd}.rb" + skin_path.each do |v| #document skin priority 1 + if FileTest.file?("#{v}/#{sk_doc}") + @skin_apply={ name: @md.make.skin, name_path: "#{v}/#{sk_doc}", type: :doc } + break + end + end + unless @skin_apply.length > 0 + skin_path.each do |v| #directory skin priority 2 + if FileTest.file?("#{v}/#{sk_dir}") + @skin_apply={ name: "skin_#{@env.stub_pwd}.rb", name_path: "#{v}/#{sk_dir}", type: :dir } + break + end + end + end + else nil + end + @skin_apply + end def select # skin loading logic here load "#{SiSU_lib}/defaults.rb" skin_path=[] diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index 626020c3..75eadedc 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -478,67 +478,6 @@ module SiSU_TeX_Pdf @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'') # fragile match operator\\ fragile ! end end - def image - dir=SiSU_Env::InfoEnv.new(@md.fns) - image,m=/#{Mx[:lnk_o]}\s*(\S+)\s+.+?width=``(\d+)''.+?#{Mx[:lnk_c]}/m.match(@txt).captures - width=m[1] || '100' - width=width.to_i*0.4 - image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \ - and FileTest.file?("#{dir.path.image_source_include_local}/#{image}") - dir.path.image_source_include_local - elsif @md.fns =~/\.-ss[tm]$/ \ - and FileTest.file?("#{dir.path.image_source_include_remote}/#{image}") - dir.path.image_source_include_remote - elsif FileTest.file?("#{dir.path.image_source_include}/#{image}") - dir.path.image_source_include - else - SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_include_local},#{dir.path.image_source_include_remote} and #{dir.path.image_source_include}").error2 unless @md.opt.cmd =~/q/ - nil - end - if image_source #CHECK - @txt.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/, - @center_begin + "\\includegraphics*[width=#{width}pt]{#{image_source}/\\1}" + @center_end ) - else @txt.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/,'\1}') - end - end - def png(ps='') #fc missing image check - dir=SiSU_Env::InfoEnv.new(@md.fns) - # messy clean up - z=@txt[/#{Mx[:lnk_o]}(\S.+?)#{Mx[:lnk_c]}(?:image|png)/,1].strip if @txt =~ /#{Mx[:lnk_o]}\S.+?#{Mx[:lnk_c]}(?:image|png)/ # match operator for z \\ fragile ! - if z #debug 2004w14 - image=z[/(\S+?\.(?:png|jpg|gif)\b)/m] - image.gsub!(/\\/,'') - width=if z =~ /\d+x\d*/ - w=(z[/\s(\d+)x\d*/,1]).to_i - w*0.8 - else '100' #revisit, is bug for small images/icons - end - width='380' if width.to_i > 380 - c=z[/``(.+?)''/m] - end - hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace - caption="{\\\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" if c - image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \ - and FileTest.file?("#{dir.path.image_source_include_local}/#{image}") - dir.path.image_source_include_local - elsif @md.fns =~/\.-ss[tm]$/ \ - and FileTest.file?("#{dir.path.image_source_include_remote}/#{image}") - dir.path.image_source_include_remote - elsif FileTest.file?("#{dir.path.image_source_include}/#{image}") - dir.path.image_source_include - else - unless image.nil? \ - or image.length < 2 - SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_include_local},#{dir.path.image_source_include_remote} and #{dir.path.image_source_include}").error2 unless @md.opt.cmd =~/q/ - end - nil - end - if image_source - @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/, # fragile match operator\\ fragile ! - "#{@center_begin}\n\\includegraphics*[width=#{width}pt]{#{image_source}/#{image}}#{caption}#{@center_end}") - else @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/,'') - end - end def url_str_internal(str,idx=nil) map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags rgx_url_generic=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/m @@ -684,36 +623,53 @@ module SiSU_TeX_Pdf images_hash[ps].gsub!(/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/,'[image]') end if image #most images fc etc. #% clean up ! - if @md.fns =~/\.(?:ssm\.)?sst$/ \ - and FileTest.file?("#{dir.path.image_source_include_local}/#{image}") + if FileTest.file?("#{dir.path.image_source_include}/#{image}") case images_hash[ps] when url_image_rgx images_hash[ps].sub!(url_image_rgx, - "#{@center_begin}\\\n\\href{#{url}}{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_local}/#{image}}}#{caption} #{@center_end}") + "#{@center_begin}\\\n\\href{#{url}}\n{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include}/#{image}}}#{caption}#{@center_end}") when image_rgx images_hash[ps].sub!(image_rgx, - "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_local}/#{image}}#{caption} #{@center_end}") + "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include}/#{image}}#{caption}#{@center_end}") end images_hash[ps] - elsif @md.fns =~/\.-ss[tm]$/ \ - and FileTest.file?("#{dir.path.image_source_include_remote}/#{image}") + elsif @md.opt.f_pth[:pth] =~/\/\S+?\/sisupod\/\S+?\/sisupod\/doc/ + pt=/(\/\S+?\/sisupod\/\S+?\/sisupod)\/doc/.match(@md.opt.f_pth[:pth])[1] + img_src=pt + '/image' + if FileTest.file?("#{img_src}/#{image}") + img_src + + case images_hash[ps] + when url_image_rgx + images_hash[ps].sub!(url_image_rgx, + "#{@center_begin}\\\n\\href{#{url}}{\\includegraphics*[width=#{width[ps]}pt]{#{img_src}/#{image}}}#{caption} #{@center_end}") + when image_rgx + images_hash[ps].sub!(image_rgx, + "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{img_src}/#{image}}#{caption} #{@center_end}") + end + images_hash[ps] + end + + elsif @md.fns =~/\.(?:ssm\.)?sst$/ \ + and FileTest.file?("#{dir.path.image_source_include_local}/#{image}") case images_hash[ps] when url_image_rgx images_hash[ps].sub!(url_image_rgx, - "#{@center_begin}\\\n\\href{#{url}}{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_remote}/#{image}}}#{caption}#{@center_end}") + "#{@center_begin}\\\n\\href{#{url}}{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_local}/#{image}}}#{caption} #{@center_end}") when image_rgx images_hash[ps].sub!(image_rgx, - "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_remote}/#{image}}#{caption}#{@center_end}") + "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_local}/#{image}}#{caption} #{@center_end}") end images_hash[ps] - elsif FileTest.file?("#{dir.path.image_source_include}/#{image}") + elsif @md.fns =~/\.-ss[tm]$/ \ + and FileTest.file?("#{dir.path.image_source_include_remote}/#{image}") case images_hash[ps] when url_image_rgx images_hash[ps].sub!(url_image_rgx, - "#{@center_begin}\\\n\\href{#{url}}\n{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include}/#{image}}}#{caption}#{@center_end}") + "#{@center_begin}\\\n\\href{#{url}}{\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_remote}/#{image}}}#{caption}#{@center_end}") when image_rgx images_hash[ps].sub!(image_rgx, - "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include}/#{image}}#{caption}#{@center_end}") + "#{@center_begin}\\\n\\includegraphics*[width=#{width[ps]}pt]{#{dir.path.image_source_include_remote}/#{image}}#{caption}#{@center_end}") end images_hash[ps] else -- cgit v1.2.3 From 35e3bcae6aac45cdbcc1c7f63bbeb1870c171bff Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 3 Jun 2012 22:29:09 -0400 Subject: v3: images, copy (system link removed) --- data/doc/sisu/CHANGELOG_v3 | 1 + lib/sisu/v3/conf.rb | 1 - lib/sisu/v3/dal.rb | 1 - lib/sisu/v3/epub.rb | 5 +--- lib/sisu/v3/html.rb | 5 +--- lib/sisu/v3/shared_images.rb | 7 ++++-- lib/sisu/v3/sst_do_inline_footnotes.rb | 1 - lib/sisu/v3/sysenv.rb | 46 +++++++++++++--------------------- 8 files changed, 25 insertions(+), 42 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index c322e750..8ad2d4c3 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -24,6 +24,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.2.11.orig.tar.xz * v3: images, regular & sisupod * shared_images, --html, --xhtml, --xml* * sisupod images done: --html including skin images; --epub; --odf; --pdf + * copy (system link removed) * v3: manifest, paths, (for command line selection of output type) fix diff --git a/lib/sisu/v3/conf.rb b/lib/sisu/v3/conf.rb index 8a323ac4..8cd3e2ef 100644 --- a/lib/sisu/v3/conf.rb +++ b/lib/sisu/v3/conf.rb @@ -108,7 +108,6 @@ module SiSU_Initialize def cp_webserver_images SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy webserver/output file images','').colorize unless @opt.cmd =~/q/ SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images - SiSU_Env::CreateSystemLink.new.images end def css SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring CSSs','').colorize unless @opt.cmd =~/q/ diff --git a/lib/sisu/v3/dal.rb b/lib/sisu/v3/dal.rb index dd1ec494..24f29bd3 100644 --- a/lib/sisu/v3/dal.rb +++ b/lib/sisu/v3/dal.rb @@ -105,7 +105,6 @@ module SiSU_DAL @idx_xhtml=@make_fns.marshal.dal_idx_xhtml @map_nametags=@make_fns.marshal.dal_map_nametags @map_ocn_htmlseg=@make_fns.marshal.dal_map_ocn_htmlseg - SiSU_Env::CreateSystemLink.new.images @env=SiSU_Env::InfoEnv.new end def read #creates dal diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index a2530cbb..06021574 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -133,10 +133,7 @@ module SiSU_EPUB @particulars=particulars @md,@env=particulars.md,particulars.env @vz=SiSU_Env::GetInit.instance.skin - @env,@css,@symlnk=particulars.env,SiSU_Style::CSS.new,SiSU_Env::CreateSystemLink.new #home - end - def link_images - @symlnk.images + @env,@css=particulars.env,SiSU_Style::CSS.new end def directories title=File.basename(@md.fns,'.rb') diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb index 46f051c6..a5c1edb1 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v3/html.rb @@ -139,10 +139,7 @@ module SiSU_HTML @particulars=particulars @md,@env=particulars.md,particulars.env @vz=SiSU_Env::GetInit.instance.skin - @env,@css,@symlnk=particulars.env,SiSU_Style::CSS.new,SiSU_Env::CreateSystemLink.new #home - end - def link_images - @symlnk.images + @env,@css=particulars.env,SiSU_Style::CSS.new end def tuned_file_instructions @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) diff --git a/lib/sisu/v3/shared_images.rb b/lib/sisu/v3/shared_images.rb index a5a412b8..03093c6a 100644 --- a/lib/sisu/v3/shared_images.rb +++ b/lib/sisu/v3/shared_images.rb @@ -85,8 +85,11 @@ module SiSU_Images unless images images=Dir.glob("*.{png,jpg,gif,ico}") end - FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path) - FileUtils::chmod(0755,dest_path) + unless FileTest.directory?(dest_path) \ + or FileTest.symlink?(dest_path) + FileUtils::mkdir_p(dest_path) + FileUtils::chmod(0755,dest_path) + end if images.length > 0 images.each do |i| if FileTest.file?(i) diff --git a/lib/sisu/v3/sst_do_inline_footnotes.rb b/lib/sisu/v3/sst_do_inline_footnotes.rb index ab9fbbce..4ceb54fa 100644 --- a/lib/sisu/v3/sst_do_inline_footnotes.rb +++ b/lib/sisu/v3/sst_do_inline_footnotes.rb @@ -85,7 +85,6 @@ module SiSU_ConvertFootnotes @@fns||@opt.fns @my_make=SiSU_Env::CreateFile.new(@opt.fns) @fnm=SiSU_Env::InfoFile.new(@opt.fns).marshal.dal_content - SiSU_Env::CreateSystemLink.new.images end def read #creates dal begin diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index f57185fc..b8dd37b0 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -3404,28 +3404,6 @@ WOK %x{ruby -v}.strip end end - class CreateSystemLink #revisit problems created 2004w41 - require 'fileutils' - include FileUtils::Verbose - def initialize - @env=SiSU_Env::InfoEnv.new - end - def images - unless FileTest.directory?("#{@env.path.output}/_sisu") - FileUtils::mkdir_p("#{@env.path.output}/_sisu") - end - unless File.exist?("#{@env.path.output}/_sisu/image_sys") \ - or File.symlink?("#{@env.path.output}/_sisu/image_sys") - File.symlink("../../_sisu/image_sys", "#{@env.path.output}/_sisu/image_sys") - end - end - def man_forms - #File.symlink("../../man/form", "#{@env.path.output}/man/form") unless File.symlink?("#{@env.path.output}/man/form")==true - end - def man_pdf - #File.symlink("../../man/form", "#{@env.path.output}/man/pdf") unless File.symlink?("#{@env.path.output}/man/pdf")==true - end - end class InfoFile