From 084d10a94dd5a62b09de69ad95971f579097f07e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 8 Dec 2007 01:45:13 +0000 Subject: changelog and version updated --- lib/sisu/v0/cgi.rb | 9 +++-- lib/sisu/v0/cgi_pgsql.rb | 11 ++++-- lib/sisu/v0/cgi_sqlite.rb | 6 +-- lib/sisu/v0/dal_doc_str_tables.rb | 4 +- lib/sisu/v0/db_load_tuple.rb | 6 +-- lib/sisu/v0/digests.rb | 2 +- lib/sisu/v0/html_promo.rb | 8 ++-- lib/sisu/v0/param.rb | 2 +- lib/sisu/v0/plaintext.rb | 2 +- lib/sisu/v0/shared_xml.rb | 3 +- lib/sisu/v0/sst_to_s_xml_dom.rb | 4 +- lib/sisu/v0/sst_to_s_xml_node.rb | 8 ++-- lib/sisu/v0/sst_to_s_xml_sax.rb | 4 +- lib/sisu/v0/texpdf_format.rb | 79 +++++++++++++++++++++------------------ lib/sisu/v0/wikispeak.rb | 2 +- 15 files changed, 81 insertions(+), 69 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/cgi.rb b/lib/sisu/v0/cgi.rb index e17374b0..9ade56bd 100644 --- a/lib/sisu/v0/cgi.rb +++ b/lib/sisu/v0/cgi.rb @@ -31,9 +31,12 @@ If you have Internet connection, the latest version of the GPL should be available at these locations: - + - + + + + * SiSU uses: * Standard SiSU markup syntax, @@ -63,7 +66,7 @@ module SiSU_CGI class SiSU_search def initialize(opt) @opt=opt - @webserv=@opt.files[0].to_s.strip + @webserv=@opt.files[0].to_s.strip #verify @opt.files[0].class end def search_info a=%{ diff --git a/lib/sisu/v0/cgi_pgsql.rb b/lib/sisu/v0/cgi_pgsql.rb index 9a6486ff..173f46db 100644 --- a/lib/sisu/v0/cgi_pgsql.rb +++ b/lib/sisu/v0/cgi_pgsql.rb @@ -31,9 +31,12 @@ If you have Internet connection, the latest version of the GPL should be available at these locations: - + - + + + + * SiSU uses: * Standard SiSU markup syntax, @@ -173,10 +176,10 @@ module SiSU_CGI_pgsql @search_text,@search_endnotes=[],[] #% search[:text].each{|x| @search_text << "#{x} AND " } - @search_text=@search_text.to_s.gsub!(/AND\s+$/,'') + @search_text=@search_text.join.gsub!(/AND\s+$/,'') #watch @search_text.gsub!(/(documents\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+documents\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)') search[:endnotes].each{|x| @search_endnotes << "#{x} AND " } - @search_endnotes=@search_endnotes.to_s.gsub!(/AND\s+$/,'') + @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/,'') #watch @search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') end WOK_SQL diff --git a/lib/sisu/v0/cgi_sqlite.rb b/lib/sisu/v0/cgi_sqlite.rb index e54c8570..eb249b2d 100644 --- a/lib/sisu/v0/cgi_sqlite.rb +++ b/lib/sisu/v0/cgi_sqlite.rb @@ -167,10 +167,10 @@ module SiSU_CGI_sqlite @search_text,@search_endnotes=[],[] #% search[:text].each{|x| @search_text << "#{x} AND " } - @search_text=@search_text.to_s.gsub!(/AND\s+$/,'') + @search_text=@search_text.join.gsub!(/AND\s+$/,'') @search_text.gsub!(/(documents\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+documents\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') search[:endnotes].each{|x| @search_endnotes << "#{x} AND " } - @search_endnotes=@search_endnotes.to_s.gsub!(/AND\s+$/,'') + @search_endnotes=@search_endnotes.join.gsub!(/AND\s+$/,'') @search_text.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') end WOK_SQL @@ -210,7 +210,7 @@ module SiSU_CGI_sqlite end def dbi_connect <<-'WOK_SQL' - @dbi="DBI:SQLite:#{sqlite.db}" #sqlite3 ? + @dbi="DBI:SQLite:#{db_sqlite}" #sqlite3 ? @conn=DBI.connect(@dbi) WOK_SQL end diff --git a/lib/sisu/v0/dal_doc_str_tables.rb b/lib/sisu/v0/dal_doc_str_tables.rb index 280a280a..d1ba776a 100644 --- a/lib/sisu/v0/dal_doc_str_tables.rb +++ b/lib/sisu/v0/dal_doc_str_tables.rb @@ -83,8 +83,8 @@ module SiSU_document_structure_tables @row[count]=row.split(/\|/) end @row.compact! - widths=if @row[0].to_s =~/^\{(?:t|table)(?:~h)?\s+\d+;/ - col_width=@row[0].to_s.scan(/\d+/) + widths=if @row[0].join =~/^\{(?:t|table)(?:~h)?\s+\d+;/ + col_width=@row[0].join.scan(/\d+/) rem=(100 - col_width[0].to_i) col_w=rem/(@row[1].length - 1) "#{col_width[0].to_s};" + ("#{col_w};" * (@row[1].length-1)) diff --git a/lib/sisu/v0/db_load_tuple.rb b/lib/sisu/v0/db_load_tuple.rb index e324fd1b..d85346cc 100644 --- a/lib/sisu/v0/db_load_tuple.rb +++ b/lib/sisu/v0/db_load_tuple.rb @@ -89,8 +89,8 @@ module SiSU_DB_tuple }) end if @opt.cmd =~/v/ - if @col[:lev].to_s =~/[1235678]/ - lev=case @col[:lev].to_s + if @col[:lev].inspect =~/[1235678]/ + lev=case @col[:lev].inspect when /1/; ':A' when /2/; ':B' when /3/; ':C' @@ -98,7 +98,7 @@ module SiSU_DB_tuple when /6/; ' 3' end puts %{#{lev}>\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:ocnd]}\t#{@col[:ocns]}} - elsif @col[:lev].to_s =~/[4]/ + elsif @col[:lev].inspect =~/[4]/ puts %{ #{@cX.green}1>#{@cX.off}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:ocnd]}\t#{@col[:ocns]}\t#{@col[:seg]}} end end diff --git a/lib/sisu/v0/digests.rb b/lib/sisu/v0/digests.rb index e603f0c9..1d49bb1d 100644 --- a/lib/sisu/v0/digests.rb +++ b/lib/sisu/v0/digests.rb @@ -139,7 +139,7 @@ module SiSU_Digest_view end def output filename_digest=SiSU_Env::SiSU_file.new(@md,@md.fn[:digest]).mkfile - filename_digest << @@description << @@ds[:digests] << @@ds[:tree] << @@ds[:summary] << @@sc_info + filename_digest << @@description.join << @@ds[:digests].join << @@ds[:tree].join << @@ds[:summary].join << @@sc_info.join end def rgx_txt(txt) txt=txt.gsub(/([()])/,"\\\\\\1") diff --git a/lib/sisu/v0/html_promo.rb b/lib/sisu/v0/html_promo.rb index 75a8e46b..43040c25 100644 --- a/lib/sisu/v0/html_promo.rb +++ b/lib/sisu/v0/html_promo.rb @@ -101,7 +101,7 @@ module SiSU_HTML_promo end ads_array end - adverts(ads) + adverts(ads.join) #else no_adverts end end @@ -192,7 +192,7 @@ module SiSU_HTML_promo links_a << %{\n} end end - links_a.to_s + links_a.join else '' end end @@ -382,7 +382,7 @@ WOK @ad[:promo_list][category].keys.each do |type| @ad[:promo_list][category][type].each do |i| if i - id=i.to_s =~/^\d/ ? "id_#{i.to_s.strip}" : i.to_s.strip + id=i.inspect =~/^\d/ ? "id_#{i.to_s.strip}" : i.to_s.strip #watch remove .to_s ? gbp=usd=euro=nil if defined? @ad[:promo][type][id] \ and not @ad[:promo][type][id].nil? @@ -395,7 +395,7 @@ WOK tell=SiSU_Screen::Ansi.new(@md.cmd,"category not found: #{category}") tell.warn unless @md.cmd =~/q/ end - adverts.to_s + adverts.join end def advert_extract_all #extracts all products from list (which is broken down into categories) adverts=[] diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index 1fea8729..92fbf26f 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -828,7 +828,7 @@ module SiSU_Param @lv2=/^(?:Part|PART)\b/ end if doc_struct[:part] > 2 \ - and @lv[2].to_s !~/Part/ \ + and @lv[2].inspect !~/Part/ \ and @lv[1].nil? @lv1=/^(Part|PART)\b/ end diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 3af2f8c3..43e8553c 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -199,7 +199,7 @@ module SiSU_Plaintext def extract_endnotes(para='') notes=para.scan(/~[{\[]([\d*+]+\s+.+?)\s*<#@dp>[}\]]~/) @n=[] - notes.each do |n| #high cost to deal with
appropriately within plaintext, consider + notes.flatten.each do |n| #high cost to deal with
appropriately within plaintext, consider n=n.dup.to_s if n =~// fix = n.split(//) #watch #added diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 4492dbe7..25f0d4d4 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -441,7 +441,8 @@ module SiSU_XML_tags #Format @rdfurl=%{ rdf:about="http://www.jus.uio.no/lm/toc"\n} if @md.dc_title # DublinCore 1 - title @rdf_title=%{ dc.title="#{seg_name}#{@md.dc_title}"\n} - @dc_title=%{ \n} + @dc_title=%{ \n} + #@dc_title=%{ \n} end if @md.dc_creator # DublinCore 2 - creator/author (author) @rdf_creator=%{ dc.creator="#{@md.dc_creator}"\n} diff --git a/lib/sisu/v0/sst_to_s_xml_dom.rb b/lib/sisu/v0/sst_to_s_xml_dom.rb index 589051a5..9aefe901 100644 --- a/lib/sisu/v0/sst_to_s_xml_dom.rb +++ b/lib/sisu/v0/sst_to_s_xml_dom.rb @@ -535,7 +535,7 @@ WOK content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata] content << @@xml[:owner_details] if @md.stmp =~/\w\w/ content << @@xml[:tail] << @@xml[:close] - Output.new(content.to_s,@md).xml + Output.new(content.join,@md).xml @@xml={} end end @@ -559,7 +559,7 @@ WOK para="#{para}\n" unless para.empty? @sisu << para end - new_file_data=@sisu.to_s + new_file_data=@sisu.join @sisu=new_file_data.scan(/.+/) SiSU_Env::SiSU_file.new(@md).mkdir filename_sxm=SiSU_Env::SiSU_file.new(@md,@md.fn[:sxd]).mkfile_pwd diff --git a/lib/sisu/v0/sst_to_s_xml_node.rb b/lib/sisu/v0/sst_to_s_xml_node.rb index d0252e44..4f4168f6 100644 --- a/lib/sisu/v0/sst_to_s_xml_node.rb +++ b/lib/sisu/v0/sst_to_s_xml_node.rb @@ -225,11 +225,11 @@ WOK self end def build_relationships(o='',lv='') - if lv.to_s =~/[0-6]/ + if lv.inspect =~/[0-6]/ @node[:ocn][lv]=o.ocn @node[:no][lv]=o.node end - if lv.to_s =~/^[1-6]/; @@current=lv + if lv.inspect =~/^[1-6]/; @@current=lv end if o.node == 1 \ or lv == 1 @@ -579,7 +579,7 @@ WOK content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata] content << @@xml[:owner_details] if @md.stmp =~/\w\w/ content << @@xml[:tail] << @@xml[:close] - Output.new(content.to_s,@md).xml + Output.new(content.join,@md).xml @@xml={} end end @@ -597,7 +597,7 @@ WOK para="#{para}\n" unless para.empty? @sisu << para end - new_file_data=@sisu.to_s + new_file_data=@sisu.join @sisu=new_file_data.scan(/.+/) SiSU_Env::SiSU_file.new(@md).mkdir filename_sxm=SiSU_Env::SiSU_file.new(@md,@md.fn[:sxn]).mkfile_pwd diff --git a/lib/sisu/v0/sst_to_s_xml_sax.rb b/lib/sisu/v0/sst_to_s_xml_sax.rb index c5e68f34..8da3c9cf 100644 --- a/lib/sisu/v0/sst_to_s_xml_sax.rb +++ b/lib/sisu/v0/sst_to_s_xml_sax.rb @@ -396,7 +396,7 @@ WOK content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata] content << @@xml[:owner_details] if @md.stmp =~/\w\w/ content << @@xml[:tail] << @@xml[:close] - Output.new(content.to_s,@md).xml + Output.new(content.join,@md).xml @@xml={} end end @@ -414,7 +414,7 @@ WOK para="#{para}\n" unless para.empty? @sisu << para end - new_file_data=@sisu.to_s + new_file_data=@sisu.join @sisu=new_file_data.scan(/.+/) SiSU_Env::SiSU_file.new(@md).mkdir filename_sxm=SiSU_Env::SiSU_file.new(@md,@md.fn[:sxs]).mkfile_pwd diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index e1e3a583..7d0f3967 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -803,23 +803,26 @@ WOK # clean up ! - work area, testing dir=SiSU_Env::Info_env.new(@md.fns) @words=[] + @url_generic_rgx=/\\\{.+?\\?\}(?:https?|file|ftp):\S+/ @string.each do |word| - @words << if word=~/\\\{.+?\\\}(?:https?|file|ftp):\S+/ - if word =~/\\\{(.+?)\\\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/ - r=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/ - d=/\\\{.+?\\?\}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?([;.,]?(?:\s|$))/.match(word).captures.to_s + @words << if word=~@url_generic_rgx + if word =~/\\\{(?:.+?)\\?\}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?(?:[;.,]?(?:\s|$)|(?:\s|$))/ + regx_url=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/ + punctuate=/\\\{.+?\\?\}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?([;.,]?(?:\s|$))/.match(word).captures.join else - r=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\S+)/ - d='' + regx_url=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\S+)/ + punctuate='' end - z,url=r.match(word).captures if word =~r + z,url=regx_url.match(word).captures if word =~regx_url url=url.strip if word =~/\{\s*\S+\.?(?:png|jpg|gif)/ \ and word=~/\s+\d+x\d+\s+/ image,x,y=z.scan(/\S+/) image.gsub!(/\\/,'') - width=200 - width=z[/(\d+)x\d*/,1] ||='200' #watch + width=if z =~/(\d+)x\d*/ + z[/(\d+)x\d*/,1] + else 200 + end dm=case @md.papersize when /a4/; @tx.a4 when /letter/; @tx.letter @@ -829,58 +832,60 @@ WOK else @tx.a4 end width=if orientation =~/portrait/ #value is not currently passed - width=if width.to_i > dm.portrait.img_px; dm.portrait.img_px - else width + width=if width.to_i > dm.portrait.img_px + dm.portrait.img_px + else width end else - width=if width.to_i > dm.landscape.img_px; dm.landscape.img_px - else width + width=if width.to_i > dm.landscape.img_px + dm.landscape.img_px + else width end end c=z[/``(.+?)''/m,1] hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace - caption="{\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" if c + caption=if c + "{\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" + else '' + end elsif word =~/\{\s*(\S+\.?\.(?:png|jpg|gif))/ tell=SiSU_Screen::Ansi.new(@md.cmd,%{document built without image: "#{$1}" as image dimensions not provided (& librmagick-ruby is not installed)?\n}) tell.print_grey #unless @opt.cmd =~/q/ end - ins=if image #most images fc etc. #% clean up ! - out=if @md.fns =~/\.(?:ssm\.)?sst$/ \ + word=if image #most images fc etc. #% clean up ! + word=if @md.fns =~/\.(?:ssm\.)?sst$/ \ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") - @center_begin + - "\\\n\\href{#{url}}" + #not satisfactory: \\ added to ^line to mimic reference file output - "{\\includegraphics*[width=#{width}pt]" + - "{#{dir.path.image_source_local_tex}/#{image}}}" + - "#{caption}" + - @center_end if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ + word=if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ + "#@center_begin\\\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_local_tex}/#{image}}}#{caption} #@center_end" + end + word elsif @md.fns =~/\.-ss[tm]$/ \ and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") - @center_begin + - "\\\n\\href{#{url}}" + #not satisfactory: \\ added to ^line to mimic reference file output - "{\\includegraphics*[width=#{width}pt]" + - "{#{dir.path.image_source_remote_tex}/#{image}}}" + - "#{caption}" + - @center_end if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ + word=if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ + "#@center_begin\\\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_remote_tex}/#{image}}}#{caption}#@center_end" + end + word elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}") - @center_begin + - "\\\n\\href{#{url}}\n" + #not satisfactory: \\ added to ^line to mimic reference file output, mirror above ... not tested - "{\\includegraphics*[width=#{width}pt]" + - "{#{dir.path.image_source_tex}/#{image}}}" + - "#{caption}" + - @center_end if word =~/(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ + word=if word =~/(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ + "#@center_begin\\\n\\href{#{url}}\n{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}#@center_end" + end + word else tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}") tell.error2 unless @md.cmd =~/q/ - '' if word =~ /\{\S+\.(png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+/ + word='' if word =~ /\{\S+\.(png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+/ + word end else link=z.strip #[/(.+?)\\/m,1] - word="\\href{#{url}}{#{link}}#{d}" if word =~/\\\{.+?\\\}(?:https?|file|ftp):\/\/\S+/ + word="\\href{#{url}}{#{link}}#{punctuate}" if word =~/\\\{.+?\\\}(?:https?|file|ftp):\/\/\S+/ + word end else word end end - @words.join + @words=@words.join + @words end def http(orientation) wm=@string.dup.scan(/\\\{.+?\\\}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m) diff --git a/lib/sisu/v0/wikispeak.rb b/lib/sisu/v0/wikispeak.rb index acf14759..224e1497 100644 --- a/lib/sisu/v0/wikispeak.rb +++ b/lib/sisu/v0/wikispeak.rb @@ -379,7 +379,7 @@ WOK #content << @@wiki[:metadata] #content << @@wiki[:owner_details] if @md.stmp =~/\w+/ #not used? #content << @@wiki[:tail] - Output.new(content.to_s,@md).wiki + Output.new(content.join,@md).wiki @@wiki[:head],@@wiki[:body],@@wiki[:tail],@@wiki[:metadata]=[],[],[],[] end end -- cgit v1.2.3