diff options
author | Ralph Amissah <ralph@amissah.com> | 2007-10-01 01:50:59 +0100 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2007-10-01 01:50:59 +0100 |
commit | e563c8eb010b1b53ac388be334a5aa0e55f7649d (patch) | |
tree | 9e8e3b2e319707a6fc47a48a345fda2cd09c39fa /lib | |
parent | remove compression on .yml files in package (diff) | |
parent | proposed as sisu-0.60.0, see updated CHANGELOG (diff) |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v0/composite.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v0/concordance.rb | 3 | ||||
-rw-r--r-- | lib/sisu/v0/dal.rb | 7 | ||||
-rw-r--r-- | lib/sisu/v0/html.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v0/hub.rb | 57 | ||||
-rw-r--r-- | lib/sisu/v0/param.rb | 26 | ||||
-rw-r--r-- | lib/sisu/v0/shared_xml.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v0/sysenv.rb | 28 | ||||
-rw-r--r-- | lib/sisu/v0/texpdf.rb | 13 | ||||
-rw-r--r-- | lib/sisu/v0/texpdf_format.rb | 4 |
10 files changed, 88 insertions, 58 deletions
diff --git a/lib/sisu/v0/composite.rb b/lib/sisu/v0/composite.rb index 557a0519..88c6c48a 100644 --- a/lib/sisu/v0/composite.rb +++ b/lib/sisu/v0/composite.rb @@ -113,7 +113,7 @@ module SiSU_Assemble end end def write(assembled) - assembled_file=File.new("#{@opt.fnb}._sst",'w+') + assembled_file=File.new("#{@env.path.composite_file}/#{@opt.fnb}._sst",'w+') assembled.each{|a| assembled_file << a } assembled_file.close end diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index 9e114f80..d60ffc2f 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -107,7 +107,8 @@ module SiSU_Concordance def initialize(lnk,md) @md=md @vz=SiSU_Env::Get_init.instance.skin - file_array=IO.readlines(@md.fns,'') + @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 diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 270c46b2..0af589f2 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -84,6 +84,7 @@ module SiSU_DAL @my_make_fns=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) @fnm=@my_make_fns.marshal_meta SiSU_Env::Create_system_link.new.images + @env=SiSU_Env::Info_env.new end def read #creates dal begin @@ -116,14 +117,14 @@ module SiSU_DAL dal_array=[] tell=SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction') tell.green_title_hi unless @opt.cmd =~/q/ - file_array=IO.readlines(@opt.fns,'') + file_array=@env.read_source_file(@opt.fns) file_array.each do |l| if l =~/\r\n/; l.gsub!(/\r\n/,"\n") end end meta=file_array.dup - meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice - @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract + meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice + @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract meta=nil dal=SiSU_DAL::Make.new(@md,file_array).song SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"~meta/#{@md.fns}.meta").output if @md.cmd =~/v/ diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index d12b6637..d0f0e210 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -99,7 +99,7 @@ module SiSU_HTML @tuned_file_array=SiSU_HTML::Source::Html_environment.new(@md).tuned_file_instructions data=@tuned_file_array else - data=IO.readlines(@opt.fns,'') #wasteful, not really necessary? + data=@env.read_source_file(@opt.fns) SiSU_HTML_nav_tune::Tune.new(data,@md).songsheet @tuned_file_array=data #watch may not be what you want end diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb index 82ccc614..7dcc0127 100644 --- a/lib/sisu/v0/hub.rb +++ b/lib/sisu/v0/hub.rb @@ -120,6 +120,7 @@ module SiSU end if not @opt.files.empty? @opt.files.each do |fns| + env=SiSU_Env::Info_env.new(fns) if fns =~ /(?:sisupod(?:\.zip)?|\.ssp)$/ pod_name=Remote_download.new(fns).pod.name tell=SiSU_Screen::Ansi.new(@opt.cmd,pod_name) @@ -131,7 +132,13 @@ module SiSU put=fns.gsub(/(.+)?\._sst$/,'\1.ssm') @opt.fns=fns if @req !~/(?:urls|remote_put)$/ - if FileTest.file?(@opt.fns) + if @req=~/^dal$/ and FileTest.file?(@opt.fns) and @opt.fns =~ /\.(?:[_-]?sst|ssm)$/ + if fns =~ /\.ssm$/; require "#{SiSU_lib}/composite" #pre-processing + SiSU_Assemble::Composite.new(@opt).read + @opt.fns=fns.gsub(/\.ssm$/,'._sst') + end + SiSU_DAL::Source.new(@opt).read # -m + elsif FileTest.file?(env.source_file_with_path) case @opt.fns when /\.(?:[_-]?sst|ssm)$/ case @req @@ -140,31 +147,31 @@ module SiSU SiSU_Assemble::Composite.new(@opt).read @opt.fns=fns.gsub(/\.ssm$/,'._sst') end - SiSU_DAL::Source.new(@opt).read # -m - when /^concordance$/; SiSU_Concordance::Source.new(@opt).read # -w - when /^share_src$/; SiSU_Markup::Source.new(@opt).read # -s - when /^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S - 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 /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g - when /^odf$/; SiSU_ODF::Source.new(@opt).read # -o + SiSU_DAL::Source.new(@opt).read # -m + when /^concordance$/; SiSU_Concordance::Source.new(@opt).read # -w + when /^share_src$/; SiSU_Markup::Source.new(@opt).read # -s + when /^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S + 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 /^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 - when /^texpdf$/; SiSU_TeX::Source.new(@opt).read # -p - when /^manpage$/; SiSU_manpage::Source.new(@opt).read # -i - when /^texinfo$/; SiSU_TexInfo::Source.new(@opt).read # -I - #when /^plaintext_exp$/; SiSU_Plaintext_exp::Source.new(@opt).read # -j - #when /^manpage_exp$/; SiSU_manpage_exp::Source.new(@opt).read # -J - #when /^docbook$/; SiSU_Docbook::Source.new(@opt).read # -B - when /^html$/; SiSU_HTML::Source.new(@opt).read # -h -H - when /^xml$/; SiSU_XML_SAX::Source.new(@opt).read # -x - when /^xml_dom$/; SiSU_XML_DOM::Source.new(@opt).read # -X - when /^xhtml$/; SiSU_XHTML::Source.new(@opt).read # -b - when /^manifest$/; SiSU_Manifest::Source.new(@opt).read # -y - when /^sitemaps$/; SiSU_Sitemaps::Source.new(@opt).read # -Y - when /^zap$/; SiSU_Zap::Source.new(@opt).read # -Z - when /^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d + when /^texpdf$/; SiSU_TeX::Source.new(@opt).read # -p + when /^manpage$/; SiSU_manpage::Source.new(@opt).read # -i + when /^texinfo$/; SiSU_TexInfo::Source.new(@opt).read # -I + #when /^plaintext_exp$/; SiSU_Plaintext_exp::Source.new(@opt).read # -j + #when /^manpage_exp$/; SiSU_manpage_exp::Source.new(@opt).read # -J + #when /^docbook$/; SiSU_Docbook::Source.new(@opt).read # -B + when /^html$/; SiSU_HTML::Source.new(@opt).read # -h -H + when /^xml$/; SiSU_XML_SAX::Source.new(@opt).read # -x + when /^xml_dom$/; SiSU_XML_DOM::Source.new(@opt).read # -X + when /^xhtml$/; SiSU_XHTML::Source.new(@opt).read # -b + when /^manifest$/; SiSU_Manifest::Source.new(@opt).read # -y + when /^sitemaps$/; SiSU_Sitemaps::Source.new(@opt).read # -Y + when /^zap$/; SiSU_Zap::Source.new(@opt).read # -Z + when /^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d end @n_do=@n_do+1 tell=SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed") diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index a2036b8a..e3b42933 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -75,9 +75,10 @@ module SiSU_Param @@publisher='SiSU scribe' @@md=@@fns=nil def initialize(opt) + @opt=opt @cX||=SiSU_Screen::Ansi.new(opt.cmd) @cmd,@mod=opt.cmd,opt.mod - @fns=opt.fns.gsub(/\.ssm$/,'._sst') #revisit + @fns=opt.fns.gsub(/\.ssm$/,'._sst') #revisit CHECK Instantiate.new.param_instantiate @env=SiSU_Env::Info_env.new(@fns) @pstorefile="#{@env.path.dal}/#@fns.pstore" @@ -90,19 +91,20 @@ module SiSU_Param if @@md.nil? or @cmd =~/M/ #not particularly helpful, as current cycle is through output types, with files changing, only helpful if deal with a file all output types before going to next file if File.exist?(@pstorefile) param_msg='Parameters from pstore' - store=PStore.new(@pstorefile) - store.transaction do |s| + retrieve_store=PStore.new(@pstorefile) + retrieve_store.transaction do |s| @md=s['md'] - s.commit end - else #if @fns =~/\.s[123]/ + @md + else param_msg='Parameters extracted' - fns_array=IO.readlines(@fns,'') - @md=SiSU_Param::Instructions.new(fns_array,@fns,@cmd) + fns_array=@env.read_source_file(@opt.fns) + md=Instructions.new(fns_array,@opt) + @md=Instructions.new(fns_array,@opt).extract + @md end @@md=@md - else - @@md + else @@md end tell=SiSU_Screen::Ansi.new(@cmd,param_msg,@@md.title) tell.txt_grey if @cmd =~/[MV]/ @@ -130,7 +132,7 @@ module SiSU_Param ensure end end - protected + #protected def determine_papersize(l) l=case l when /eu|europe|uk/i; 'A4' #European default, SiSU default @@ -644,12 +646,12 @@ module SiSU_Param end @dgst,@dgst_skin=[],[] if @env.digest.type =~/sha256/ - @dgst=@sys.sha256(@fns) + @dgst=@sys.sha256(@env.source_file_with_path) @dgst_skin=if skin; @sys.sha256(skin) else nil end else - @dgst=@sys.md5(@fns) + @dgst=@sys.md5(@env.source_file_with_path) @dgst_skin=if skin; @sys.md5(skin) else nil end diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 866939ea..135f368e 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -491,11 +491,11 @@ module SiSU_XML_tags #Format content=meta_content_clean(@md.dc_source) @dc_source=%{ <meta name="dc.source" content="#{content}" />\n} end - if @md.dc_language[:name] # DublinCore 12 - language (English) + if @md.dc_language and @md.dc_language[:name] # DublinCore 12 - language (English) @rdf_language=%{ dc.language="#{@md.dc_language[:name]}"\n} @dc_language=%{ <meta name="dc.language" content="#{@md.dc_language[:name]}" />\n} end - if @md.language_original[:name] + if @md.language_original and @md.language_original[:name] @rdf_language_original=%{ dc.language="#{@md.language_original[:name]}"\n} @language_original=%{ <meta name="dc.language" content="#{@md.language_original[:name]}" />\n} end diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 329c9111..95830224 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -487,9 +487,10 @@ module SiSU_Env end def file_encoding(filename,cmd='') #file encoding program='file' + fnsp=Info_env.new(filename).source_file_with_path if program_found?(program) - encoding=%x{file #{filename}}.strip - encoding.gsub!(/#{filename}:(\s+|$)/,'') + encoding=%x{file #{fnsp}}.strip + encoding.gsub!(/#{fnsp}:(\s+|$)/,'') encoding=if encoding and not encoding.empty?; encoding else 'UTF-8 assumed, encoding undetermined' end @@ -1084,6 +1085,22 @@ WOK end self end + def source_file_path + file=@fns.gsub(/(\.ssm)/,'._sst') + pth=unless file =~/\._sst$/; "#{Dir.pwd}" + else "#{path.composite_file}" + end + end + def source_file_with_path + file=@fns.gsub(/(\.ssm)/,'._sst') + "#{source_file_path}/#{file}" + end + def read_source_file(fns) + fns_array=unless fns =~/\._sst$/ + IO.readlines(fns,'') + else IO.readlines("#{path.composite_file}/#{fns}",'') + end + end def path #dir def home @sys.home @@ -1216,6 +1233,11 @@ WOK end @processing end + def composite_file + pth=path.dal #"#{processing}/composite" + File.mkpath(pth) unless FileTest.directory?(pth) + pth + end def dal pth=if defined? @rc['processing']['dal']; "#{processing}/#{@rc['processing']['dal']}" else "#{processing}/#{defaults[:processing_dal]}" @@ -1976,7 +1998,7 @@ WOK def remote_host_base remote=remote_host_base_general #host_ip=IPSocket.getaddress(remote[:host]) unless remote[:host].empty? - @@flag_remote=true if remote[:name] =~/\S+@\S+/ #and host_ip =~/\d+\.\d+\.\d+\.\d+/ #very naive check should be enough /[0-255]+\.[0-255]+\.[0-255]+\.[0-255]+/ + @@flag_remote=true if remote[:name] =~/\S+?@\S+/ #and host_ip =~/\d+\.\d+\.\d+\.\d+/ #very naive check should be enough /[0-255]+\.[0-255]+\.[0-255]+\.[0-255]+/ remote_host_base_general[:name] end def scp #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index 31447aae..c2a6b14f 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -197,11 +197,11 @@ module SiSU_TeX end def latexrun_selective begin - ep_dir=Dir.pwd - Dir.chdir(ep_dir) + pwd=Dir.pwd + Dir.chdir(pwd) #watch @tex_f_no=0 info={} - if FileTest.file?("#{ep_dir}/#{@md.fns}") + if FileTest.file?(@env.source_file_with_path) if @md.fns =~/\.[_-]?sst$/ @dirout=SiSU_Env::Info_env.new(@md.fns) case @md.fns @@ -221,7 +221,8 @@ module SiSU_TeX end end else - puts "\n#{@cX.fuschia}FILE NOT FOUND:#{@cX.off} << #{file} >> - requested latex system processing skipped\n" + tell=SiSU_Screen::Ansi.new(@md.cmd,"FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped") + tell.warn end lst=Dir["*.{aux,log,out}"] lst.each {|file| File.unlink(file)} if lst @@ -337,7 +338,6 @@ module SiSU_TeX def enclose(para,type='') para.strip! if type =~/code/; para - #para = '\begin{footnotesize} \begin{ttfamily} ' + para + ' \end{ttfamily} \end{footnotesize}' elsif para !~/(\\begin\{tabular\}.*|\\end\{tabular\}|&|#{@@tex_backslash*2})\s*$/ #check para.gsub!(/(.+)/m,"\n#{@tex.skip_small} \\1 #{@tex.skip_small}\n") else para @@ -433,9 +433,6 @@ WOK @lineone=case para when /<:(alt|verse|group)>/; para when /<:code>/; "#{@tex.paraskip_small} \\begin{scriptsize} " + para - #when /<:code>/; "#{@tex.paraskip_small} \\begin{footnotesize} " + para - ##when /<:code>/; "#{@tex.paraskip_small} \\begin{texttt} " + para - #when /<:code>/; "#{@tex.paraskip_small} \\begin{small} \\begin{ttfamily} " + para else 'error' #should never occur end end diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 83fd90a1..55f1e19a 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -464,7 +464,7 @@ WOK @string.gsub!(/_/,'<=underscore>') # _ SiSU special character also LaTeX @string.gsub!(/|/,'|') # | SiSU not really special sisu character but done, also LaTeX @string.gsub!(/:/,':') # : SiSU not really special sisu character but done, also LaTeX - @string.gsub!(/^/,'<=caret>') # ^ SiSU not really special sisu character but done, also LaTeX + @string.gsub!(/^|\^/,'<=caret>') # ^ SiSU not really special sisu character but done, also LaTeX @string.gsub!(/\#/,'<=hash>') ##watch placement, problem sequence ^ @string.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ') @@ -600,7 +600,7 @@ WOK para.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1') cont_ln=para.dup cont_ln.gsub!(/#{@@tex_pattern_margin_number}/,'') - cont_ln.gsub!(/#{lev}#{@@tilde}\s+/,'') + cont_ln.gsub!(/#{lev}#{@@tilde}(?:\S+)?\s+/,'') if para =~/\\[Ff]ootnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings! cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ') cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') |