diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-05-10 12:07:29 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-05-10 12:07:29 -0400 |
commit | 34cee0148a445bcee5e97997575b7323df0a02b9 (patch) | |
tree | 5f2a1a7618b0484d6a5620ccaa80906412a3e486 /lib | |
parent | syenv updates, mostly sql related (diff) |
introduced particulars (rename later) for commonly used document and environment details, and cleaned up some requires
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v0/concordance.rb | 33 | ||||
-rw-r--r-- | lib/sisu/v0/digests.rb | 23 | ||||
-rw-r--r-- | lib/sisu/v0/html.rb | 32 | ||||
-rw-r--r-- | lib/sisu/v0/html_format.rb | 3 | ||||
-rw-r--r-- | lib/sisu/v0/html_format_css.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v0/html_tune.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v0/hub.rb | 7 | ||||
-rw-r--r-- | lib/sisu/v0/odf.rb | 42 | ||||
-rw-r--r-- | lib/sisu/v0/odf_format.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v0/particulars.rb | 121 | ||||
-rw-r--r-- | lib/sisu/v0/sst_to_s_xml_dom.rb | 29 | ||||
-rw-r--r-- | lib/sisu/v0/sst_to_s_xml_node.rb | 28 | ||||
-rw-r--r-- | lib/sisu/v0/sst_to_s_xml_sax.rb | 28 | ||||
-rw-r--r-- | lib/sisu/v0/texpdf.rb | 37 | ||||
-rw-r--r-- | lib/sisu/v0/texpdf_format.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v0/urls.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v0/xhtml.rb | 27 | ||||
-rw-r--r-- | lib/sisu/v0/xml.rb | 24 | ||||
-rw-r--r-- | lib/sisu/v0/xml_dom.rb | 24 | ||||
-rw-r--r-- | lib/sisu/v0/xml_scaffold.rb | 7 |
20 files changed, 283 insertions, 202 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 -->"></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"> scroll: </font><font size="1" color="#222222" face=times new roman>doc# </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/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 |