aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v0/concordance.rb33
-rw-r--r--lib/sisu/v0/dal.rb10
-rw-r--r--lib/sisu/v0/dal_doc_str.rb14
-rw-r--r--lib/sisu/v0/db_create.rb8
-rw-r--r--lib/sisu/v0/db_drop.rb4
-rw-r--r--lib/sisu/v0/db_import.rb55
-rw-r--r--lib/sisu/v0/db_indexes.rb4
-rw-r--r--lib/sisu/v0/db_load_tuple.rb60
-rw-r--r--lib/sisu/v0/db_remove.rb47
-rw-r--r--lib/sisu/v0/db_select.rb46
-rw-r--r--lib/sisu/v0/db_tests.rb8
-rw-r--r--lib/sisu/v0/digests.rb23
-rw-r--r--lib/sisu/v0/html.rb32
-rw-r--r--lib/sisu/v0/html_format.rb3
-rw-r--r--lib/sisu/v0/html_format_css.rb2
-rw-r--r--lib/sisu/v0/html_tune.rb2
-rw-r--r--lib/sisu/v0/hub.rb7
-rw-r--r--lib/sisu/v0/odf.rb42
-rw-r--r--lib/sisu/v0/odf_format.rb2
-rw-r--r--lib/sisu/v0/particulars.rb121
-rw-r--r--lib/sisu/v0/sst_to_s_xml_dom.rb29
-rw-r--r--lib/sisu/v0/sst_to_s_xml_node.rb28
-rw-r--r--lib/sisu/v0/sst_to_s_xml_sax.rb28
-rw-r--r--lib/sisu/v0/sysenv.rb62
-rw-r--r--lib/sisu/v0/texpdf.rb37
-rw-r--r--lib/sisu/v0/texpdf_format.rb2
-rw-r--r--lib/sisu/v0/urls.rb12
-rw-r--r--lib/sisu/v0/xhtml.rb27
-rw-r--r--lib/sisu/v0/xml.rb24
-rw-r--r--lib/sisu/v0/xml_dom.rb24
-rw-r--r--lib/sisu/v0/xml_scaffold.rb7
31 files changed, 482 insertions, 321 deletions
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=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home --&gt;"></a>}
@lnk=lnk
@doc_details =<<WOK
@@ -175,21 +170,17 @@ WOK
end
class Words
require "#{SiSU_lib}/defaults"
- require "#{SiSU_lib}/param"
include SiSU_Viz
- include SiSU_Param
require "#{SiSU_lib}/html_format_css"
include SiSU_HTML_Format
require "#{SiSU_lib}/sysenv"
include SiSU_Screen
@@dp=nil
- def initialize(md)
+ def initialize(particulars)
begin
@vz=SiSU_Env::Get_init.instance.skin
- @md=md
- @env=SiSU_Env::Info_env.new(@md.fns)
+ @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array
@path="#{@env.path.output}/#{@md.fnb}"
- @dal_array=SiSU_DAL::Source.new(@md).get # dal file drawn here
@freq=Hash.new(0)
@dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
@rxp_to=Regexp.new("<~(\\d+);(?:[oh]|[0-6]:)\\d+;\\w\\d+><#@dp:#@dp>$")
@@ -292,7 +283,7 @@ WOK
end
scr='<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text">&nbsp;scroll:&nbsp;</font><font size="1" color="#222222" face=times new roman>doc#&nbsp;</font> '
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/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>(.+?)<\/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>(.+?)<\/del>/,'DELETED(\1)') # deletions
s=s.gsub(/<sup>(\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=~/<!TZ!>/; ocnt+=1 #tables
+ if para=~/<!TZ!>/; 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
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>(.+?)<\/b>/,'\1') # remove bold, italics, underscore
data.gsub!(/<i>(.+?)<\/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=<<SQL
+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}';
+SQL
+ if @opt.cmd =~/M/
+ @file.puts sql_entry if @opt.cmd =~/M/
+ else @conn.execute(%{#{sql_entry}})
+ end
else
tell=SiSU_Screen::Ansi.new(@opt.cmd,"no such file in database #{@db.psql.db}::#{@opt.fns}")
tell.puts_grey #if @opt.cmd.include? ?v
@@ -97,3 +92,17 @@ module SiSU_DB_remove
end
end
__END__
+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}';
+*/
diff --git a/lib/sisu/v0/db_select.rb b/lib/sisu/v0/db_select.rb
index 0b456262..002f0039 100644
--- a/lib/sisu/v0/db_select.rb
+++ b/lib/sisu/v0/db_select.rb
@@ -63,14 +63,31 @@ module SiSU_DB_select
class Case
def initialize(opt,conn='',sql_type='pg')
@opt,@conn,@sql_type=opt,conn,sql_type
+#@conn.execute("BEGIN;")
#@sdb=Create.new(@conn)
- @sdb=SiSU_DB_DBI::Create.new(@opt,@conn,@sql_type)
- @index=SiSU_DB_DBI::Index.new(@opt,@conn,@sql_type)
- @sdb_no=SiSU_DB_DBI::Drop.new(@opt,@conn,@sql_type)
- @sdb_import=SiSU_DB_DBI::Import.new(@opt,@conn,@sql_type) if @opt.mod.inspect =~/update|import/
- @remove=SiSU_DB_DBI::Remove.new(@opt,@conn) if @opt.mod.inspect =~/update|remove/
+ @file=sql_maintenance_file
+ @sdb=SiSU_DB_DBI::Create.new(@opt,@conn,@file,@sql_type)
+ @sdb_index=SiSU_DB_DBI::Index.new(@opt,@conn,@file,@sql_type)
+ @sdb_no=SiSU_DB_DBI::Drop.new(@opt,@conn,@file,@sql_type)
+ @sdb_import=SiSU_DB_DBI::Import.new(@opt,@conn,@file,@sql_type) if @opt.mod.inspect =~/update|import/
+ @sdb_remove_doc=SiSU_DB_DBI::Remove.new(@opt,@conn,@file) if @opt.mod.inspect =~/update|remove/
@db=SiSU_Env::Info_db.new
end
+ def sql_maintenance_file
+ file=if @opt.inspect =~/M/
+ x=if @opt.fns and not @opt.fns.empty?
+ @env=SiSU_Env::Info_env.new(@opt.fns) if @opt.fns
+ puts "\n#{@env.path.sqlite}/#{@opt.fns}.sql"
+ @db=SiSU_Env::Info_db.new
+ @job="sqlite3 #{@db.sqlite.db} < #{@env.path.sqlite}/#{@opt.fns}.sql"
+ File.new("#{@env.path.sqlite}/#{@opt.fns}.sql",'w+')
+ elsif @opt.fns and @opt.fns.inspect =~/create/; nil #sort variations later
+ else nil
+ end
+ else nil
+ end
+ file
+ end
def cases
@opt.mod.each do |mod|
case mod
@@ -84,13 +101,14 @@ module SiSU_DB_select
@sdb.output_dir?
#@sdb.create_db
begin
+ #@sdb.create_db
@sdb.create_table.metadata
@sdb.create_table.documents
@sdb.create_table.endnotes
@sdb.create_table.endnotes_asterisk
@sdb.create_table.endnotes_plus
@sdb.create_table.urls
- @index.create_indexes
+ @sdb_index.create_indexes
rescue; SiSU_Errors::Info_error.new($!,$@,'-D').error; @sdb.output_dir?
end
when /^--createtable(s)?$/
@@ -102,7 +120,7 @@ module SiSU_DB_select
@sdb.create_table.endnotes_asterisk
@sdb.create_table.endnotes_plus
@sdb.create_table.urls
- @index.create_indexes
+ @sdb_index.create_indexes
rescue; @sdb.output_dir?
end
when /^--recreate$/
@@ -115,7 +133,7 @@ module SiSU_DB_select
@sdb.create_table.endnotes_asterisk
@sdb.create_table.endnotes_plus
@sdb.create_table.urls
- @index.create_indexes
+ @sdb_index.create_indexes
rescue; @sdb.output_dir?
end
when /^--cr(eate)?lex$/
@@ -139,14 +157,14 @@ module SiSU_DB_select
end
tell.puts_grey if @opt.cmd =~/v/
when /^--remove$/
- @remove.remove
+ @sdb_remove_doc.remove
when /^--update$/
- @remove.remove
+ @sdb_remove_doc.remove
@sdb_import.marshal_load
tell=SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?")
tell.puts_grey if @opt.cmd =~/v/
when /^--index$/
- @index.create_indexes
+ @sdb_index.create_indexes
when /^droptable(s)?$/
@sdb_no.drop.tables
when /^--dropindex(es)?$/
@@ -160,6 +178,12 @@ module SiSU_DB_select
help.summary
help.commands
end
+ if @opt.cmd =~/M/
+ #@conn.commit
+ #@conn.disconnect
+ puts @job
+ #system(@job)
+ end
end
begin
@conn.commit if @sql_type =~/sqlite/
diff --git a/lib/sisu/v0/db_tests.rb b/lib/sisu/v0/db_tests.rb
index 73e0400f..72282b59 100644
--- a/lib/sisu/v0/db_tests.rb
+++ b/lib/sisu/v0/db_tests.rb
@@ -64,9 +64,9 @@ module SiSU_DB_tests
def initialize(info,opt)
@ck,@opt=info,opt
unless @opt.cmd =~/q/
- puts @ck.tp[:fns]
- puts @ck.tp[:title]
- puts @ck.tp[:creator] if @ck.tp[:creator]
+ puts @ck.tp[:fns] if @ck.tp[:fns] and not @ck.tp[:fns].empty?
+ puts @ck.tp[:title] if @ck.tp[:title] and not @ck.tp[:title].empty?
+ puts @ck.tp[:creator] if @ck.tp[:creator] and not @ck.tp[:creator].empty?
end
end
def verify
@@ -109,7 +109,7 @@ module SiSU_DB_tests
puts @ck.tp[:dewey].length.to_s + ' checklength ' + @ck.tp[:dewey] if @ck.tp[:dewey] and @ck.tp[:dewey].length >@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
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 <Source
require "#{SiSU_lib}/odf_format"
include SiSU_Viz
- include OD_format
+ include SiSU_ODF_format
@@dp=nil
@@alt_id_count=0
attr_reader :format,:lev,:text,:ocn,:lev_para_ocn
@@ -142,9 +142,9 @@ module SiSU_ODF
end
format=@format.dup
@lev_para_ocn=if @para =~/.+<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@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 =~/<!Th?.+/ # tables come as single block
- table=OD_format::Table.new(@md,para)
+ table=SiSU_ODF_format::Table.new(@md,para)
para=table.table_split
end
end
@@ -544,7 +543,7 @@ module SiSU_ODF
if para !~/(^0~|<ENDNOTES>|<EOF>)/
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
#<office:annotation><dc:date>yyyy-mm-ddT00:00:00</dc:date><text:p>#{ocn}</text:p></office:annotation> #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 =~/<a name="n\d+">/ \
@@ -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 <Source
- include SiSU_Param
- include SiSU_Env
- def initialize(content,md)
- @content,@md=content,md
- @env=SiSU_Env::Info_env.new(@md.fns)
+ def initialize(content,md,env)
+ @content,@md,@env=content,md,env
end
def odf #%odf output
SiSU_Env::SiSU_file.new(@md).mkdir
diff --git a/lib/sisu/v0/odf_format.rb b/lib/sisu/v0/odf_format.rb
index 54a32e25..3a6d0d94 100644
--- a/lib/sisu/v0/odf_format.rb
+++ b/lib/sisu/v0/odf_format.rb
@@ -58,7 +58,7 @@
** Description: opendocument formatting, default opendocument template
=end
-module OD_format
+module SiSU_ODF_format
require "#{SiSU_lib}/param"
include SiSU_Param
include SiSU_Viz
diff --git a/lib/sisu/v0/particulars.rb b/lib/sisu/v0/particulars.rb
new file mode 100644
index 00000000..ce12fc31
--- /dev/null
+++ b/lib/sisu/v0/particulars.rb
@@ -0,0 +1,121 @@
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+ #___#
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007,
+ 2008 Ralph Amissah All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007 Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/copyleft/gpl.html>
+
+ <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
+ <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
+ <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.jus.uio.no/sisu/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** 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/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]
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 #<SiSU_Param::MyFiles
require 'pstore'
require "#{SiSU_lib}/sysenv"
- require "#{SiSU_lib}/param"
include SiSU_Env
- include SiSU_Param
include SiSU_Viz
require "#{SiSU_lib}/dal"
include SiSU_DAL
include SiSU_TeX
def initialize(opt)
@opt=opt
- @md=SiSU_Param::Parameters.new(@opt).get
- @env=SiSU_Env::Info_env.new(@opt.fns)
+ @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
+ @md=@particulars.md
+ @env=@particulars.env
end
def directories
begin
@@ -108,7 +107,7 @@ module SiSU_TeX
end
def songsheet
begin
- @md=SiSU_Param::Parameters.new(@opt).get
+ @md=@particulars.md
tell=SiSU_Screen::Ansi.new(@opt.cmd,'LaTeX/PDF')
tell.green_title_hi unless @opt.cmd =~/q/
path=@env.url.output_tell
@@ -116,7 +115,7 @@ module SiSU_TeX
tell.flow if @opt.cmd =~/[MVv]/
tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{path}/#{@md.fnb}/#{@md.fn[:pdf_p]}")
tell.flow if @opt.cmd =~/[MVv]/
- @md=SiSU_Param::Parameters.new(@opt).get
+ @md=@particulars.md
my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
$flag=@md.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format
@dir_o="#{@env.path.output}/#{@opt.fnb}"
@@ -125,12 +124,11 @@ module SiSU_TeX
newfilename=filename_index
#% needed needs to be reprogrammed !!!
SiSU_Env::Info_skin.new(@md).select
- dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_TeX::Source::LaTeX_create.new(dal_array,@md).songsheet
- #SiSU_TeX::Source::LaTeX_create.new(dal_array,@md,'portrait').songsheet
+ dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
+ SiSU_TeX::Source::LaTeX_create.new(@particulars).songsheet
dal_array=''
pwd=Dir.pwd
- SiSU_TeX::Source::LaTeX_to_pdf.new(@md).latexrun_selective
+ SiSU_TeX::Source::LaTeX_to_pdf.new(@md,@particulars.env).latexrun_selective
Dir.chdir(pwd)
rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
ensure
@@ -159,9 +157,8 @@ module SiSU_TeX
require 'fileutils'
include FileUtils #::Verbose
@@n_lpdf||=0 #change
- def initialize(md)
- @md=md
- @env=SiSU_Env::Info_env.new(@md.fns)
+ def initialize(md,env)
+ @md,@env=md,env
end
def latex_do(texfilename)
@texfilename=texfilename
@@ -232,15 +229,17 @@ module SiSU_TeX
end
end
class LaTeX_create
- include SiSU_Param
+ #include SiSU_Param
@@tex_backslash ||="\\\\"
@@tilde='\\\\\\~' #?? debug crazy
@@tex_head={ :p => 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