From dc0648fefb0f43e6432d55d05416a1b38bafeb95 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 10 May 2008 01:38:12 -0400 Subject: addition of a couple of multiline search tags, and minor rearrangement --- lib/sisu/v0/dal.rb | 10 +++++----- lib/sisu/v0/dal_doc_str.rb | 14 ++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 577c3b9e..c5a07f9c 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -663,7 +663,7 @@ module SiSU_DAL @tuned_file=[] object_array=SiSU_document_structure::OCN.new(@md,data).ocn object_array.each do |o| - @tuned_file <<= if o.ocn; "#{o.txt} <~#{o.ocn};#{o.lv};#{o.type}>" + @tuned_file <<= if o.ocn; "#{o.txt} <~#{o.ocn};#{o.lv};#{o.type}>" #main ocn descriptor else o.txt end end @@ -1112,10 +1112,10 @@ module SiSU_DAL if en_plus =~/~\{.+?\}~|~\[.+?\]~/ para_txt,en_open,en_txt,en_close=/(.*?)(~\{|~\[)(.+?)(\}~|\]~)/m.match(en_plus)[1..4] stripped_en=strip_clean_of_markup(en_txt) - if @env.digest.type =~/sha256/ - digest_en_strip=Digest::SHA256.hexdigest(stripped_en) + digest_en_strip=if @env.digest.type =~/sha256/ + Digest::SHA256.hexdigest(stripped_en) else - digest_en_strip=Digest::MD5.hexdigest(stripped_en) + Digest::MD5.hexdigest(stripped_en) end para_txt + en_open + en_txt + '<' + digest_en_strip + '>' + en_close else puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up @@ -1136,7 +1136,7 @@ module SiSU_DAL def strip_clean_of_markup(s) # used for digest, define rules, make same as in db clean #consider: <\/?[ib]>|<(?:\/ )?br>|(.+?)<\/del> s=s.dup - s=s.gsub(/(?:<\/?[ib]>|<~\d+;(?:\w|[0-6]:)\d+;\w\d+>|<#@dp:#@dp>|^[1-6]~\S+|~\{\d+\s.+?\}~)/,'') # markup and endnotes removed + s=s.gsub(/(?:<\/?[ib]>|<~\d+;(?:\w|[0-6]:)\d+;\w\d+>|<#@dp:#@dp>|^[1-6]~\S+|~\{\d+\s.+?\}~)/m,'') # markup and endnotes removed #% same as db clean --> s=s.gsub(/(.+?)<\/del>/,'DELETED(\1)') # deletions s=s.gsub(/(\d+)<\/sup>/,'[\1]') diff --git a/lib/sisu/v0/dal_doc_str.rb b/lib/sisu/v0/dal_doc_str.rb index 27e37826..ebaa8625 100644 --- a/lib/sisu/v0/dal_doc_str.rb +++ b/lib/sisu/v0/dal_doc_str.rb @@ -142,8 +142,6 @@ module SiSU_document_structure data=@data @o_array=[] node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnm=ocnu=ocnk=0 # h heading, o other, t table, g group, i image - number_small,letter_small=0,0 - letter=%w( a b c d e f g h i j k l m n o p q r s t u v w x y z ) node_count_flag=false headings='' #where headings omitted an alternative form of ocn heading numbering is required for html and other linking... #headings=if @md.ocn.inspect =~/skip=headings/; '^(?:[A-C]|[1-9])~\S* |' @@ -173,7 +171,7 @@ module SiSU_document_structure ocnh+=1 if para=~/^1~(?:\s+|\S)/ \ or para =~@md.lv1 - ocnh1+=1 + ocnh1+=1 #heading ocn_dv,ocn_sp="1:#{ocnh1}","h#{ocnh}" elsif para=~/^2~(?:\s+|\S)/ \ or para =~@md.lv2; ocnh2+=1 @@ -193,15 +191,15 @@ module SiSU_document_structure end else ocno+=1 - if para=~//; ocnt+=1 #tables + if para=~//; ocnt+=1 #table ocn_dv,ocn_sp="o#{ocno}","t#{ocnt}" - elsif para=~/^<:code>/; ocnc+=1 + elsif para=~/^<:code>/; ocnc+=1 #code block ocn_dv,ocn_sp="o#{ocno}","c#{ocnc}" - elsif para=~/^<:(?:group|alt|verse)>/; ocng+=1 + elsif para=~/^<:(?:group|alt|verse)>/; ocng+=1 #group, poem ocn_dv,ocn_sp="o#{ocno}","g#{ocng}" - elsif para=~/\{\S+?\.(?:png|jpg|gif)\s+/m; ocni+=1 + elsif para=~/\{\S+?\.(?:png|jpg|gif)\s+/m; ocni+=1 #image ocn_dv,ocn_sp="o#{ocno}","i#{ocni}" - else ocnp+=1 + else ocnp+=1 #paragraph ocn_dv,ocn_sp="o#{ocno}","p#{ocnp}" end end -- cgit v1.2.3 From d004875c53f756f9f09c69ef90b3484e23bc5760 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 10 May 2008 01:42:14 -0400 Subject: some re-arrangement related to sqlite3 testing (including a rudimentary sql import file, dbi by-pass) --- lib/sisu/v0/db_create.rb | 8 +++--- lib/sisu/v0/db_drop.rb | 4 +-- lib/sisu/v0/db_import.rb | 55 +++++++++++++++++++++++----------------- lib/sisu/v0/db_indexes.rb | 4 +-- lib/sisu/v0/db_load_tuple.rb | 60 +++++++++++++++++++++++--------------------- lib/sisu/v0/db_remove.rb | 47 ++++++++++++++++++++-------------- lib/sisu/v0/db_select.rb | 46 +++++++++++++++++++++++++-------- lib/sisu/v0/db_tests.rb | 8 +++--- 8 files changed, 139 insertions(+), 93 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/db_create.rb b/lib/sisu/v0/db_create.rb index bf622bef..95803324 100644 --- a/lib/sisu/v0/db_create.rb +++ b/lib/sisu/v0/db_create.rb @@ -64,8 +64,8 @@ module SiSU_DB_create class Create < SiSU_DB_columns::Column_size require "#{SiSU_lib}/sysenv" @@dl=nil - def initialize(opt,conn='',sql_type='pg') - @opt,@conn,@sql_type=opt,conn,sql_type + def initialize(opt,conn,file,sql_type='pg') + @opt,@conn,@file,@sql_type=opt,conn,file,sql_type @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX @comment=Comment.new(@sql_type) @@dl ||=SiSU_Env::Info_env.new.digest.length @@ -86,7 +86,9 @@ module SiSU_DB_create end def output_dir? dir=SiSU_Env::Info_env.new('') - if @opt.cmd =~/d/; dir.path.webserv_stub_ensure + if @opt.cmd =~/d/ + #p dir.path.webserv_stub_ensure.inspect + dir.path.webserv_stub_ensure end end def create_table diff --git a/lib/sisu/v0/db_drop.rb b/lib/sisu/v0/db_drop.rb index fc7b7b61..bd5e647f 100644 --- a/lib/sisu/v0/db_drop.rb +++ b/lib/sisu/v0/db_drop.rb @@ -61,8 +61,8 @@ =end module SiSU_DB_drop class Drop - def initialize(opt,conn='',sql_type='') - @opt,@conn,@sql_type=opt,conn,sql_type + def initialize(opt,conn,file,sql_type='') + @opt,@conn,@file,@sql_type=opt,conn,file,sql_type end def drop def tables #% drop all tables diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index 646ea176..cb68ffd6 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -70,8 +70,8 @@ module SiSU_DB_import @@dl=nil @@hname=nil attr_accessor :tp - def initialize(opt,conn='',sql_type='pg') - @opt,@conn,@sql_type=opt,conn,sql_type + def initialize(opt,conn,file,sql_type='pg') + @opt,@conn,@file,@sql_type=opt,conn,file,sql_type @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX @env=SiSU_Env::Info_env.new(@opt.fns) @dal="#{@env.path.dal}" @@ -113,17 +113,22 @@ module SiSU_DB_import tell.print_grey if @opt.cmd =~/v/ case @sql_type when /sqlite/ #fix logic for sqlite ! - import_db_metadata(@dal_array) - import_documents(@dal_array) - import_db_urls(@dal_array,@fnm) #import OID on/off - #@conn.commit #sqlite watch + #pf_db_import_transaction_open if @opt =~/M/ + db_import_metadata + db_import_documents(@dal_array) + db_import_urls(@dal_array,@fnm) #import OID on/off + #pf_db_import_transaction_close if @opt =~/M/ + #@conn.commit + #@conn.close + #@conn.disconnect +#sqlite watch else file_exist=@conn.select_one(%{ SELECT metadata.tid FROM metadata WHERE metadata.filename ~ '#{@opt.fns}'; }) unless file_exist @conn.execute('BEGIN') - import_db_metadata(@dal_array) - import_documents(@dal_array) - import_db_urls(@dal_array,@fnm) #import OID on/off + db_import_metadata + db_import_documents(@dal_array) + db_import_urls(@dal_array,@fnm) #import OID on/off @conn.execute('COMMIT') else @db=SiSU_Env::Info_db.new @@ -153,7 +158,11 @@ module SiSU_DB_import string.strip! end #% import into database tables - def import_db_metadata(dbi_unit) #% import documents - populate database + def pf_db_import_transaction_open + end + def pf_db_import_transaction_close + end + def db_import_metadata #% import documents - populate database print %{ #{@cX.grey}import documents dbi_unit #{@cX.off} } unless @opt.cmd =~/q/ @tp={} @md=SiSU_Param::Parameters.new(@opt).get @@ -354,17 +363,17 @@ module SiSU_DB_import #end #if @md.ruby_version; special_character_escape(@md.ruby_version) SiSU_DB_DBI::Test.new(self,@opt).verify #% import title names, filenames (tuple) - t=SiSU_DB_tuple::Load_metadata.new(@conn,@tp,@@id_t) + t=SiSU_DB_tuple::Load_metadata.new(@conn,@tp,@@id_t,@opt,@file) t.tuple end - def import_documents(dbi_unit) #% import documents - populate main database table + def db_import_documents(dal_array) #% import documents - populate main database table #% import into substantive database tables (tuple) begin @col[:tid]=@@id_t @en,@en_ast,@en_pls=[],[],[] @col[:en_a]=nil @col[:en_z]=nil - dbi_unit.each do |data| + dal_array.each do |data| #data.gsub!(/<[biu]>(.+?)<\/[biu]>/,'\1') # remove bold, italics, underscore data.gsub!(/(.+?)<\/b>/,'\1') # remove bold, italics, underscore data.gsub!(/(.+?)<\/i>/,'\1') # remove bold, italics, underscore @@ -396,7 +405,7 @@ module SiSU_DB_import end if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last end - t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt) + t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file) t.tuple case @col[:lev] when /1/; @col[:lv1]+=1 @@ -437,7 +446,7 @@ module SiSU_DB_import end if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last end - t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt) + t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file) t.tuple @col[:lev]=@col[:plaintext]=@col[:body]='' elsif data[/^5~(?:~\S+)?(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/] # header lev5 seg level @@ -476,7 +485,7 @@ module SiSU_DB_import end if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last end - t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt) + t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file) t.tuple @col[:lev]=@col[:plaintext]=@col[:body]='' elsif data[/^6~(?:~\S+)?(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/] # header lev6 seg level @@ -515,7 +524,7 @@ module SiSU_DB_import end if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last end - t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt) + t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file) t.tuple @col[:lev]=@col[:plaintext]=@col[:body]='' else #% regular text @@ -565,7 +574,7 @@ module SiSU_DB_import special_character_escape(@col[:body]) @col[:plaintext]=@col[:body].dup strip_markup(@col[:plaintext]) - t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt) + t=SiSU_DB_tuple::Load_documents.new(@conn,@col,@opt,@file) t.tuple @en,@en_ast,@en_pls=[],[],[] @col[:en_a]=@col[:en_z]=nil @@ -604,7 +613,7 @@ module SiSU_DB_import :id_t => @@id_t, :hash => digest_clean } - t=SiSU_DB_tuple::Load_endnotes.new(@conn,en) + t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file) t.tuple end end @@ -645,7 +654,7 @@ module SiSU_DB_import :id_t => @@id_t, :hash => digest_clean } - t=SiSU_DB_tuple::Load_endnotes.new(@conn,en) + t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file) t.tuple end end @@ -685,7 +694,7 @@ module SiSU_DB_import :id_t => @@id_t, :hash => digest_clean } - t=SiSU_DB_tuple::Load_endnotes.new(@conn,en) + t=SiSU_DB_tuple::Load_endnotes.new(@conn,en,@opt,@file) t.tuple end end @@ -743,7 +752,7 @@ module SiSU_DB_import end self end - def import_db_urls(dbi_unit,meta) #% import documents OID - populate database + def db_import_urls(dbi_unit,meta) #% import documents OID - populate database begin @fnm=meta @env=SiSU_Env::Info_env.new(@opt.fns) @@ -818,7 +827,7 @@ module SiSU_DB_import or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tgz")==true) f[:sisupod],u[:sisupod]='sisupod,', "'#{base}/#@fnb/#{@opt.fns}.tgz'," end - t=SiSU_DB_tuple::Load_urls.new(@conn,f,u,@@id_t) + t=SiSU_DB_tuple::Load_urls.new(@conn,f,u,@@id_t,@opt,@file) t.tuple rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure diff --git a/lib/sisu/v0/db_indexes.rb b/lib/sisu/v0/db_indexes.rb index ff7a8156..faf2b720 100644 --- a/lib/sisu/v0/db_indexes.rb +++ b/lib/sisu/v0/db_indexes.rb @@ -61,8 +61,8 @@ =end module SiSU_DB_index class Index # create documents Indexes def initialize(opt,conn='',sql_type='') - def initialize(opt,conn='',sql_type='') - @opt,@conn,@sql_type=opt,conn,sql_type + def initialize(opt,conn,file,sql_type='') + @opt,@conn,@file,@sql_type=opt,conn,file,sql_type end def create_indexes # check added from pg not tested def base diff --git a/lib/sisu/v0/db_load_tuple.rb b/lib/sisu/v0/db_load_tuple.rb index 5e80623b..cb0278fb 100644 --- a/lib/sisu/v0/db_load_tuple.rb +++ b/lib/sisu/v0/db_load_tuple.rb @@ -63,8 +63,8 @@ module SiSU_DB_tuple class Load_documents require "#{SiSU_lib}/param" include SiSU_Param - def initialize(conn,col,opt) - @conn,@col,@opt=conn,col,opt + def initialize(conn,col,opt,file) + @conn,@col,@opt,@file=conn,col,opt,file @col[:lev]=@col[:lev].to_i unless @col[:lev]=~/^[1-6]/ \ or @col[:lev]==1 \ @@ -80,16 +80,14 @@ module SiSU_DB_tuple end def tuple #% import line begin - if @col[:en_a] - #SQL_TEST_FILE.puts "INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" #if @opt.cmd =~/M/ - @conn.execute(%{ - INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}'); - }) + sql_entry=if @col[:en_a] + "INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" else - #SQL_TEST_FILE.puts "INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" #if @opt.cmd =~/M/ - @conn.execute(%{ - INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}'); - }) + "INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" + end + if @opt.cmd =~/M/ + @file.puts sql_entry + else @conn.execute(sql_entry) end if @opt.cmd =~/v/ if @col[:lev].inspect =~/[1235678]/ @@ -112,36 +110,40 @@ module SiSU_DB_tuple end end class Load_metadata - def initialize(conn,tp,id) - @conn,@tp,@id=conn,tp,id + def initialize(conn,tp,id,opt,file) + @conn,@tp,@id,@opt,@file=conn,tp,id,opt,file end def tuple - #SQL_TEST_FILE.puts "INSERT INTO metadata (#{@tp[:fns_f]} #{@tp[:suffix_f]} #{@tp[:title_f]} #{@tp[:subtitle_f]} #{@tp[:creator_f]} #{@tp[:illustrator_f]} #{@tp[:translator_f]} #{@tp[:subject_f]} #{@tp[:description_f]} #{@tp[:publisher_f]} #{@tp[:contributor_f]} #{@tp[:prepared_by_f]} #{@tp[:digitized_by_f]} #{@tp[:date_f]} #{@tp[:date_created_f]} #{@tp[:date_issued_f]} #{@tp[:date_valid_f]} #{@tp[:date_available_f]} #{@tp[:date_modified_f]} #{@tp[:type_f]} #{@tp[:format_f]} #{@tp[:identifier_f]} #{@tp[:source_f]} #{@tp[:language_f]} #{@tp[:language_original_f]} #{@tp[:relation_f]} #{@tp[:coverage_f]} #{@tp[:rights_f]} #{@tp[:copyright_f]} #{@tp[:owner_f]} #{@tp[:keywords_f]} #{@tp[:abstract_f]} #{@tp[:comment_f]} #{@tp[:loc_f]} #{@tp[:dewey_f]} #{@tp[:isbn_f]} #{@tp[:pg_f]} #{@tp[:prefix_a_f]} #{@tp[:prefix_b_f]} tid) VALUES (#{@tp[:fns_i]} #{@tp[:suffix_i]} #{@tp[:title_i]} #{@tp[:subtitle_i]} #{@tp[:creator_i]} #{@tp[:illustrator_i]} #{@tp[:translator_i]} #{@tp[:subject_i]} #{@tp[:description_i]} #{@tp[:publisher_i]} #{@tp[:contributor_i]} #{@tp[:prepared_by_i]} #{@tp[:digitized_by_i]} #{@tp[:date_i]} #{@tp[:date_created_i]} #{@tp[:date_issued_i]} #{@tp[:date_valid_i]} #{@tp[:date_available_i]} #{@tp[:date_modified_i]} #{@tp[:type_i]} #{@tp[:format_i]} #{@tp[:identifier_i]} #{@tp[:source_i]} #{@tp[:language_i]} #{@tp[:language_original_i]} #{@tp[:relation_i]} #{@tp[:coverage_i]} #{@tp[:rights_i]} #{@tp[:copyright_i]} #{@tp[:owner_i]} #{@tp[:keywords_i]} #{@tp[:abstract_i]} #{@tp[:comment_i]} #{@tp[:loc_i]} #{@tp[:dewey_i]} #{@tp[:isbn_i]} #{@tp[:pg_i]} #{@tp[:prefix_a_i]} #{@tp[:prefix_b_i]} #{@id});" #if @opt.cmd =~/M/ - @conn.execute(%{ - INSERT INTO metadata (#{@tp[:fns_f]} #{@tp[:suffix_f]} #{@tp[:title_f]} #{@tp[:subtitle_f]} #{@tp[:creator_f]} #{@tp[:illustrator_f]} #{@tp[:translator_f]} #{@tp[:subject_f]} #{@tp[:description_f]} #{@tp[:publisher_f]} #{@tp[:contributor_f]} #{@tp[:prepared_by_f]} #{@tp[:digitized_by_f]} #{@tp[:date_f]} #{@tp[:date_created_f]} #{@tp[:date_issued_f]} #{@tp[:date_valid_f]} #{@tp[:date_available_f]} #{@tp[:date_modified_f]} #{@tp[:type_f]} #{@tp[:format_f]} #{@tp[:identifier_f]} #{@tp[:source_f]} #{@tp[:language_f]} #{@tp[:language_original_f]} #{@tp[:relation_f]} #{@tp[:coverage_f]} #{@tp[:rights_f]} #{@tp[:copyright_f]} #{@tp[:owner_f]} #{@tp[:keywords_f]} #{@tp[:abstract_f]} #{@tp[:comment_f]} #{@tp[:loc_f]} #{@tp[:dewey_f]} #{@tp[:isbn_f]} #{@tp[:pg_f]} #{@tp[:prefix_a_f]} #{@tp[:prefix_b_f]} tid) VALUES (#{@tp[:fns_i]} #{@tp[:suffix_i]} #{@tp[:title_i]} #{@tp[:subtitle_i]} #{@tp[:creator_i]} #{@tp[:illustrator_i]} #{@tp[:translator_i]} #{@tp[:subject_i]} #{@tp[:description_i]} #{@tp[:publisher_i]} #{@tp[:contributor_i]} #{@tp[:prepared_by_i]} #{@tp[:digitized_by_i]} #{@tp[:date_i]} #{@tp[:date_created_i]} #{@tp[:date_issued_i]} #{@tp[:date_valid_i]} #{@tp[:date_available_i]} #{@tp[:date_modified_i]} #{@tp[:type_i]} #{@tp[:format_i]} #{@tp[:identifier_i]} #{@tp[:source_i]} #{@tp[:language_i]} #{@tp[:language_original_i]} #{@tp[:relation_i]} #{@tp[:coverage_i]} #{@tp[:rights_i]} #{@tp[:copyright_i]} #{@tp[:owner_i]} #{@tp[:keywords_i]} #{@tp[:abstract_i]} #{@tp[:comment_i]} #{@tp[:loc_i]} #{@tp[:dewey_i]} #{@tp[:isbn_i]} #{@tp[:pg_i]} #{@tp[:prefix_a_i]} #{@tp[:prefix_b_i]} #{@id}); - }) + sql_entry="INSERT INTO metadata (#{@tp[:fns_f]} #{@tp[:suffix_f]} #{@tp[:title_f]} #{@tp[:subtitle_f]} #{@tp[:creator_f]} #{@tp[:illustrator_f]} #{@tp[:translator_f]} #{@tp[:subject_f]} #{@tp[:description_f]} #{@tp[:publisher_f]} #{@tp[:contributor_f]} #{@tp[:prepared_by_f]} #{@tp[:digitized_by_f]} #{@tp[:date_f]} #{@tp[:date_created_f]} #{@tp[:date_issued_f]} #{@tp[:date_valid_f]} #{@tp[:date_available_f]} #{@tp[:date_modified_f]} #{@tp[:type_f]} #{@tp[:format_f]} #{@tp[:identifier_f]} #{@tp[:source_f]} #{@tp[:language_f]} #{@tp[:language_original_f]} #{@tp[:relation_f]} #{@tp[:coverage_f]} #{@tp[:rights_f]} #{@tp[:copyright_f]} #{@tp[:owner_f]} #{@tp[:keywords_f]} #{@tp[:abstract_f]} #{@tp[:comment_f]} #{@tp[:loc_f]} #{@tp[:dewey_f]} #{@tp[:isbn_f]} #{@tp[:pg_f]} #{@tp[:prefix_a_f]} #{@tp[:prefix_b_f]} tid) VALUES (#{@tp[:fns_i]} #{@tp[:suffix_i]} #{@tp[:title_i]} #{@tp[:subtitle_i]} #{@tp[:creator_i]} #{@tp[:illustrator_i]} #{@tp[:translator_i]} #{@tp[:subject_i]} #{@tp[:description_i]} #{@tp[:publisher_i]} #{@tp[:contributor_i]} #{@tp[:prepared_by_i]} #{@tp[:digitized_by_i]} #{@tp[:date_i]} #{@tp[:date_created_i]} #{@tp[:date_issued_i]} #{@tp[:date_valid_i]} #{@tp[:date_available_i]} #{@tp[:date_modified_i]} #{@tp[:type_i]} #{@tp[:format_i]} #{@tp[:identifier_i]} #{@tp[:source_i]} #{@tp[:language_i]} #{@tp[:language_original_i]} #{@tp[:relation_i]} #{@tp[:coverage_i]} #{@tp[:rights_i]} #{@tp[:copyright_i]} #{@tp[:owner_i]} #{@tp[:keywords_i]} #{@tp[:abstract_i]} #{@tp[:comment_i]} #{@tp[:loc_i]} #{@tp[:dewey_i]} #{@tp[:isbn_i]} #{@tp[:pg_i]} #{@tp[:prefix_a_i]} #{@tp[:prefix_b_i]} #{@id});" + if @opt.cmd =~/M/ + puts "maintenance mode on: creating sql transaction file (for last transaction set (document) only):\n\t#{@file.inspect}" + @file.puts sql_entry + else @conn.execute(%{#{sql_entry}}) + end end end class Load_urls - def initialize(conn,f,u,id) - @conn,@f,@u,@id=conn,f,u,id + def initialize(conn,f,u,id,opt,file) + @conn,@f,@u,@id,@opt,@file=conn,f,u,id,opt,file end def tuple - #SQL_TEST_FILE.puts "INSERT INTO urls (#{@f[:txt]} #{@f[:html_toc]} #{@f[:html_doc]} #{@f[:xhtml]} #{@f[:xml_sax]} #{@f[:xml_dom]} #{@f[:odf]} #{@f[:pdf_p]} #{@f[:pdf_l]} #{@f[:concordance]} #{@f[:latex_p]} #{@f[:latex_l]} #{@f[:manifest]} #{@f[:digest]} #{@f[:markup]} #{@f[:sisupod]} metadata_tid) VALUES (#{@u[:txt]} #{@u[:html_toc]} #{@u[:html_doc]} #{@u[:xhtml]} #{@u[:xml_sax]} #{@u[:xml_dom]} #{@u[:odf]} #{@u[:pdf_p]} #{@u[:pdf_l]} #{@u[:concordance]} #{@u[:latex_p]} #{@u[:latex_l]} #{@u[:manifest]} #{@u[:digest]} #{@u[:markup]} #{@u[:sisupod]} #{@id});" #if @opt.cmd =~/M/ - @conn.execute(%{ - INSERT INTO urls (#{@f[:txt]} #{@f[:html_toc]} #{@f[:html_doc]} #{@f[:xhtml]} #{@f[:xml_sax]} #{@f[:xml_dom]} #{@f[:odf]} #{@f[:pdf_p]} #{@f[:pdf_l]} #{@f[:concordance]} #{@f[:latex_p]} #{@f[:latex_l]} #{@f[:manifest]} #{@f[:digest]} #{@f[:markup]} #{@f[:sisupod]} metadata_tid) VALUES (#{@u[:txt]} #{@u[:html_toc]} #{@u[:html_doc]} #{@u[:xhtml]} #{@u[:xml_sax]} #{@u[:xml_dom]} #{@u[:odf]} #{@u[:pdf_p]} #{@u[:pdf_l]} #{@u[:concordance]} #{@u[:latex_p]} #{@u[:latex_l]} #{@u[:manifest]} #{@u[:digest]} #{@u[:markup]} #{@u[:sisupod]} #{@id}); - }) + sql_entry="INSERT INTO urls (#{@f[:txt]} #{@f[:html_toc]} #{@f[:html_doc]} #{@f[:xhtml]} #{@f[:xml_sax]} #{@f[:xml_dom]} #{@f[:odf]} #{@f[:pdf_p]} #{@f[:pdf_l]} #{@f[:concordance]} #{@f[:latex_p]} #{@f[:latex_l]} #{@f[:manifest]} #{@f[:digest]} #{@f[:markup]} #{@f[:sisupod]} metadata_tid) VALUES (#{@u[:txt]} #{@u[:html_toc]} #{@u[:html_doc]} #{@u[:xhtml]} #{@u[:xml_sax]} #{@u[:xml_dom]} #{@u[:odf]} #{@u[:pdf_p]} #{@u[:pdf_l]} #{@u[:concordance]} #{@u[:latex_p]} #{@u[:latex_l]} #{@u[:manifest]} #{@u[:digest]} #{@u[:markup]} #{@u[:sisupod]} #{@id});" + if @opt.cmd =~/M/ + @file.puts sql_entry + else @conn.execute(%{#{sql_entry}}) + end end end class Load_endnotes - def initialize(conn,en) - @conn,@en=conn,en + def initialize(conn,en,opt,file) + @conn,@en,@opt,@file=conn,en,opt,file end def tuple - #SQL_TEST_FILE.puts "INSERT INTO #{@en[:type]} (nid, document_lid, nr, clean, body, ocn, ocnd, ocns, metadata_tid, digest_clean) VALUES ('#{@en[:id]}', '#{@en[:lid]}', '#{@en[:nr]}', '#{@en[:txt]}', '#{@en[:body]}', '#{@en[:ocn]}', '#{@en[:ocnd]}', '#{@en[:ocns]}', '#{@en[:id_t]}', '#{@en[:hash]}');" #if @opt.cmd =~/M/ - @conn.execute(%{ - INSERT INTO #{@en[:type]} (nid, document_lid, nr, clean, body, ocn, ocnd, ocns, metadata_tid, digest_clean) VALUES ('#{@en[:id]}', '#{@en[:lid]}', '#{@en[:nr]}', '#{@en[:txt]}', '#{@en[:body]}', '#{@en[:ocn]}', '#{@en[:ocnd]}', '#{@en[:ocns]}', '#{@en[:id_t]}', '#{@en[:hash]}'); - }) + sql_entry="INSERT INTO #{@en[:type]} (nid, document_lid, nr, clean, body, ocn, ocnd, ocns, metadata_tid, digest_clean) VALUES ('#{@en[:id]}', '#{@en[:lid]}', '#{@en[:nr]}', '#{@en[:txt]}', '#{@en[:body]}', '#{@en[:ocn]}', '#{@en[:ocnd]}', '#{@en[:ocns]}', '#{@en[:id_t]}', '#{@en[:hash]}');" + if @opt.cmd =~/M/ + @file.puts sql_entry + else @conn.execute(%{#{sql_entry}}) + end end end end diff --git a/lib/sisu/v0/db_remove.rb b/lib/sisu/v0/db_remove.rb index 63d69b64..bb88af58 100644 --- a/lib/sisu/v0/db_remove.rb +++ b/lib/sisu/v0/db_remove.rb @@ -61,8 +61,8 @@ =end module SiSU_DB_remove class Remove - def initialize(opt,conn='' ) - @opt,@conn=opt,conn + def initialize(opt,conn,file) + @opt,@conn,@file=opt,conn,file @md=SiSU_Param::Parameters.new(@opt).get @fnb=@md.fnb @db=SiSU_Env::Info_db.new @@ -72,23 +72,18 @@ module SiSU_DB_remove if del del_id=del.join #@conn.execute("BEGIN") - @conn.execute(%{ - DELETE FROM endnotes WHERE metadata_tid = '#{del_id}'; - DELETE FROM endnotes_asterisk WHERE metadata_tid = '#{del_id}'; - DELETE FROM endnotes_plus WHERE metadata_tid = '#{del_id}'; - DELETE FROM documents WHERE metadata_tid = '#{del_id}'; - DELETE FROM urls WHERE metadata_tid = '#{del_id}'; - DELETE FROM metadata WHERE tid = '#{del_id}'; - /* - DELETE FROM documents WHERE documents.metadata_tid = '#{del_id}'; - DELETE FROM endnotes WHERE endnotes.metadata_tid = '#{del_id}'; - DELETE FROM endnotes_asterisk WHERE endnotes_asterisk.metadata_tid = '#{del_id}'; - DELETE FROM endnotes_plus WHERE endnotes_plus.metadata_tid = '#{del_id}'; - DELETE FROM urls WHERE urls.metadata_tid = '#{del_id}'; - DELETE FROM metadata WHERE metadata.tid = '#{del_id}'; - */ - }) - #@conn.execute("COMMIT") + sql_entry=<@ck.lt_dewey puts @ck.tp[:isbn].length.to_s + ' checklength ' + @ck.tp[:isbn] if @ck.tp[:isbn] and @ck.tp[:isbn].length >@ck.lt_isbn puts @ck.tp[:pg].length.to_s + ' checklength ' + @ck.tp[:pg] if @ck.tp[:pg] and @ck.tp[:pg].length >@ck.lt_pg - puts @ck.tp[:date] if @ck.tp[:date] !~/\d\d-\d\d-\d\d/ + puts @ck.tp[:date] if @ck.tp[:date] and not @ck.tp[:date].empty? and @ck.tp[:date] !~/\d\d-\d\d-\d\d/ end end end -- cgit v1.2.3 From 738c2473c18aacf22ce1e4815ca92ce13f82a16a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 10 May 2008 11:59:30 -0400 Subject: syenv updates, mostly sql related --- lib/sisu/v0/sysenv.rb | 62 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 2e24954c..22a0bc4a 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -149,6 +149,8 @@ module SiSU_Env PROCESSING_LATEX=:processing_latex PROCESSING_TEXINFO=:processing_texinfo PROCESSING_LOUT=:processing_lout + PROCESSING_SQLITE=:processing_sqlite + PROCESSING_POSTGRESQL=:processing_postgresql PROCESSING_ENCODING=:processing_encoding PAPERSIZE=:papersize LANGUAGE=:language @@ -189,6 +191,8 @@ module SiSU_Env PROCESSING_LATEX => 'tex', PROCESSING_TEXINFO => 'texinfo', PROCESSING_LOUT => 'lout', + PROCESSING_SQLITE => 'sqlite', + PROCESSING_POSTGRESQL=> 'postgresql', PROCESSING_ENCODING => 'encoding', #TEXINFO_STUB => 'texinfo', PAPERSIZE => 'A4', #A4, US_letter, book_b5, book_a5, US_legal @@ -1423,15 +1427,21 @@ WOK pth end def dal - pth=if defined? @rc['processing']['dal']; "#{processing}/#{@rc['processing']['dal']}" - else "#{processing}/#{defaults[:processing_dal]}" + pth=if defined? @rc['processing']['dal'] \ + and not @rc['processing']['dal'].nil? \ + and not @rc['processing']['dal'].empty? + "#{processing}/#{@rc['processing']['dal']}" + else "#{processing}/#{defaults[:processing_dal]}" end mkdir_p(pth) unless FileTest.directory?(pth) pth end def tune - pth=if defined? @rc['processing']['tune']; "#{processing}/#{@rc['processing']['tune']}" - else "#{processing}/#{defaults[:processing_tune]}" + pth=if defined? @rc['processing']['tune'] \ + and not @rc['processing']['tune'].nil? \ + and not @rc['processing']['tune'].empty? + "#{processing}/#{@rc['processing']['tune']}" + else "#{processing}/#{defaults[:processing_tune]}" end mkdir_p(pth) unless FileTest.directory?(pth) pth @@ -1440,15 +1450,21 @@ WOK "#{processing}/odf" end def tex - pth=if defined? @rc['processing']['latex']; "#{processing}/#{@rc['processing']['latex']}" - else "#{processing}/#{defaults[:processing_latex]}" + pth=if defined? @rc['processing']['latex'] \ + and not @rc['processing']['latex'].nil? \ + and not @rc['processing']['latex'].empty? + "#{processing}/#{@rc['processing']['latex']}" + else "#{processing}/#{defaults[:processing_latex]}" end mkdir_p(pth) unless FileTest.directory?(pth) pth end def texi - pth=if defined? @rc['processing']['texinfo']; "#{processing}/#{@rc['processing']['texinfo']}" - else "#{processing}/#{defaults[:processing_texinfo]}" + pth=if defined? @rc['processing']['texinfo'] \ + and not @rc['processing']['texinfo'].nil? \ + and not @rc['processing']['texinfo'].empty? + "#{processing}/#{@rc['processing']['texinfo']}" + else "#{processing}/#{defaults[:processing_texinfo]}" end mkdir_p(pth) unless FileTest.directory?(pth) pth @@ -1457,8 +1473,31 @@ WOK "#{processing}/#{defaults[:processing_texinfo]}" end def lout - pth=if defined? @rc['processing']['lout']; "#{processing}/#{@rc['processing']['lout']}" - else "#{processing}/#{defaults[:processing_lout]}" + pth=if defined? @rc['processing']['lout'] \ + and not @rc['processing']['lout'].nil? \ + and not @rc['processing']['lout'].empty? + "#{processing}/#{@rc['processing']['lout']}" + else "#{processing}/#{defaults[:processing_lout]}" + end + mkdir_p(pth) unless FileTest.directory?(pth) + pth + end + def sqlite + pth=if defined? @rc['processing']['sqlite'] \ + and not @rc['processing']['sqlite'].nil? \ + and not @rc['processing']['sqlite'].empty? + "#{processing}/#{@rc['processing']['sqlite']}" + else "#{processing}/#{defaults[:processing_sqlite]}" + end + mkdir_p(pth) unless FileTest.directory?(pth) + pth + end + def postgresql + pth=if defined? @rc['processing']['postgresql'] \ + and not @rc['processing']['postgresql'].nil? \ + and not @rc['processing']['postgresql'].empty? + "#{processing}/#{@rc['processing']['postgresql']}" + else "#{processing}/#{defaults[:processing_postgresql]}" end mkdir_p(pth) unless FileTest.directory?(pth) pth @@ -1475,9 +1514,6 @@ WOK if defined? @rc['project']['path']; "#{home}/#{@rc['project']['path']}" end end - def sqlite - "#{home}/sqlite" - end def cgi if defined? @rc['webserv']['cgi']; "#{@rc['webserv']['cgi']}" else defaults[:webserv_cgi] -- cgit v1.2.3 From 34cee0148a445bcee5e97997575b7323df0a02b9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 10 May 2008 12:07:29 -0400 Subject: introduced particulars (rename later) for commonly used document and environment details, and cleaned up some requires --- lib/sisu/v0/concordance.rb | 33 ++++------- lib/sisu/v0/digests.rb | 23 +++----- lib/sisu/v0/html.rb | 32 +++++------ lib/sisu/v0/html_format.rb | 3 - lib/sisu/v0/html_format_css.rb | 2 - lib/sisu/v0/html_tune.rb | 2 - lib/sisu/v0/hub.rb | 7 ++- lib/sisu/v0/odf.rb | 42 ++++++-------- lib/sisu/v0/odf_format.rb | 2 +- lib/sisu/v0/particulars.rb | 121 +++++++++++++++++++++++++++++++++++++++ lib/sisu/v0/sst_to_s_xml_dom.rb | 29 +++++----- lib/sisu/v0/sst_to_s_xml_node.rb | 28 ++++----- lib/sisu/v0/sst_to_s_xml_sax.rb | 28 ++++----- lib/sisu/v0/texpdf.rb | 37 ++++++------ lib/sisu/v0/texpdf_format.rb | 2 - lib/sisu/v0/urls.rb | 12 ++-- lib/sisu/v0/xhtml.rb | 27 ++++----- lib/sisu/v0/xml.rb | 24 ++++---- lib/sisu/v0/xml_dom.rb | 24 ++++---- lib/sisu/v0/xml_scaffold.rb | 7 ++- 20 files changed, 283 insertions(+), 202 deletions(-) create mode 100644 lib/sisu/v0/particulars.rb (limited to 'lib') diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index 1b5bbe78..1b777bb5 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -60,23 +60,22 @@ =end module SiSU_Concordance - require "#{SiSU_lib}/param" + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/sysenv" - require "#{SiSU_lib}/defaults" - require "#{SiSU_lib}/dal" - include SiSU_Param include SiSU_Env + require "#{SiSU_lib}/defaults" include SiSU_Viz require "#{SiSU_lib}/html_format_css" include SiSU_HTML_Format class Source def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) end def read begin - @md=SiSU_Param::Parameters.new(@opt).get - @env=SiSU_Env::Info_env.new(@md.fns) + @env,@md=@particulars.env,@particulars.md loc=@env.url.output_tell tool=if @md.cmd =~/[MVv]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" else '' @@ -86,7 +85,7 @@ module SiSU_Concordance wordmax=@env.concord_max unless @md.wc_words.nil? if @md.wc_words < wordmax - SiSU_Concordance::Source::Words.new(@md).songsheet + SiSU_Concordance::Source::Words.new(@particulars).songsheet else tell=SiSU_Screen::Ansi.new(@md.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})") tell.warn unless @md.cmd =~/q/ @@ -94,7 +93,7 @@ module SiSU_Concordance else tell=SiSU_Screen::Ansi.new(@md.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words") tell.warn unless @md.cmd =~/q/ - SiSU_Concordance::Source::Words.new(@md).songsheet + SiSU_Concordance::Source::Words.new(@particulars).songsheet end rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error ensure @@ -102,22 +101,18 @@ module SiSU_Concordance end private class Doc_title - require "#{SiSU_lib}/param" - include SiSU_Param include SiSU_Viz #revisit, both requires (html & shared_xml) needed for stand alone operation (sisu -w [filename]) require "#{SiSU_lib}/shared_xml" require "#{SiSU_lib}/html" - def initialize(lnk,md) - @md=md + def initialize(lnk,env,md) + @env,@md=env,md @vz=SiSU_Env::Get_init.instance.skin - @env=SiSU_Env::Info_env.new(@md.fns) file_array=@env.read_source_file(@md.fns) txt_path=%{#{@md.dir_out}} SiSU_Env::Info_skin.new(@md).select @md_title=@md.title @fnb=@md.fnb - @env=SiSU_Env::Info_env.new @lex_button=%{SiSU home -->} @lnk=lnk @doc_details =<<#@dp:#@dp>$") @@ -292,7 +283,7 @@ WOK end scr='Full Text scroll: doc#  ' seg='' - @file_index_all << SiSU_Concordance::Source::Doc_title.new('toc',@md).create + @file_index_all << SiSU_Concordance::Source::Doc_title.new('toc',@env,@md).create for word in @freq.keys.sort! {|a,b| a.downcase<=>b.downcase} keyword=SiSU_Concordance::Source::Word.new(word,@freq[word]).html if keyword !~ @rxp_excluded0 diff --git a/lib/sisu/v0/digests.rb b/lib/sisu/v0/digests.rb index 0d2707ff..0c859010 100644 --- a/lib/sisu/v0/digests.rb +++ b/lib/sisu/v0/digests.rb @@ -59,12 +59,8 @@ =end module SiSU_Digest_view - require "#{SiSU_lib}/dal" - require "#{SiSU_lib}/sysenv" + require "#{SiSU_lib}/particulars" require "#{SiSU_lib}/i18n" - include SiSU_Env - include SiSU_Param - include SiSU_Viz pwd=Dir.pwd class Source @@dg=nil @@ -74,11 +70,11 @@ module SiSU_Digest_view @@endnotes_para=[] @@dg=nil @dg=@@dg ||=SiSU_Env::Info_env.new.digest.type - @env=SiSU_Env::Info_env.new(@opt.fns) + @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) end def read begin - @md=SiSU_Param::Parameters.new(@opt).get + @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array tool=if @opt.cmd =~/[MVv]/; "#{@env.program.text_editor} #{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}" else '' end @@ -87,8 +83,7 @@ module SiSU_Digest_view tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}") tell.flow if @opt.cmd =~/[MV]/ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) - @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here - SiSU_Digest_view::Source::Scroll.new(@dal_array,@md).songsheet + SiSU_Digest_view::Source::Scroll.new(@particulars).songsheet SiSU_Env::Info_skin.new(@md).select rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure @@ -99,13 +94,13 @@ module SiSU_Digest_view @@dl=nil @@ds={} @@description,@@ds[:digests],@@ds[:tree],@@ds[:summary],@@sc_info=[],[],[],[],[] - def initialize(data='',md='') - @data,@md=data,md + def initialize(particulars) #data='',md='') + @particulars=particulars + @data,@env,@md=@particulars.dal_array,@particulars.env,@particulars.md SiSU_Env::SiSU_file.new(@md).mkdir - @@dg ||=SiSU_Env::Info_env.new.digest.type - @@dl ||=SiSU_Env::Info_env.new.digest.length + @@dg ||=@env.digest.type + @@dl ||=@env.digest.length @dg,@dl=@@dg,@@dl - @env=SiSU_Env::Info_env.new(@md.fns) l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns) @language=l[:l] @tr=SiSU_Translate::Source.new(@md,@language) diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index b425356a..208b7409 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -60,34 +60,34 @@ =end module SiSU_HTML require 'pstore' + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/defaults" + include SiSU_Viz require "#{SiSU_lib}/html_table" require "#{SiSU_lib}/html_format_css" + include SiSU_HTML_Format_type require "#{SiSU_lib}/html_segments" require "#{SiSU_lib}/html_scroll" - require "#{SiSU_lib}/html_promo" include SiSU_HTML_seg - include SiSU_HTML_Format_type + require "#{SiSU_lib}/html_promo" include SiSU_HTML_promo - require "#{SiSU_lib}/param" - include SiSU_Param - include SiSU_Viz require "#{SiSU_lib}/html_tune" include SiSU_Tune - require "#{SiSU_lib}/dal" require "#{SiSU_lib}/shared_xml" class Source def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) end def read songsheet end def songsheet begin - @md=SiSU_Param::Parameters.new(@opt).get + @md=@particulars.md @fnb=@md.fnb - @env=SiSU_Env::Info_env.new(@opt.fns) + @env=@particulars.env loc=@env.url.output_tell tool=if @opt.cmd =~/z/; "#{@env.program.web_browser} #{loc}/#@fnb/#{@md.fn[:index]}" elsif @opt.cmd =~/[MVv]/; "#{@env.program.web_browser} #{loc}/#@fnb/#{@md.fn[:index]}" @@ -99,7 +99,7 @@ module SiSU_HTML data=nil my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns,@md) #Beware #FIX opt and md, both not necessary SiSU_Env::SiSU_file.new(@md).mkdir - @tuned_file_array=SiSU_HTML::Source::Html_environment.new(@md).tuned_file_instructions + @tuned_file_array=SiSU_HTML::Source::Html_environment.new(@particulars).tuned_file_instructions data=@tuned_file_array scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll toc=SiSU_HTML::Source::Toc.new(data,@md).songsheet @@ -131,10 +131,11 @@ module SiSU_HTML end private class Html_environment - def initialize(md) - @md=md + def initialize(particulars) + @particulars=particulars + @md,@env=particulars.md,particulars.env @vz=SiSU_Env::Get_init.instance.skin - @env,@css,@symlnk=SiSU_Env::Info_env.new(@md.fns),SiSU_Style::CSS.new,SiSU_Env::Create_system_link.new #home + @env,@css,@symlnk=particulars.env,SiSU_Style::CSS.new,SiSU_Env::Create_system_link.new #home end def suffix_linkname #not used at present sfx=if @md.cmd =~/h/; '.html' @@ -151,7 +152,6 @@ module SiSU_HTML SiSU_Env::SiSU_file.new(@md).mkdir end def tuned_file_instructions - @env=SiSU_Env::Info_env.new(@md.fns) @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md @md.sfx='' @@ -175,9 +175,8 @@ module SiSU_HTML my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns) @fnm=my_make_source_file.marshal_meta @tune_verse_marshal=my_make_source_file.marshal_tune - dal_array=SiSU_DAL::Source.new(@md).get # dal file drawn here + dal_array=@particulars.dal_array # dal file drawn here @tuned_file_array=SiSU_Tune::Tune.new(dal_array,@md).songsheet - require "#{SiSU_lib}/param" @tuned_file_array end end @@ -257,7 +256,6 @@ module SiSU_HTML end end class Endnotes - include SiSU_Param include SiSU_HTML_Format_type def initialize(data,md) @data,@md=data,md @@ -583,7 +581,6 @@ WOK class Scroll_head_and_segtoc < Toc def initialize(data,md='',toc='',links_guide_toc='') @data,@md,@toc,@links_guide_toc=data,md,toc,links_guide_toc - @env=SiSU_Env::Info_env.new(@md.fns) @vz=SiSU_Env::Get_init.instance.skin end def in_common @@ -681,7 +678,6 @@ WOK class Seg < SiSU_HTML_seg::Seg end class Output - include SiSU_Param @@dp=nil def initialize(data='',md='') @data,@md=data,md diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index fd3089ca..525ef50d 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -59,8 +59,6 @@ =end module SiSU_HTML_Format - require "#{SiSU_lib}/param" - include SiSU_Param include SiSU_Viz class Paragraph_number def initialize(md,paranum) @@ -147,7 +145,6 @@ module SiSU_HTML_Format class Head_information include SiSU_Viz include SiSU_HTML_Format - include SiSU_Env attr_reader :md,:sfx,:pdf,:rdf,:vz def initialize(md='') @md=md diff --git a/lib/sisu/v0/html_format_css.rb b/lib/sisu/v0/html_format_css.rb index 8ffb4e0d..db381e63 100644 --- a/lib/sisu/v0/html_format_css.rb +++ b/lib/sisu/v0/html_format_css.rb @@ -60,8 +60,6 @@ =end module SiSU_HTML_Format_type require "#{SiSU_lib}/html_format" - require "#{SiSU_lib}/param" - include SiSU_Param include SiSU_Viz include SiSU_HTML_Format class Head_toc < SiSU_HTML_Format::Head_toc diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 2e2c5f3e..8cd8841e 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -60,9 +60,7 @@ =end require "#{SiSU_lib}/param" module SiSU_Tune - #require "#{SiSU_lib}/defaults" require "#{SiSU_lib}/sysenv" - require "#{SiSU_lib}/param" require "#{SiSU_lib}/html_format" #watch include SiSU_Env include SiSU_Screen diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb index 5a193b0a..a9b616c1 100644 --- a/lib/sisu/v0/hub.rb +++ b/lib/sisu/v0/hub.rb @@ -131,7 +131,8 @@ module SiSU when /^source_kdissert$/; SiSU_Kdi_source::Source.new(@opt).read ## -S when /^digests$/; SiSU_Digest_view::Source.new(@opt).read # -N when /^xml_scaffold$/; SiSU_XML_scaffold::Source.new(@opt).read # -T - when /^plaintext$/; SiSU_Plaintext::Source.new(@opt).read # -a -A -e -E -f + when /^air$/; SiSU_Air::Source.new(@opt).read # -A + when /^plaintext$/; SiSU_Plaintext::Source.new(@opt).read # -a when /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g when /^odf$/; SiSU_ODF::Source.new(@opt).read # -o when /^xml_md_oai_pmh_dc$/; SiSU_XML_metadata::OAI_PMH.new(@opt).read # -O @@ -277,7 +278,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ if @opt.mod.inspect =~/--convert|--to|--from/ require "#{SiSU_lib}/sst_convert_markup" end - if @opt.cmd =~/([abCcDdFfgGHhIiJjLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ \ + if @opt.cmd =~/([AabCcDdFfgGHhIiJjLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ \ and @opt.cmd =~/^-/ \ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ #and @@ -418,6 +419,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end if @opt.cmd =~/[hHz]/; op('html','html') #% -h -H -z html css end + if @opt.cmd =~/A/; op('air','air') #% #-A + end if @opt.cmd =~/a/; op('plaintext','plaintext') #% -a #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file end if @opt.cmd =~/g/; op('wikispeak','wikispeak') #% -g wiki diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 12c84ac3..1883bdba 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -59,13 +59,14 @@ =end module SiSU_ODF + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/dal" require "#{SiSU_lib}/sysenv" include SiSU_Env - include SiSU_Param include SiSU_Viz require "#{SiSU_lib}/odf_format" - include OD_format + include SiSU_ODF_format require "#{SiSU_lib}/shared_txt" @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 class Source @@ -75,12 +76,12 @@ module SiSU_ODF include FileUtils def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) @@endnotes_para=[] end def read begin - @md=SiSU_Param::Parameters.new(@opt).get - @env=SiSU_Env::Info_env.new(@opt.fns) + @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array @env.odf_structure opendoc=@md.fn[:odf] path=@env.path.output_tell @@ -92,8 +93,7 @@ module SiSU_ODF tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{opendoc}") tell.flow if @opt.cmd =~/[MV]/ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) - @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here - SiSU_ODF::Source::Scroll.new(@dal_array,@md).songsheet + SiSU_ODF::Source::Scroll.new(@particulars).songsheet SiSU_Env::Info_skin.new(@md).select rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure @@ -103,7 +103,7 @@ module SiSU_ODF class Split_text_object <#@dp:#@dp>$/ - OD_format::Format_text_object.new(format,@text,@ocn) + SiSU_ODF_format::Format_text_object.new(format,@text,@ocn) else - OD_format::Format_text_object.new(format,@text,"<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>") + SiSU_ODF_format::Format_text_object.new(format,@text,"<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>") end self end @@ -156,9 +156,8 @@ module SiSU_ODF @@odf={ :body=>[],:open=>[],:close=>[],:head=>[],:metadata=>[],:tail=>[],:endnotes=>[] } @@docstart=true @@fns,@@dp=nil,nil - def initialize(data='',md='') - @data,@md=data,md - @env=SiSU_Env::Info_env.new(@md.fns) + def initialize(particulars) + @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern @regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ @@ -171,7 +170,7 @@ module SiSU_ODF end def songsheet pre - @data=markup(@data) + @data=markup(@dal_array) post publish end @@ -406,7 +405,7 @@ module SiSU_ODF end def table(para) # if para =~/|)/ if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change paranum=para[@regx,3] - @p_num=OD_format::Paragraph_number.new(paranum) + @p_num=SiSU_ODF_format::Paragraph_number.new(paranum) end @sto=Split_text_object.new(para).lev_segname_para_ocn #yyyy-mm-ddT00:00:00#{ocn} #followed immediately by paragraph closure @@ -592,7 +591,7 @@ module SiSU_ODF end elsif para =~/(.*)(.*)/ one,two=$1,$2 - format_text=OD_format::Format_text_object.new(one,two) + format_text=SiSU_ODF_format::Format_text_object.new(one,two) para=format_text.seg_no_paranum end if para =~// \ @@ -604,7 +603,7 @@ module SiSU_ODF end if para =~/<:center>/ one,two=/(.*)<:center>(.*)/.match(para)[1,2] - format_text=OD_format::Format_text_object.new(one,two) + format_text=SiSU_ODF_format::Format_text_object.new(one,two) para=format_text.center end else @@ -706,16 +705,13 @@ module SiSU_ODF content << @@odf[:metadata] #content << @@odf[:owner_details] if @md.stmp =~/\w+/ #not used? content << @@odf[:tail] - Output.new(content,@md).odf + Output.new(content,@md,@env).odf @@odf[:head],@@odf[:body],@@odf[:tail],@@odf[:metadata]=[],[],[],[] end end class Output . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Particulars + require 'singleton' + require "#{SiSU_lib}/sysenv" + require "#{SiSU_lib}/param" + require "#{SiSU_lib}/dal" + include SiSU_Env + include SiSU_Param + class Combined_singleton + include Singleton + def get_all(opt) + @opt=opt + set_env + set_md + set_dal #needs @md + end + def get_env(opt) + @opt=opt + set_env + end + def get_md(opt) + @opt=opt + set_md + end + def get_dal_array(opt) + @opt=opt + set_dal #needs @md + end + def get_env_md(opt) + @opt=opt + set_env + set_md + end + attr_accessor :opt,:md + def set_md + begin + @md=SiSU_Param::Parameters.new(@opt).get + self + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + end + end + attr_accessor :opt,:env + def set_env + begin + @env=SiSU_Env::Info_env.new(@opt.fns) + self + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + end + end + attr_accessor :opt,:dal_array + def set_dal + begin + @dal_array=@dal_array=SiSU_DAL::Source.new(@md).get + self + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + end + end + end +end +__END__ +consider running as separate objects diff --git a/lib/sisu/v0/sst_to_s_xml_dom.rb b/lib/sisu/v0/sst_to_s_xml_dom.rb index f9c190bf..1bf9a561 100644 --- a/lib/sisu/v0/sst_to_s_xml_dom.rb +++ b/lib/sisu/v0/sst_to_s_xml_dom.rb @@ -59,9 +59,9 @@ =end module SiSU_simple_xml_model_dom + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/defaults" - require "#{SiSU_lib}/param" - include SiSU_Param include SiSU_Viz require "#{SiSU_lib}/sysenv" include SiSU_Env @@ -79,11 +79,11 @@ module SiSU_simple_xml_model_dom @@fns=nil def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_env_md(opt) end def read begin - @md=SiSU_Param::Parameters.new(@opt).get #bug, relies on info persistence, assumes -m has previously been run - @env=SiSU_Env::Info_env.new(@opt.fns) + @env,@md=@particulars.env,@particulars.md #bug, md relies on info persistence, assumes -m has previously been run path=@env.path.output_tell loc=@env.url.output_tell tool=if @opt.cmd =~/[MV]/; "#{Dir.pwd}/#{@md.fn[:sxd]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sxd]}" @@ -95,12 +95,12 @@ module SiSU_simple_xml_model_dom tell.flow if @opt.cmd =~/[MV]/ unless @@fns==@opt.fns @@fns=@opt.fns - @@dal_array=[] + @@fns_array=[] end - @dal_array=if @@dal_array.empty?; read_fnm - else @@dal_array.dup # check + @fns_array=if @@fns_array.empty?; read_fnm + else @@fns_array.dup # check end - SiSU_simple_xml_model_dom::Convert::Songsheet.new(@dal_array,@md,@env).songsheet + SiSU_simple_xml_model_dom::Convert::Songsheet.new(@fns_array,@particulars).songsheet rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure #file closed in songsheet end @@ -114,12 +114,12 @@ module SiSU_simple_xml_model_dom end private class Songsheet - def initialize(data,md,dir) - @data,@md,@env=data,md,dir + def initialize(data,particulars) + @data,@particulars,@env,@md=data,particulars,particulars.env,particulars.md end def songsheet begin - SiSU_simple_xml_model_dom::Convert::Scroll.new(@data,@md).songsheet + SiSU_simple_xml_model_dom::Convert::Scroll.new(@data,@particulars).songsheet SiSU_simple_xml_model_dom::Convert::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@md.fn[:sxd]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error @@ -132,13 +132,12 @@ module SiSU_simple_xml_model_dom require "#{SiSU_lib}/css" include SiSU_text_utils @@xml={ :body=>[],:open=>[],:close=>[],:head=>[] } - def initialize(data='',md=nil) - @data,@md=data,md + def initialize(data='',particulars='') + @data,@env,@md=data,particulars.env,particulars.md @vz=SiSU_Env::Get_init.instance.skin @regx=/^(?:(?:<:p[bn]>\s*)?(?::?[A-C]|\d~)(?:(\S+))?\s+)?(.+)/ @tab="\t" if @md - @env=SiSU_Env::Info_env.new(@md.fns) @trans=SiSU_XML_munge::Trans.new(@md) end @sys=SiSU_Env::System_call.new @@ -543,8 +542,6 @@ WOK end end class Output - include SiSU_Param - include SiSU_Env def initialize(data,md) @data,@md=data,md @trans=SiSU_XML_munge::Trans.new(@md) diff --git a/lib/sisu/v0/sst_to_s_xml_node.rb b/lib/sisu/v0/sst_to_s_xml_node.rb index a2656e3e..76e30b60 100644 --- a/lib/sisu/v0/sst_to_s_xml_node.rb +++ b/lib/sisu/v0/sst_to_s_xml_node.rb @@ -59,6 +59,8 @@ =end module SiSU_simple_xml_model_node + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/defaults" require "#{SiSU_lib}/param" include SiSU_Param @@ -80,11 +82,12 @@ module SiSU_simple_xml_model_node @@fns=nil def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_env_md(opt) end def read begin - @md=SiSU_Param::Parameters.new(@opt).get #bug, relies on info persistence, assumes -m has previously been run - @env=SiSU_Env::Info_env.new(@opt.fns) + @md=@particulars.md #bug, relies on info persistence, assumes -m has previously been run + @env=@particulars.env path=@env.path.output_tell loc=@env.url.output_tell tool=if @opt.cmd =~/[MV]/; "#{Dir.pwd}/#{@md.fn[:sxn]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sxn]}" @@ -96,12 +99,12 @@ module SiSU_simple_xml_model_node tell.flow if @opt.cmd =~/[MV]/ unless @@fns==@opt.fns @@fns=@opt.fns - @@dal_array=[] + @@fns_array=[] end - @dal_array=if @@dal_array.empty?; read_fnm - else @@dal_array.dup #.dup #jokes on you + @fns_array=if @@fns_array.empty?; read_fnm + else @@fns_array.dup #.dup #jokes on you end - SiSU_simple_xml_model_node::Convert::Songsheet.new(@dal_array,@md,@env).songsheet + SiSU_simple_xml_model_node::Convert::Songsheet.new(@fns_array,@particulars).songsheet rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure #file closed in songsheet end @@ -115,12 +118,12 @@ module SiSU_simple_xml_model_node end private class Songsheet - def initialize(data,md,dir) - @data,@md,@env=data,md,dir + def initialize(data,particulars) + @data,@particulars,@env,@md=data,particulars,particulars.env,particulars.md end def songsheet begin - SiSU_simple_xml_model_node::Convert::Scroll.new(@data,@md).songsheet + SiSU_simple_xml_model_node::Convert::Scroll.new(@data,@particulars).songsheet SiSU_simple_xml_model_node::Convert::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@md.fn[:sxn]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error @@ -136,13 +139,12 @@ module SiSU_simple_xml_model_node @@parent={ :ocn=>[],:node=>[] } @@offspring={ :ocn=>[],:node=>[] } @@current=nil - def initialize(data='',md=nil) - @data,@md=data,md + def initialize(data='',particulars='') + @data,@env,@md=data,particulars.env,particulars.md @vz=SiSU_Env::Get_init.instance.skin @regx=/^(?:(?:<:p[bn]>\s*)?(?::?[A-C]~|\d~)(?:(\S+))?\s+)?(.+)/ @tab="\t" if @md - @env=SiSU_Env::Info_env.new(@md.fns) @trans=SiSU_XML_munge::Trans.new(@md) end @sys=SiSU_Env::System_call.new @@ -595,8 +597,6 @@ WOK end end class Output - include SiSU_Param - include SiSU_Env def initialize(data,md) @data,@md=data,md end diff --git a/lib/sisu/v0/sst_to_s_xml_sax.rb b/lib/sisu/v0/sst_to_s_xml_sax.rb index 4625779d..e7765d33 100644 --- a/lib/sisu/v0/sst_to_s_xml_sax.rb +++ b/lib/sisu/v0/sst_to_s_xml_sax.rb @@ -59,6 +59,8 @@ =end module SiSU_simple_xml_model_sax + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/defaults" require "#{SiSU_lib}/param" include SiSU_Param @@ -79,11 +81,12 @@ module SiSU_simple_xml_model_sax @@fns=nil def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_env_md(opt) end def read begin - @md=SiSU_Param::Parameters.new(@opt).get #bug, relies on info persistence, assumes -m has previously been run - @env=SiSU_Env::Info_env.new(@opt.fns) + @md=@particulars.md #bug, relies on info persistence, assumes -m has previously been run + @env=@particulars.env path=@env.path.output_tell loc=@env.url.output_tell tool=if @opt.cmd =~/[MV]/; "#{Dir.pwd}/#{@md.fn[:sxs]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sxs]}" @@ -94,12 +97,12 @@ module SiSU_simple_xml_model_sax SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{Dir.pwd}/#{@md.fn[:sxs]}").flow if @opt.cmd =~/[MV]/ unless @@fns==@opt.fns @@fns=@opt.fns - @@dal_array=[] + @@fns_array=[] end - @dal_array=if @@dal_array.empty?; read_fnm - else @@dal_array.dup #check + @fns_array=if @@fns_array.empty?; read_fnm + else @@fns_array.dup #check end - SiSU_simple_xml_model_sax::Convert::Songsheet.new(@dal_array,@md,@env).songsheet + SiSU_simple_xml_model_sax::Convert::Songsheet.new(@fns_array,@particulars).songsheet rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure #file closed in songsheet end @@ -113,12 +116,12 @@ module SiSU_simple_xml_model_sax end private class Songsheet - def initialize(data,md,dir) - @data,@md,@env=data,md,dir + def initialize(data,particulars) + @data,@particulars,@env,@md=data,particulars,particulars.env,particulars.md end def songsheet begin - SiSU_simple_xml_model_sax::Convert::Scroll.new(@data,@md).songsheet + SiSU_simple_xml_model_sax::Convert::Scroll.new(@data,@particulars).songsheet SiSU_simple_xml_model_sax::Convert::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@md.fn[:sxs]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error @@ -131,13 +134,12 @@ module SiSU_simple_xml_model_sax require "#{SiSU_lib}/css" include SiSU_text_utils @@xml={ :body=>[],:open=>[],:close=>[],:head=>[] } - def initialize(data='',md=nil) - @data,@md=data,md + def initialize(data='',particulars='') + @data,@env,@md=data,particulars.env,particulars.md @vz=SiSU_Env::Get_init.instance.skin @regx=/^(?:(?:<:p[bn]>\s*)?(?::?[A-C]~|\d~)(?:(\S+))?\s+)?(.+)/ @tab="\t" if @md - @env=SiSU_Env::Info_env.new(@md.fns) @trans=SiSU_XML_munge::Trans.new(@md) end @sys=SiSU_Env::System_call.new @@ -411,8 +413,6 @@ WOK end end class Output - include SiSU_Param - include SiSU_Env def initialize(data,md) @data,@md=data,md end diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index 5b8e020f..a17033c8 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -61,9 +61,9 @@ module SiSU_TeX require 'pstore' require "#{SiSU_lib}/defaults" - require "#{SiSU_lib}/param" - include SiSU_Param include SiSU_Viz + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/texpdf_format" include SiSU_TeX_Pdf @tex_file=@@tex_footnote_array=@@tex_col_w=[] @@ -79,17 +79,16 @@ module SiSU_TeX class Source #Songsheet # nil, :l => nil } @@flag_alt,@@flag_group,@@flag_code=false,false,false @@dp,@@prefix_b=nil,nil - def initialize(data,md) - @data,@md=data,md - @env=SiSU_Env::Info_env.new(@md.fns) + def initialize(particulars) + @particulars=particulars + @md=@particulars.md + @env=@particulars.env + @data=@particulars.dal_array # dal file drawn here @st={ :tex=>{} } @tex=SiSU_TeX_Pdf::Use_TeX.new(@md) @vz=SiSU_Env::Get_init.instance.skin diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 9e7fccde..75a3ff91 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -60,8 +60,6 @@ =end module SiSU_TeX_Pdf @@table_pg_break_counter=1 - require "#{SiSU_lib}/param" - include SiSU_Param include SiSU_Viz class Use_TeX attr_accessor :url,:txt,:date diff --git a/lib/sisu/v0/urls.rb b/lib/sisu/v0/urls.rb index 1d401f12..794270f6 100644 --- a/lib/sisu/v0/urls.rb +++ b/lib/sisu/v0/urls.rb @@ -59,11 +59,11 @@ =end module SiSU_urls + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/sysenv" include SiSU_Env include SiSU_Screen - require "#{SiSU_lib}/param" - include SiSU_Param class Source attr_reader :opt def initialize(opt) @@ -78,15 +78,15 @@ module SiSU_urls end end class Output_urls - include SiSU_Param attr_reader :fns,:fnb,:cmd,:dir,:m_regular,:u def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_env_md(opt) fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns) @cmd=@opt.cmd - env=SiSU_Env::Env_call.new(@opt.fns) - @fnb=env.fnb - @env=SiSU_Env::Info_env.new(@opt.fns) + @md=@particulars.md + @env=@particulars.env + @fnb=@env.fnb fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns) @fnl=@env.i18n.lang_filename(fn_set_lang[:c]) @fn=SiSU_Env::Env_call.new(@opt.fns).lang(fn_set_lang[:c]) diff --git a/lib/sisu/v0/xhtml.rb b/lib/sisu/v0/xhtml.rb index fa022db1..8503bddb 100644 --- a/lib/sisu/v0/xhtml.rb +++ b/lib/sisu/v0/xhtml.rb @@ -60,12 +60,11 @@ =end module SiSU_XHTML require "#{SiSU_lib}/defaults" - require "#{SiSU_lib}/param" - include SiSU_Param include SiSU_Viz + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/sysenv" include SiSU_Env - require "#{SiSU_lib}/dal" require "#{SiSU_lib}/shared_xml" require "#{SiSU_lib}/xml_format" include SiSU_XML_format @@ -77,11 +76,11 @@ module SiSU_XHTML class Source def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) end def read begin - @md=SiSU_Param::Parameters.new(@opt).get - @env=SiSU_Env::Info_env.new(@opt.fns) + @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array path=@env.path.output_tell loc=@env.url.output_tell tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:xhtml]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:xhtml]}" @@ -90,8 +89,7 @@ module SiSU_XHTML end SiSU_Screen::Ansi.new(@opt.cmd,'invert','XHTML',tool).colorize unless @opt.cmd =~/q/ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:xhtml]}").flow if @opt.cmd =~/[MV]/ - @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here - SiSU_XHTML::Source::Songsheet.new(@dal_array,@md,@env).songsheet + SiSU_XHTML::Source::Songsheet.new(@particulars).songsheet rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure #file closed in songsheet @@ -99,12 +97,12 @@ module SiSU_XHTML end private class Songsheet - def initialize(data,md,dir) - @data,@md,@env=data,md,dir + def initialize(particulars) + @env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars end def songsheet begin - SiSU_XHTML::Source::Scroll.new(@md,@data).songsheet + SiSU_XHTML::Source::Scroll.new(@particulars).songsheet SiSU_XHTML::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@md.fn[:xhtml]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error @@ -118,19 +116,18 @@ module SiSU_XHTML require "#{SiSU_lib}/css" include SiSU_text_utils @@dp=nil - def initialize(md=nil,data='') - @md,@data=md,data + def initialize(particulars) + @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern @regx=/^(?:(?:<:p[nb]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ @tab="\t" - @env=SiSU_Env::Info_env.new(@md.fns) @trans=SiSU_XML_munge::Trans.new(@md) @sys=SiSU_Env::System_call.new end def songsheet pre - @data=markup(@data) + @data=markup(@dal_array) post publish end @@ -424,8 +421,6 @@ WOK end end class Output - include SiSU_Param - include SiSU_Env def initialize(data,md) @data,@md=data,md end diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb index 9a88c09c..23125e05 100644 --- a/lib/sisu/v0/xml.rb +++ b/lib/sisu/v0/xml.rb @@ -57,9 +57,9 @@ =end module SiSU_XML_SAX require "#{SiSU_lib}/defaults" - require "#{SiSU_lib}/param" - include SiSU_Param include SiSU_Viz + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/sysenv" include SiSU_Env require "#{SiSU_lib}/dal" @@ -74,11 +74,11 @@ module SiSU_XML_SAX class Source def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) end def read begin - @md=SiSU_Param::Parameters.new(@opt).get - @env=SiSU_Env::Info_env.new(@opt.fns) + @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array path=@env.path.output_tell loc=@env.url.output_tell tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:sax]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sax]}" @@ -87,8 +87,7 @@ module SiSU_XML_SAX end SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',tool).colorize unless @opt.cmd =~/q/ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:sax]}").flow if @opt.cmd =~/[MV]/ - @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here - SiSU_XML_SAX::Source::Songsheet.new(@dal_array,@md,@env).songsheet + SiSU_XML_SAX::Source::Songsheet.new(@particulars).songsheet rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure #file closed in songsheet @@ -96,12 +95,12 @@ module SiSU_XML_SAX end private class Songsheet - def initialize(data,md,dir) - @data,@md,@env=data,md,dir + def initialize(particulars) + @env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars end def songsheet begin - SiSU_XML_SAX::Source::Scroll.new(@data,@md).songsheet + SiSU_XML_SAX::Source::Scroll.new(@particulars).songsheet SiSU_XML_SAX::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@md.fn[:sax]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error @@ -115,19 +114,18 @@ module SiSU_XML_SAX include SiSU_text_utils @@dp,@@env=nil,nil @@xml={ :body=>[],:open=>[],:close=>[],:head=>[] } - def initialize(data='',md=nil) - @data,@md=data,md + def initialize(particulars) + @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern @regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ @tab="\t" - @env=SiSU_Env::Info_env.new(@md.fns) if @md @trans=SiSU_XML_munge::Trans.new(@md) @sys=SiSU_Env::System_call.new end def songsheet pre - @data=markup(@data) + @data=markup(@dal_array) post publish end diff --git a/lib/sisu/v0/xml_dom.rb b/lib/sisu/v0/xml_dom.rb index a25afdc8..008a8ed2 100644 --- a/lib/sisu/v0/xml_dom.rb +++ b/lib/sisu/v0/xml_dom.rb @@ -60,9 +60,9 @@ =end module SiSU_XML_DOM require "#{SiSU_lib}/defaults" - require "#{SiSU_lib}/param" - include SiSU_Param include SiSU_Viz + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/sysenv" include SiSU_Env require "#{SiSU_lib}/dal" @@ -77,11 +77,11 @@ module SiSU_XML_DOM class Source def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) end def read begin - @md=SiSU_Param::Parameters.new(@opt).get - @env=SiSU_Env::Info_env.new(@opt.fns) + @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array path=@env.path.output_tell loc=@env.url.output_tell tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:dom]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:dom]}" @@ -90,8 +90,7 @@ module SiSU_XML_DOM end SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',tool).colorize unless @opt.cmd =~/q/ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:dom]}").flow if @opt.cmd =~/[MV]/ - @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here - SiSU_XML_DOM::Source::Songsheet.new(@dal_array,@md,@env).songsheet + SiSU_XML_DOM::Source::Songsheet.new(@particulars).songsheet rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure #file closed in songsheet @@ -99,12 +98,12 @@ module SiSU_XML_DOM end private class Songsheet - def initialize(data,md='',dir='') - @data,@md,@env=data,md,dir + def initialize(particulars) + @env,@md,@dal_array,@particulars=particulars.env,particulars.md,particulars.dal_array,particulars end def songsheet begin - SiSU_XML_DOM::Source::Scroll.new(@data,@md).songsheet + SiSU_XML_DOM::Source::Scroll.new(@particulars).songsheet SiSU_XML_DOM::Source::Tidy.new(@md,@env).xml if @md.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@md.fn[:dom]).xml if @md.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error @@ -117,8 +116,8 @@ module SiSU_XML_DOM require "#{SiSU_lib}/shared_txt" include SiSU_text_utils @@dp=nil - def initialize(data='',md='') - @data,@md=data,md + def initialize(particulars) + @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern @regx=/^(?:(?:<:p[bn]>\s*)?\d~(?:(\S+))?\s+)?(.+?)\s*<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ # @@ -128,7 +127,7 @@ module SiSU_XML_DOM end def songsheet pre - @data=markup(@data) + @data=markup(@dal_array) post publish end @@ -566,4 +565,3 @@ WOK end end __END__ - diff --git a/lib/sisu/v0/xml_scaffold.rb b/lib/sisu/v0/xml_scaffold.rb index ae8a0cc0..1404567c 100644 --- a/lib/sisu/v0/xml_scaffold.rb +++ b/lib/sisu/v0/xml_scaffold.rb @@ -59,20 +59,21 @@ =end module SiSU_XML_scaffold + require "#{SiSU_lib}/particulars" + include SiSU_Particulars require "#{SiSU_lib}/dal" require "#{SiSU_lib}/sysenv" include SiSU_Env - include SiSU_Param pwd=Dir.pwd class Source def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) @sp=' ' end def read begin - @md=SiSU_Param::Parameters.new(@opt).get - @dal_array=SiSU_DAL::Source.new(@opt).get + @md,@dal_array=@particulars.md,@particulars.dal_array SiSU_XML_scaffold::Source::Scroll.new(@dal_array,@md).songsheet rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure -- cgit v1.2.3