From bdd62aba95cba6aa4930e14cee00d2dcc6d43f96 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 17 May 2011 18:11:15 -0400 Subject: v3: po4a re-enabled, related fixes (issues persist) --- lib/sisu/v3/git.rb | 6 +- lib/sisu/v3/hub.rb | 2 +- lib/sisu/v3/param.rb | 153 +++++++++++++++++++++++++++++++++++++------------- lib/sisu/v3/po4a.rb | 13 +---- lib/sisu/v3/sysenv.rb | 16 ++---- 5 files changed, 126 insertions(+), 64 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/git.rb b/lib/sisu/v3/git.rb index bef93bc3..45eb3f75 100644 --- a/lib/sisu/v3/git.rb +++ b/lib/sisu/v3/git.rb @@ -68,8 +68,8 @@ module SiSU_Git @md=SiSU_Param::Parameters.new(@opt).get @file=SiSU_Env::SiSU_file.new(@md) l=SiSU_Env::Standardise_language.new(@md.opt.lng).language - unless @md.i18n[0]==l[:c] - p "using: #{@md.i18n[0]} (@make: :language:); filename #{@md.fns} filename language: #{l[:c]}, mismatch" + unless @opt.lng==l[:c] # @md.i18n[0]==l[:c] + p "using: #{@opt.lng} (@make: :language:); filename #{@md.fns} filename language: #{l[:c]}, mismatch" end if @env.output_dir_structure.multilingual? m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss @@ -85,7 +85,7 @@ module SiSU_Git # : SiSU_Screen::Ansi.new(@opt.cmd,'Git path',@git_path[:fnb]).green_title_hi # SiSU_Screen::Ansi.new(@opt.cmd,"Git path","#{@opt.fns} -> #{@git_path[:fnb]}").warn if @opt.cmd =~/[MVv]/ #end - lng=(@md.opt.f_pth[:lng]) ? (@md.opt.f_pth[:lng]) : (@md.i18n[0]) + lng=(@md.opt.lng) ? (@md.opt.lng) : (@md.i18n[0]) @git_path={ fnb: git_path_fnb, src: git_path_fnb + '/' + Gt[:src] + '/' + lng, diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index ed3aad1d..651276cd 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -141,7 +141,7 @@ module SiSU # when /^source_kdissert$/; SiSU_Kdi_source::Source.new(@opt).read # -S share_src_kdissert.rb when /^digests$/; SiSU_Digest_view::Source.new(@opt).read # -N digests.rb when /^plaintext$/; SiSU_Plaintext::Source.new(@opt).read # -t -a plaintext.rb -# when /^po4a$/; SiSU_po4a::Source.new(@opt).read # -P po4a.rb + when /^po4a$/; SiSU_po4a::Source.new(@opt).read # -P po4a.rb #when /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g when /^epub$/; SiSU_EPUB::Source.new(@opt).read # -e epub.rb when /^odf$/; SiSU_ODF::Source.new(@opt).read # -o odf.rb diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 87a556ec..5d93523e 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -79,8 +79,9 @@ module SiSU_Param @opt=opt @cX||=SiSU_Screen::Ansi.new(opt.cmd) @cmd,@mod=opt.cmd,opt.mod - unless @opt.cmd =~/P/ - @fns=opt.fns.gsub(/\.ssm$/,'.ssm.sst') #revisit CHECK + @fns=if @opt.cmd =~/P/ #revisit CHECK + opt.fns + else opt.fns.gsub(/\.ssm$/,'.ssm.sst') end Instantiate.new.param_instantiate @env=SiSU_Env::Info_env.new(@fns) @@ -258,12 +259,16 @@ module SiSU_Param validate_length(s,l,n) end def short - s=(@h['short'] ? @h['short'] : @h['main']) + s=@h['short'] \ + ? @h['short'] \ + : @h['main'] l,n=Db[:col_title_part],'title.short' validate_length(s,l,n) end def full - s=(@h['subtitle'] ? (@h['main'] + ' - ' + @h['subtitle']) : @h['main']) + s=@h['subtitle'] \ + ? (@h['main'] + ' - ' + @h['subtitle']) \ + : @h['main'] l,n=Db[:col_title],'title.full' validate_length(s,l,n) end @@ -290,13 +295,19 @@ module SiSU_Param validate_length(s,l,n) end def author_detail - s=(@h['author'] ? @h['author'] : @h['main']) + s=@h['author'] \ + ? @h['author'] \ + : @h['main'] names=name_format(s) names[:name_a_h] end def contributor - names=(@h['contributor'] ? name_format(@h['contributor']) : nil) - s=(names.class==Hash) ? names[:name_str] : nil + names=@h['contributor'] \ + ? name_format(@h['contributor']) \ + : nil + s=(names.class==Hash) \ + ? names[:name_str] \ + : nil s=if s l,n=Db[:col_name],'creator.author' validate_length(s,l,n) @@ -304,12 +315,20 @@ module SiSU_Param end end def contributor_detail - names=(@h['contributor'] ? name_format(@h['contributor']) : nil) - (names.class==Hash) ? names[:name_a_h] : nil + names=@h['contributor'] \ + ? name_format(@h['contributor']) \ + : nil + (names.class==Hash) \ + ? names[:name_a_h] \ + : nil end def illustrator - names=(@h['illustrator'] ? name_format(@h['illustrator']) : nil) - s=(names.class==Hash) ? names[:name_str] : nil + names=@h['illustrator'] \ + ? name_format(@h['illustrator']) \ + : nil + s=(names.class==Hash) \ + ? names[:name_str] \ + : nil s=if s l,n=Db[:col_name],'creator.illustrator' validate_length(s,l,n) @@ -317,12 +336,20 @@ module SiSU_Param end end def illustrator_detail - names=(@h['illustrator'] ? name_format(@h['illustrator']) : nil) - (names.class==Hash) ? names[:name_a_h] : nil + names=@h['illustrator'] \ + ? name_format(@h['illustrator']) \ + : nil + (names.class==Hash) \ + ? names[:name_a_h] \ + : nil end def photographer - names=(@h['photographer'] ? name_format(@h['photographer']) : nil) - s=(names.class==Hash) ? names[:name_str] : nil + names=@h['photographer'] \ + ? name_format(@h['photographer']) \ + : nil + s=(names.class==Hash) \ + ? names[:name_str] \ + : nil s=if s l,n=Db[:col_name],'creator.photographer' validate_length(s,l,n) @@ -330,12 +357,20 @@ module SiSU_Param end end def photographer_detail - names=(@h['photographer'] ? name_format(@h['photographer']) : nil) - (names.class==Hash) ? names[:name_a_h] : nil + names=@h['photographer'] \ + ? name_format(@h['photographer']) \ + : nil + (names.class==Hash) \ + ? names[:name_a_h] \ + : nil end def translator - names=(@h['translator'] ? name_format(@h['translator']) : nil) - s=(names.class==Hash) ? names[:name_str] : nil + names=@h['translator'] \ + ? name_format(@h['translator']) \ + : nil + s=(names.class==Hash) \ + ? names[:name_str] \ + : nil s=if s l,n=Db[:col_name],'creator.translator' validate_length(s,l,n) @@ -343,12 +378,20 @@ module SiSU_Param end end def translator_detail - names=(@h['translator'] ? name_format(@h['translator']) : nil) - (names.class==Hash) ? names[:name_a_h] : nil + names=@h['translator'] \ + ? name_format(@h['translator']) \ + : nil + (names.class==Hash) \ + ? names[:name_a_h] \ + : nil end def audio - names=(@h['audio'] ? name_format(@h['audio']) : nil) - s=(names.class==Hash) ? names[:name_str] : nil + names=@h['audio'] \ + ? name_format(@h['audio']) \ + : nil + s=(names.class==Hash) \ + ? names[:name_str] \ + : nil s=if s l,n=Db[:col_name],'creator.audio' validate_length(s,l,n) @@ -356,12 +399,20 @@ module SiSU_Param end end def audio_detail - names=(@h['audio'] ? name_format(@h['audio']) : nil) - (names.class==Hash) ? names[:name_a_h] : nil + names=@h['audio'] \ + ? name_format(@h['audio']) \ + : nil + (names.class==Hash) \ + ? names[:name_a_h] \ + : nil end def digitized_by - names=(@h['digitized_by'] ? name_format(@h['digitized_by']) : nil) - s=(names.class==Hash) ? names[:name_str] : nil + names=@h['digitized_by'] \ + ? name_format(@h['digitized_by']) \ + : nil + s=(names.class==Hash) \ + ? names[:name_str] \ + : nil s=if s l,n=Db[:col_name],'creator.digitized_by' validate_length(s,l,n) @@ -369,12 +420,20 @@ module SiSU_Param end end def digitized_by_detail - names=(@h['digitized_by'] ? name_format(@h['digitized_by']) : nil) - (names.class==Hash) ? names[:name_a_h] : nil + names=@h['digitized_by'] \ + ? name_format(@h['digitized_by']) \ + : nil + (names.class==Hash) \ + ? names[:name_a_h] \ + : nil end def prepared_by - names=(@h['prepared_by'] ? name_format(@h['prepared_by']) : nil) - s=(names.class==Hash) ? names[:name_str] : nil + names=@h['prepared_by'] \ + ? name_format(@h['prepared_by']) \ + : nil + s=(names.class==Hash) \ + ? names[:name_str] \ + : nil s=if s l,n=Db[:col_name],'creator.prepared_by' validate_length(s,l,n) @@ -382,9 +441,13 @@ module SiSU_Param end end def prepared_by_detail - names=(@h['prepared_by'] ? name_format(@h['prepared_by']) : nil) + names=@h['prepared_by'] \ + ? name_format(@h['prepared_by']) \ + : nil names=name_format(@h['prepared_by']) - (names.class==Hash) ? names[:name_a_h] : nil + (names.class==Hash) \ + ? names[:name_a_h] \ + : nil end self end @@ -407,34 +470,46 @@ module SiSU_Param validate_length(s,l,n) end def translation - s=(@h['translation'] ? @h['translation'] : nil) + s=@h['translation'] \ + ? @h['translation'] \ + : nil l,n=Db[:col_info_note],'rights.copyright.translation' validate_length(s,l,n) end def illustrations - s=(@h['illustrations'] ? @h['illustrations'] : nil) + s=@h['illustrations'] \ + ? @h['illustrations'] \ + : nil l,n=Db[:col_info_note],'rights.copyright.illustrations' validate_length(s,l,n) end def photographs - s=(@h['photographs'] ? @h['photographs'] : nil) + s=@h['photographs'] \ + ? @h['photographs'] \ + : nil l,n=Db[:col_info_note],'rights.copyright.photographs' validate_length(s,l,n) end def digitization - s=(@h['digitization'] ? @h['digitization'] : nil) + s=@h['digitization'] \ + ? @h['digitization'] \ + : nil l,n=Db[:col_info_note],'rights.copyright.digitization' validate_length(s,l,n) end def audio - s=(@h['audio'] ? @h['audio'] : nil) + s=@h['audio'] \ + ? @h['audio'] \ + : nil l,n=Db[:col_info_note],'rights.copyright.audio' validate_length(s,l,n) end self end def license - s=(@h['license'] ? @h['license'] : nil) + s=@h['license'] \ + ? @h['license'] \ + : nil l,n=Db[:col_info_note],'rights.license' validate_length(s,l,n) end diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v3/po4a.rb index 880bda98..dd2aff7a 100644 --- a/lib/sisu/v3/po4a.rb +++ b/lib/sisu/v3/po4a.rb @@ -69,7 +69,6 @@ module SiSU_po4a class Source @@opt_src,@@opt_trn,@@opt_src_,@@opt_trn_,@@md_src,@@md_trn=nil,nil,nil,nil,nil,nil def initialize(opt,fn=nil) - @opt=opt @opt,@fn=opt,fn #unless @opt.fns =~/(.+?\.(?:-|ssm\.)?sst)$/ # puts "#{@opt.fns} not a processed file type" @@ -77,7 +76,6 @@ module SiSU_po4a r=Px[:lng_lst].join('|') r.gsub!(/\|en\|/,'|') @lang_regx=%r{(?:#{r})} -# @lang_regx=%r{(?:es|fr)} if opt.fns =~/\S+?~#{@lang_regx}\.ss[mti]/ \ and opt.f_pth[:lng]!='en' @@opt_src_=false @@ -178,13 +176,8 @@ module SiSU_po4a end def songsheet ############## BUG @fn changes value -#p __LINE__ -#p @fn fn=@fn pot=pot_markup(@data_src,@data_trn) -#p __LINE__ -#p @fn -#p fn publish(fn,pot) end def extract_endnotes(dob='') #% Used for extraction of endnotes from paragraphs @@ -946,11 +939,11 @@ GSUB unless @md.opt.cmd =~/M/ require_relative 'git' # git.rb git=SiSU_Git::Source.new(@md.opt) - git.create_file_structure_git unless FileTest.directory?(@file.output_path.pot_git) + git.create_file_structure_git unless FileTest.directory?(@file.output_path.pot_git.dir) if @md.opt.f_pth[:lng] =='en' - cp(@file.place_file.pot.dir, @file.output_path.pot_git) + cp(@file.place_file.pot.dir, @file.output_path.pot_git.dir) else # naive, work on --> - cp(@file.place_file.po.dir, @file.output_path.po_git) #unless FileTest.file?(@file.place_file.po_git.dir) + cp(@file.place_file.po.dir, @file.output_path.po_git.dir) #unless FileTest.file?(@file.place_file.po_git.dir) end git.read end diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 29bfa8af..5a59ebf8 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -1731,8 +1731,8 @@ WOK else defaults[:processing_git] end unless FileTest.directory?(pth) - mkdir_p(git) - File.chmod(0700,git) + mkdir_p(pth) + File.chmod(0700,pth) end pth end @@ -2778,20 +2778,14 @@ WOK System_call.new(local_gen,remote_rel,@opt.cmd).rsync('--relative',@md.file.output_path.base.dir) end if FileTest.file?("#{local_src}/#{src_txt}") - System_call.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync +# System_call.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync if defined? @md.ec[:image] and not @md.ec[:image].empty? images="#{local_gen_image}/" + @md.ec[:image].join(" #{local_gen_image}/") - System_call.new(images,remote_images,@opt.cmd).rsync +# System_call.new(images,remote_images,@opt.cmd).rsync images_external="#{local_gen_image_external}/" + @md.ec[:image].join(" #{local_gen_image_external}/") - System_call.new(images_external,remote_images_external,@opt.cmd).rsync +# System_call.new(images_external,remote_images_external,@opt.cmd).rsync end end - if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub") - System_call.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).rsync - end - if FileTest.file?("#{local_pod}/#{src_pod}") - System_call.new("#{local_pod}/#{src_pod}",remote_pod,@opt.cmd).rsync - end elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "#{local_gen} -> #{remote_gen}" -- cgit v1.2.3