From e1ec4bd2dad2bd22ad97cea398ae1cfcfae183a2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 15 Oct 2007 19:27:16 +0100 Subject: mostly the arrangement of conditionals --- lib/sisu/v0/db_import.rb | 67 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 22 deletions(-) (limited to 'lib/sisu/v0/db_import.rb') diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index 91729e3a..6d50fb2b 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -398,7 +398,8 @@ module SiSU_DB_import @col[:lv4]+=1 @col[:lid]+=1 @col[:lev]=4 - @hname=if @col[:seg] and not @col[:seg].to_s.empty? + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? @@hname=@col[:seg].to_s else @@hname end @@ -436,7 +437,8 @@ module SiSU_DB_import @col[:lv5]+=1 @col[:lid]+=1 @col[:lev]=5 - @hname=if @col[:seg] and not @col[:seg].to_s.empty? + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? @@hname=@col[:seg].to_s else @@hname end @@ -474,7 +476,8 @@ module SiSU_DB_import @col[:lv6]+=1 @col[:lid]+=1 @col[:lev]=6 - @hname=if @col[:seg] and not @col[:seg].to_s.empty? + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? @@hname=@col[:seg].to_s else @@hname end @@ -507,7 +510,8 @@ module SiSU_DB_import @col[:lid]+=1 txt='' txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=(/(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/m).match(data).captures - @hname=if @col[:seg] and not @col[:seg].to_s.empty? + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? @@hname=@col[:seg].to_s else @@hname end @@ -523,7 +527,8 @@ module SiSU_DB_import end txt=endnotes(txt).clean_text(@base_url) end - if @sql_type=~/pg/ and txt.size > (document_clean - 1) #% examine pg build & remove limitation + if @sql_type=~/pg/ \ + and txt.size > (document_clean - 1) #% examine pg build & remove limitation puts "\n\nTOO LARGE (TXT - see error log)\n\n" open("#{Dir.pwd}/pg_documents_error_log",'a') do |error| error.puts("\n#{@opt.fns}\nTEXT BODY\n#{@col[:body].size} object #{@col[:ocn]} -> #{@col[:body].slice(0..500)}") @@ -700,54 +705,72 @@ module SiSU_DB_import out=@env.path.output markup,meta,latex,plaintext,html_toc,html_doc,xml_sax,xml_dom,pdf_p,pdf_l,concordance,sisupod='','','','','','','','','','','','' markup_li,meta_li,latex_li,plaintext_li,html_li,xml_sax_li,xml_dom_li,pdf_p_li,pdf_l_li,concordance_li,sisupod_li='','','','','','','','','','','' - if @fnb.empty? or @fnb.nil?; p 'file output path error' #remove + if @fnb.empty? \ + or @fnb.nil? + p 'file output path error' #remove end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:plain]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:plain]}")==true) plaintext,plaintext_li='plaintext,', "'#{base}/#@fnb/#{@md.fn[:plain]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:toc]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:toc]}")==true) html_toc,html_toc_li='html_toc,', "'#{base}/#@fnb/#{@md.fn[:toc]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:doc]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:doc]}")==true) html_doc,html_doc_li='html_doc,', "'#{base}/#@fnb/#{@md.fn[:doc]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:xhtml]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:xhtml]}")==true) xhtml,xhtml_li='xhtml,', "'#{base}/#@fnb/#{@md.fn[:xhtml]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:sax]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:sax]}")==true) xml_sax,xml_sax_li='xml_sax,', "'#{base}/#@fnb/#{@md.fn[:sax]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:dom]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:dom]}")==true) xml_dom,xml_dom_li='xml_dom,', "'#{base}/#@fnb/#{@md.fn[:dom]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:odf]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:odf]}")==true) odf,odf_li='odf,', "'#{base}/#@fnb/#{@md.fn[:odf]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:pdf_p]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:pdf_p]}")==true) pdf_p,pdf_p_li='pdf_p,', "'#{base}/#@fnb/#{@md.fn[:pdf_p]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:pdf_l]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:pdf_l]}")==true) pdf_l,pdf_l_li='pdf_l,', "'#{base}/#@fnb/#{@md.fn[:pdf_l]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:concordance]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:concordance]}")==true) concordance,concordance_li='concordance,', "'#{base}/#@fnb/#{@md.fn[:concordance]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tex")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tex")==true) latex_p,latex_p_li='latex_p,', "'#{base}/#@fnb/#{@opt.fns}.tex'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.landscape.tex")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.landscape.tex")==true) latex_l,latex_l_li='latex_l,', "'#{base}/#@fnb/#@opt.fns}.landscape.tex'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:digest]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:digest]}")==true) digest,digest_li='digest,', "'#{base}/#@fnb/#{@md.fn[:digest]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:manifest]}")==true) #revisit, was to be text, this is html + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:manifest]}")==true) #revisit, was to be text, this is html manifest,manifest_li='manifest,', "'#{base}/#@fnb/#{@md.fn[:manifest]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.meta")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.meta")==true) markup,markup_li='markup,', "'#{base}/#@fnb/#{@opt.fns}.meta'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tgz")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tgz")==true) sisupod,sisupod_li='sisupod,', "'#{base}/#@fnb/#{@opt.fns}.tgz'," end @conn.execute(%{ -- cgit v1.2.3