From e1ec4bd2dad2bd22ad97cea398ae1cfcfae183a2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 15 Oct 2007 19:27:16 +0100 Subject: mostly the arrangement of conditionals --- CHANGELOG | 4 ++ lib/sisu/v0/cgi_pgsql.rb | 3 +- lib/sisu/v0/cgi_sql_common.rb | 9 +++-- lib/sisu/v0/cgi_sqlite.rb | 6 ++- lib/sisu/v0/concordance.rb | 12 ++++-- lib/sisu/v0/dal.rb | 64 +++++++++++++++++++++--------- lib/sisu/v0/dal_doc_str.rb | 30 ++++++++++---- lib/sisu/v0/dal_doc_str_code.rb | 37 +++++++++++------ lib/sisu/v0/dal_doc_str_tables.rb | 12 ++++-- lib/sisu/v0/dal_syntax.rb | 41 +++++++++++++------ lib/sisu/v0/db_import.rb | 67 ++++++++++++++++++++----------- lib/sisu/v0/db_load_tuple.rb | 10 ++++- lib/sisu/v0/dbi.rb | 20 +++++++--- lib/sisu/v0/defaults.rb | 6 ++- lib/sisu/v0/digests.rb | 15 ++++--- lib/sisu/v0/help.rb | 5 ++- lib/sisu/v0/html.rb | 43 ++++++++++++++------ lib/sisu/v0/html_format.rb | 14 +++++-- lib/sisu/v0/html_format_css.rb | 3 +- lib/sisu/v0/html_promo.rb | 31 ++++++++++----- lib/sisu/v0/html_scroll.rb | 19 ++++++--- lib/sisu/v0/html_segments.rb | 24 ++++++++---- lib/sisu/v0/html_tune.rb | 9 +++-- lib/sisu/v0/hub.rb | 72 ++++++++++++++++++++++------------ lib/sisu/v0/manifest.rb | 28 ++++++++----- lib/sisu/v0/manpage.rb | 26 ++++++++---- lib/sisu/v0/odf.rb | 37 ++++++++++++----- lib/sisu/v0/options.rb | 7 +++- lib/sisu/v0/param_identify_markup.rb | 15 ++++--- lib/sisu/v0/plaintext.rb | 46 +++++++++++++++------- lib/sisu/v0/rexml.rb | 3 +- lib/sisu/v0/screen_text_color.rb | 8 ++-- lib/sisu/v0/share_src_kdissert.rb | 3 +- lib/sisu/v0/shared_html_lite.rb | 6 ++- lib/sisu/v0/shared_txt.rb | 12 ++++-- lib/sisu/v0/shared_xml.rb | 6 ++- lib/sisu/v0/sitemaps.rb | 3 +- lib/sisu/v0/sst_convert_markup.rb | 19 +++++---- lib/sisu/v0/sst_do_inline_footnotes.rb | 25 ++++++++---- lib/sisu/v0/sst_identify_markup.rb | 35 +++++++++++------ lib/sisu/v0/sst_to_s_xml_dom.rb | 38 ++++++++++++++---- lib/sisu/v0/sst_to_s_xml_node.rb | 31 +++++++++++---- lib/sisu/v0/sst_to_s_xml_sax.rb | 10 ++++- lib/sisu/v0/texinfo.rb | 27 ++++++++----- lib/sisu/v0/texpdf.rb | 20 +++++++--- lib/sisu/v0/texpdf_format.rb | 33 ++++++++++------ lib/sisu/v0/urls.rb | 43 ++++++++++++++------ lib/sisu/v0/wikispeak.rb | 17 +++++--- lib/sisu/v0/xhtml.rb | 20 +++++++--- lib/sisu/v0/xml.rb | 19 ++++++--- lib/sisu/v0/xml_dom.rb | 46 +++++++++++++++++----- 51 files changed, 800 insertions(+), 339 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index cf91fcf6..06e22317 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -30,6 +30,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.62.0.orig.tar.gz * remote, (put, get) placed in single file (consider separating later) + * conf, remote, work on rsync building of basic remote site structure + * embedded content, included binaries such as images, audio, video, copy content associated with document to desired output locations, [decide how audio, video/multimedia are to be handled, initially just links to content] @@ -47,6 +49,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.62.0.orig.tar.gz * pruning + * conditionals rearranged, (scope for breakage) + * debian/control, added depends on rsync, used extensively (now also internally) diff --git a/lib/sisu/v0/cgi_pgsql.rb b/lib/sisu/v0/cgi_pgsql.rb index d4c620a5..796c49c8 100644 --- a/lib/sisu/v0/cgi_pgsql.rb +++ b/lib/sisu/v0/cgi_pgsql.rb @@ -73,7 +73,8 @@ module SiSU_CGI_pgsql if @sys.psql available_db_table=`psql --list` # system call requires psql available_db=available_db_table.scan(/(SiSU_\S+)/) if not available_db_table.nil? - if available_db and available_db.class == Array + if available_db \ + and available_db.class == Array available_db.flatten.each do |x| serve << x.gsub(/SiSU_(\S+)/,'\1') end diff --git a/lib/sisu/v0/cgi_sql_common.rb b/lib/sisu/v0/cgi_sql_common.rb index 73cb2342..7df73901 100644 --- a/lib/sisu/v0/cgi_sql_common.rb +++ b/lib/sisu/v0/cgi_sql_common.rb @@ -815,9 +815,12 @@ module SiSU_CGI_sql if @text_search_flag if cgi['view']=~/text/ #% txt body text=if c['suffix'] !~/1/ #seg - if @search_for.text1 =~/\S+/ or q['s1'] =~/\S+/ #% only this branch is working !! - unescaped_search=if @search_for.text1 =~/\S+/; CGI.unescape(@search_for.text1) - elsif q['s1'] =~/\S+/; CGI.unescape(q['s1']) + if @search_for.text1 =~/\S+/ \ + or q['s1'] =~/\S+/ #% only this branch is working !! + unescaped_search=if @search_for.text1 =~/\S+/ + CGI.unescape(@search_for.text1) + elsif q['s1'] =~/\S+/ + CGI.unescape(q['s1']) else nil end @search_regx=if unescaped_search #check diff --git a/lib/sisu/v0/cgi_sqlite.rb b/lib/sisu/v0/cgi_sqlite.rb index 7a8bfe41..27c20163 100644 --- a/lib/sisu/v0/cgi_sqlite.rb +++ b/lib/sisu/v0/cgi_sqlite.rb @@ -68,8 +68,10 @@ module SiSU_CGI_sqlite def sqlite serve=[] Dir.foreach(@env.path.webserv) do |x| - if x !~/^\./ and FileTest.directory?("#{@env.path.webserv}/#{x}") - if FileTest.file?("#{@env.path.webserv}/#{x}/sisu_sqlite.db"); serve << x unless x =~/^_\S+/ + if x !~/^\./ \ + and FileTest.directory?("#{@env.path.webserv}/#{x}") + if FileTest.file?("#{@env.path.webserv}/#{x}/sisu_sqlite.db") + serve << x unless x =~/^_\S+/ end end end diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index d60ffc2f..08b25195 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -241,7 +241,8 @@ WOK end if line =~@rxp_to; toy=line[@rxp_to,1] end - if toy =~/\d+/ and toy !~/^0$/ + if toy =~/\d+/ \ + and toy !~/^0$/ for word in line.scan(@rgx_scanlist) #%take in word or other match word=nil if word =~@rxp_excluded0 #watch word=nil if word =~@rxp_excluded1 #watch @@ -260,12 +261,17 @@ WOK word.gsub!(/^(\d+\.?)+$/, '') word=nil if word =~/^\s*$/ #watch if word - word.capitalize! unless word =~/[A-Z][A-Z]/ or word =~/\w+\s\w+/ + unless word =~/[A-Z][A-Z]/ \ + or word =~/\w+\s\w+/ + word.capitalize! + end #word.downcase! if word =~lesser #word.capitalize! if word =~greater @freq[word] +=1 @word_map[word] ||= [] - if line !~@rxp_lv1 and line !~@rxp_lv2 and line !~@rxp_lv3 + if line !~@rxp_lv1 \ + and line !~@rxp_lv2 \ + and line !~@rxp_lv3 @word_map[word] << location_seg("#@seg\##{toy}",toy) else @word_map[word] << case line diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 3631a77c..0b445832 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -448,7 +448,8 @@ module SiSU_DAL para.gsub!(/^@(\S+?):\s+/,'0~\1 ') para.gsub!(/^@(\S+?):([+-])\s+/,'0~\1\2 ') end - if para =~/<:insert\d+!?>/ and para !~/^%\s+/ + if para =~/<:insert\d+!?>/ \ + and para !~/^%\s+/ @skin.select ins=SiSU_Viz::Inserts.new case para @@ -530,7 +531,8 @@ module SiSU_DAL @tuned_file << para end # debug 2003w46 adding revision control info - if @md.flag_auto_endnotes and @md.flag_separate_endnotes_make + if @md.flag_auto_endnotes \ + and @md.flag_separate_endnotes_make @tuned_file << "\n4~endnotes Endnotes <-#> <~0;0:0;u0>" end @tuned_file << "\n" @@ -549,14 +551,16 @@ module SiSU_DAL para.gsub!(/^#{num}~ /,"#{num}~#{title_no} ") #where title contains title number else para.gsub!(/^#{num}~ /,"#{num}~#{title_no} #{title_no} ") #main, where title number is to be provided end - if @md.toc_lev_limit and @md.toc_lev_limit < num + if @md.toc_lev_limit \ + and @md.toc_lev_limit < num para.gsub!(/^[5-8]~(?:~\S+)?\s*/,'!_ ') end para end def auto_number_heading_ie_title(data) #also does some segment naming @tuned_file=[] - if @md.markup =~/num_top/ or @md.num_top # watch, 2003w23 + if @md.markup =~/num_top/ \ + or @md.num_top # watch, 2003w23 input="#{@md.markup}"[/num_top\=([1-6])/,1] if @md.markup input||=@md.num_top if @md.num_top !~/^$/ end @@ -565,8 +569,12 @@ module SiSU_DAL no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3) t_not=0 data.each do |para| #@md.seg_names << [additions to segment names] - if (@md.markup =~/num_top/ or (@md.num_top and @md.num_top !~/^$/)) and para !~/^0~/ - if (para =~/^(?:#{no1}|^#{no2}|^#{no3}#{no4})~#/ and para !~/^4~endnotes?/) + if (@md.markup =~/num_top/ \ + or (@md.num_top \ + and @md.num_top !~/^$/)) \ + and para !~/^0~/ + if (para =~/^(?:#{no1}|^#{no2}|^#{no3}#{no4})~#/ \ + and para !~/^4~endnotes?/) t_not+=1 #; t_no2=0; t_no3=0 para.gsub!(/^(#{no1})~#\s*/,"\\1~ps#{t_not} ") para.gsub!(/^(#{no2})~#\s*/,"\\1~ps#{t_not} ") @@ -577,11 +585,14 @@ module SiSU_DAL @subnumber=1 @subnumber=0 if para =~/#{no1}~/ end - if para =~/^[0-6]~[ \w-]/ and para !~ /(?:[0-6]~[\w-]+-|4~endnotes|^[0-6]~([a-z_\.]+)\s+[\d.]+)\s/ and para !~/<~#>|<-#>/ + if para =~/^[0-6]~[ \w-]/ \ + and para !~ /(?:[0-6]~[\w-]+-|4~endnotes|^[0-6]~([a-z_\.]+)\s+[\d.]+)\s/ \ + and para !~/<~#>|<-#>/ if para =~/^#{no1}~/ t_no1+=1; t_no2=0; t_no3=0 title_no="#{t_no1}" - if not @md.seg_names.nil? and not @md.seg_names.include?(title_no) + if not @md.seg_names.nil? \ + and not @md.seg_names.include?(title_no) para.gsub!(/^#{no1}~\s+(\S+)#/,"#{no1}~#{title_no} \\1 #{title_no} ") #shift placement of auto-number to after first word, e.g. Article # not # Article, added on occasion of ABF (20040329) para.gsub!(/^#{no1}\{\s+(Article|Clause|Section)\s+#/i,%{#{no1}~#{title_no} \\1 #{title_no}. }) unless para =~/^#{no1}~\s+[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review @@ -677,18 +688,22 @@ module SiSU_DAL art_filename_auto=1 @counter=1 @unique_auto_name=[] - puts 'manual segment names, numbers used as names, risk warning (segmented html)' if not @md.seg_autoname_safe and @md.cmd =~/[MV]/ + if not @md.seg_autoname_safe and @md.cmd =~/[MV]/ + puts 'manual segment names, numbers used as names, risk warning (segmented html)' + end data.each do |para| para=SiSU_document_structure::Structure.new(@md,para).structure_markup if para =~/^[456]~ / - if para=~/^4/ and not @md.set_heading_seg + if para=~/^4/ \ + and not @md.set_heading_seg @md.set_heading_seg=true end if para =~/^[456]~(?:\s\S+)?\s+([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name pattern=$1 pattern.gsub!(/(?:[:,-]|\W)/,'.') pattern.gsub!(/\.$/,'') - if not @md.seg_names.nil? and not @md.seg_names.include?(pattern) + if not @md.seg_names.nil? \ + and not @md.seg_names.include?(pattern) para.gsub!(/^([456])~\s*/,"\\1~#{pattern} ") @md.seg_names << pattern else puts 'warn, there may be a conflicting numbering scheme' if @md.cmd =~/[VM]/ @@ -698,7 +713,8 @@ module SiSU_DAL pattern=$1 pattern.gsub!(/(?:[:,-]|\W)/,'.') pattern.gsub!(/\.$/,'') - if not @md.seg_names.nil? and not @md.seg_names.include?(pattern) + if not @md.seg_names.nil? \ + and not @md.seg_names.include?(pattern) para.gsub!(/^(4)~\s*/,"\\1~#{pattern} ") @md.seg_names << pattern else @@ -707,7 +723,8 @@ module SiSU_DAL end end if para =~/^4~\s+/ #if still not segment name, provide a numerical one - if not @md.seg_names.nil? and not @md.seg_names.include?(art_filename_auto) + if not @md.seg_names.nil? \ + and not @md.seg_names.include?(art_filename_auto) para.gsub!(/^4~\s+/,%{4~_#{art_filename_auto} }) @md.seg_names << art_filename_auto else puts 'segment name (numbering) error' @@ -715,7 +732,10 @@ module SiSU_DAL art_filename_auto+=1 end end - @tuned_file << if para =~/^([1-6])~/m and (@md.pagenew or @md.pagebreak); m=$1 #watch ref~ + @tuned_file << if para =~/^([1-6])~/m \ + and (@md.pagenew \ + or @md.pagebreak) + m=$1 #watch ref~ para_tmp=[] if @md.pagenew.to_s =~/#{m}/; para_tmp << "<:pn>\n" << para end @@ -738,7 +758,8 @@ module SiSU_DAL @tuned_file=[] data.each do |para| unless @md.set_heading_top - if para !~/^(?:@\S+:|0~\S+)\s/m and para !~/\A\s*\Z/m + if para !~/^(?:@\S+:|0~\S+)\s/m \ + and para !~/\A\s*\Z/m @md.set_heading_top=true head=if @md.title ; "1~ #{@md.title}" else '1~ [no title provided]' @@ -757,7 +778,9 @@ module SiSU_DAL @tuned_file=[] data.each do |para| unless @md.set_heading_seg - if para !~/^(?:@\S+:|0~\S+|[123]~)/m and para !~/\A\s*\Z/m and para !~/<:p[bn]>/ + if para !~/^(?:@\S+:|0~\S+|[123]~)/m \ + and para !~/\A\s*\Z/m \ + and para !~/<:p[bn]>/ @md.set_heading_seg=true head=if @md.title ; "4~seg [#{@md.title}]" else '4~seg [segment]' @@ -776,7 +799,8 @@ module SiSU_DAL @tuned_file=[] data.each do |para| unless @md.set_header_title - if para !~/^%{1,2}\s/m and para !~/\A\s*\Z/m + if para !~/^%{1,2}\s/m \ + and para !~/\A\s*\Z/m @tuned_file << "0~title #{@md.heading_seg_first}" @md.title=@md.heading_seg_first @md.set_header_title=true @@ -957,12 +981,14 @@ module SiSU_DAL end if true #default version information ocnm+=1; ocnv+=1 - if @md.sc_filename and @md.sc_filename.length > 3 + if @md.sc_filename \ + and @md.sc_filename.length > 3 @rc << "#{@tr.sourcefile}: #{@md.sc_filename} <~0;m#{ocnm};v#{ocnv}>" else @rc << "#{@tr.sourcefile}: #{@md.fns} <~0;m#{ocnm};v#{ocnv}>" end ocnm+=1; ocnv+=1 - if @md.file_encoding and @md.file_encoding.length > 3 #translate + if @md.file_encoding \ + and @md.file_encoding.length > 3 #translate @rc << "Filetype: #{@md.file_encoding} <~0;m#{ocnm};v#{ocnv}>" end ocnm+=1; ocnv+=1 diff --git a/lib/sisu/v0/dal_doc_str.rb b/lib/sisu/v0/dal_doc_str.rb index 57b9ca23..bd31f40c 100644 --- a/lib/sisu/v0/dal_doc_str.rb +++ b/lib/sisu/v0/dal_doc_str.rb @@ -151,26 +151,40 @@ module SiSU_document_structure o={} if para =~/\w|\S|<|\(/ if para !~ regex_exclude_ocn_and_node - if node_count_flag or para=~/^1~/ + if node_count_flag \ + or para=~/^1~/ node_count_flag=true end node+=1 if node_count_flag if para !~ regex_exclude_ocn # regex_exclude_large previously excluded unless para=~/<:#>|~#|-#/ # |^\s*\*\s*\*\s*\*\s*$ <-consider leaving un-numbered ocn+=1 - if para=~/^[1-8]~(?:\s+|\S)/ or para =~@md.lv1 or para =~@md.lv2 or para =~@md.lv3 or para =~@md.lv4 or para =~@md.lv5 or para =~@md.lv6 + if para=~/^[1-8]~(?:\s+|\S)/ \ + or para =~@md.lv1 \ + or para =~@md.lv2 \ + or para =~@md.lv3 \ + or para =~@md.lv4 \ + or para =~@md.lv5 \ + or para =~@md.lv6 ocnh+=1 - if para=~/^1~(?:\s+|\S)/ or para =~@md.lv1; ocnh1+=1 + if para=~/^1~(?:\s+|\S)/ \ + or para =~@md.lv1 + ocnh1+=1 ocn_dv,ocn_sp="1:#{ocnh1}","h#{ocnh}" - elsif para=~/^2~(?:\s+|\S)/ or para =~@md.lv2; ocnh2+=1 + elsif para=~/^2~(?:\s+|\S)/ \ + or para =~@md.lv2; ocnh2+=1 ocn_dv,ocn_sp="2:#{ocnh2}","h#{ocnh}" - elsif para=~/^3~(?:\s+|\S)/ or para =~@md.lv3; ocnh3+=1 + elsif para=~/^3~(?:\s+|\S)/ \ + or para =~@md.lv3; ocnh3+=1 ocn_dv,ocn_sp="3:#{ocnh3}","h#{ocnh}" - elsif para=~/^4~(?:\s+|\S)/ or para =~@md.lv4; ocnh4+=1 + elsif para=~/^4~(?:\s+|\S)/ \ + or para =~@md.lv4; ocnh4+=1 ocn_dv,ocn_sp="4:#{ocnh4}","h#{ocnh}" - elsif para=~/^5~(?:\s+|\S)/ or para =~@md.lv5; ocnh5+=1 + elsif para=~/^5~(?:\s+|\S)/ \ + or para =~@md.lv5; ocnh5+=1 ocn_dv,ocn_sp="5:#{ocnh5}","h#{ocnh}" - elsif para=~/^6~(?:\s+|\S)/ or para =~@md.lv6; ocnh6+=1 + elsif para=~/^6~(?:\s+|\S)/ \ + or para =~@md.lv6; ocnh6+=1 ocn_dv,ocn_sp="6:#{ocnh6}","h#{ocnh}" end else diff --git a/lib/sisu/v0/dal_doc_str_code.rb b/lib/sisu/v0/dal_doc_str_code.rb index c45d95f1..9032d54e 100644 --- a/lib/sisu/v0/dal_doc_str_code.rb +++ b/lib/sisu/v0/dal_doc_str_code.rb @@ -82,19 +82,23 @@ module SiSU_document_structure_code @@flag['code']=true @@counter=1 para.gsub!(/^code\{.*/,'<:code>') - elsif para =~/^(?:poem)\{/ and not @@flag['code'] + elsif para =~/^(?:poem)\{/ \ + and not @@flag['code'] @@flag['poem']=true para.gsub!(/^(poem)\{.*/,'<:verse>') - elsif para =~/^(?:alt|group)\{/ and not @@flag['code'] #group not tested, stub 2005 + elsif para =~/^(?:alt|group)\{/ \ + and not @@flag['code'] #group not tested, stub 2005 @@flag['group']=true para.gsub!(/^(alt|group)\{.*/,'<:\1>') end if @@flag['code'] - if @@flag['code'] and para =~/^\}code/ + if @@flag['code'] \ + and para =~/^\}code/ para.gsub!(/^\}code.*/,'<:code-end>') @@flag['code']=false end - if @@flag['code'] or para =~/<:code-end>/ #and para =~/\S/ + if @@flag['code'] \ + or para =~/<:code-end>/ #and para =~/\S/ sub_array=if para !~/<:code(?:-end)?>/; para.dup + '<:br>' else para.dup end @@ -104,15 +108,22 @@ module SiSU_document_structure_code SiSU_document_structure_code::Code.new(@md,@line_mode).code_lines('code') para=@line_mode.join end - elsif ( @@flag['poem'] or @@flag['group'] ) and not @@flag['code'] - if @@flag['poem'] and para =~/^\}(?:poem)/ + elsif ( @@flag['poem'] \ + or @@flag['group'] ) \ + and not @@flag['code'] + if @@flag['poem'] \ + and para =~/^\}(?:poem)/ para.gsub!(/^\}(poem).*/,"\n<:verse-end>") @@flag['poem']=false - elsif ( @@flag['group'] and para =~/^\}(?:alt|group)/ ) and not @@flag['code'] + elsif ( @@flag['group'] \ + and para =~/^\}(?:alt|group)/ ) \ + and not @@flag['code'] para.gsub!(/^\}(alt|group).*/,'<:\1-end>') @@flag['group']=false end - if @@flag['poem'] or @@flag['group'] and para =~/\S/ \ + if @@flag['poem'] \ + or @@flag['group'] \ + and para =~/\S/ \ and para !~/<:(verse|code|alt|group)(-end)?>/ \ and not @@flag['code'] sub_array=para.dup @@ -121,7 +132,8 @@ module SiSU_document_structure_code else 'group' end SiSU_document_structure_code::Code.new(@md,@line_mode).code_lines(type) - div=if @@flag['poem'] and @verse_count > 0 + div=if @@flag['poem'] \ + and @verse_count > 0 "\n" + '<:verse-end>' + "\n\n" + '<:verse>' else '' end @@ -130,7 +142,9 @@ module SiSU_document_structure_code else para end end - if @@flag['code'] or @@flag['poem'] or @@flag['group'] + if @@flag['code'] \ + or @@flag['poem'] \ + or @@flag['group'] @tuned_group << para if para =~/\S+/ elsif para =~/<:(?:code|alt|group|verse)-end>/ @verse_count=0 @@ -150,7 +164,8 @@ module SiSU_document_structure_code def code_lines(type='') data=@data data.each do |line| - if line =~/\S/ and line !~/^code\{|^\}code|<:code.+/ + if line =~/\S/ \ + and line !~/^code\{|^\}code|<:code.+/ line.gsub!(/\s\s/,'  ') line.gsub!(/^/,'<:codeline>') if type=='code' # try sort for texpdf special case if line =~/(?:https?|file|ftp):\/\/\S+$/ diff --git a/lib/sisu/v0/dal_doc_str_tables.rb b/lib/sisu/v0/dal_doc_str_tables.rb index e0d019bb..52b53e4f 100644 --- a/lib/sisu/v0/dal_doc_str_tables.rb +++ b/lib/sisu/v0/dal_doc_str_tables.rb @@ -131,7 +131,8 @@ module SiSU_document_structure_tables if para =~/^\{(?:t|table)(?:~h)?(?:\sc\d+;)?[\d; ]*\}/ @tuned_file << table_visual(para) @tuned_file=@tuned_file.flatten - elsif @@flag['table_to'] or para[/^table\{(?:~h)?/] + elsif @@flag['table_to'] \ + or para[/^table\{(?:~h)?/] if para[/table\{(?:~h)?\s+c(\d+;.+)/] instructions=$1 @@column=instructions.split(/;\s*/) @@ -140,7 +141,8 @@ module SiSU_document_structure_tables para.gsub!(/^table\{\s+(c\d+?;.+?)$/,'') @@flag['table_to']=true end - if @@flag['table_to'] and para =~/\}table/ + if @@flag['table_to'] \ + and para =~/\}table/ para.gsub!(/^\}table\s*$/,"\n") para.gsub!(/\n/,' ') #newlines taken out para.strip! @@ -151,7 +153,8 @@ module SiSU_document_structure_tables @tuned_table=[] @@flag['table_to']=false end - if @@flag['table_to'] and para =~/\S/ + if @@flag['table_to'] \ + and para =~/\S/ @@counter=1 sub_array=para.dup @@line_mode=sub_array.scan(/.+/) @@ -174,7 +177,8 @@ module SiSU_document_structure_tables def tr_td data=@data data.each do |line| - if @@counter <= @@columns.to_i and line !~/(\}T\s*$|<:table[-_](close|end)>|)/ + if @@counter <= @@columns.to_i \ + and line !~/(\}T\s*$|<:table[-_](close|end)>|)/ line.gsub!(/(.+)/,"¡¡#{@@column[@@counter]}¡\\1") unless line =~/)?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?} bold_line=%q{^!_\s.+?(?:
|\n|$)} - @line_scan_ital=if defined? @md.make_italic[:str] and defined? @vz.markup_make_italic[:str] + @line_scan_ital=if defined? @md.make_italic[:str] \ + and defined? @vz.markup_make_italic[:str] /#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|(?:#{@md.make_italic[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/ elsif defined? @md.make_italic[:str] /#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|#{@md.make_italic[:str]}#{tail_m_ital}|\S+|\n/ @@ -80,11 +81,16 @@ module Syntax /#@http_m|#{bold_line}|#@manmkp_ital#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/ end @manmkp_bold='^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]' - @line_scan_bold=if (defined? @md.make_bold[:str] and @md.make_bold[:str]) and (defined? @vz.markup_make_bold[:str] and @vz.markup_make_bold[:str]) + @line_scan_bold=if (defined? @md.make_bold[:str] \ + and @md.make_bold[:str]) \ + and (defined? @vz.markup_make_bold[:str] \ + and @vz.markup_make_bold[:str]) /#@http_m|#{bold_line}|(?:#@manmkp_bold|#{@md.make_bold[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/ - elsif defined? @md.make_bold[:str] and @md.make_bold[:str] + elsif defined? @md.make_bold[:str] \ + and @md.make_bold[:str] /#@http_m|#{bold_line}|(?:#@manmkp_bold|#{@md.make_bold[:str]})#{tail_m_bold}|\S+|\n/ - elsif defined? @vz.markup_make_bold[:str] and @vz.markup_make_bold[:str] + elsif defined? @vz.markup_make_bold[:str] \ + and @vz.markup_make_bold[:str] /#@http_m|#{bold_line}|(?:#@manmkp_bold|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/ end end @@ -106,8 +112,10 @@ module Syntax end def wordlist_italics(line) line=line.dup - if (defined? @md.make_italic[:str] and @md.make_italic[:str]) \ - or (defined? @vz.markup_make_italic[:str] and @vz.markup_make_italic[:str]) + if (defined? @md.make_italic[:str] \ + and @md.make_italic[:str]) \ + or (defined? @vz.markup_make_italic[:str] \ + and @vz.markup_make_italic[:str]) line= if line !~/^(?:0~|%{1,4}\s|<:code)/ #!~/^(?:[0-6]~|!_|%+\s)/ word=line.scan(@line_scan_ital) word.flatten! @@ -115,9 +123,11 @@ module Syntax line_array=[] word.each do |w| unless /#@manmkp_ital|#@http_m/.match(w) - if defined? @md.make_italic[:regx] and @md.make_italic[:regx] + if defined? @md.make_italic[:regx] \ + and @md.make_italic[:regx] w.gsub!(@md.make_italic[:regx],'\1') - elsif defined? @vz.markup_make_italic and @vz.markup_make_italic + elsif defined? @vz.markup_make_italic \ + and @vz.markup_make_italic w.gsub!(@vz.markup_make_italic,'\1') end end @@ -137,7 +147,10 @@ module Syntax end def wordlist_bold(line) line=line.dup - if (defined? @md.make_bold[:str] and @md.make_bold[:str]) or (defined? @vz.markup_make_bold[:str] and @vz.markup_make_bold[:str]) + if (defined? @md.make_bold[:str] \ + and @md.make_bold[:str]) \ + or (defined? @vz.markup_make_bold[:str] \ + and @vz.markup_make_bold[:str]) line=if line !~/^(?:[0-9]~|%+\s|<:code)/ line_array=[] word=line.scan(@line_scan_bold) @@ -145,9 +158,11 @@ module Syntax word.compact! word.each do |w| unless /#@manmkp_bold|#@http_m/.match(w) - if defined? @md.make_bold[:regx] and @md.make_bold[:regx] #document header: 0~bold [bold word list] + if defined? @md.make_bold[:regx] \ + and @md.make_bold[:regx] #document header: 0~bold [bold word list] w.gsub!(@md.make_bold[:regx],'\1') - elsif defined? @vz.markup_make_bold and @vz.markup_make_bold #defaults and skin adjusted bold word list + elsif defined? @vz.markup_make_bold \ + and @vz.markup_make_bold #defaults and skin adjusted bold word list w.gsub!(@vz.markup_make_bold,'\1') end else @@ -160,7 +175,9 @@ module Syntax else line end else - if line !~/^(?:[0-9]~|%+\s)/ and line =~ /(?:^!_|^[7-9]~)\s+/; embolden(line) + if line !~/^(?:[0-9]~|%+\s)/ \ + and line =~ /(?:^!_|^[7-9]~)\s+/ + embolden(line) end end line diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index 91729e3a..6d50fb2b 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -398,7 +398,8 @@ module SiSU_DB_import @col[:lv4]+=1 @col[:lid]+=1 @col[:lev]=4 - @hname=if @col[:seg] and not @col[:seg].to_s.empty? + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? @@hname=@col[:seg].to_s else @@hname end @@ -436,7 +437,8 @@ module SiSU_DB_import @col[:lv5]+=1 @col[:lid]+=1 @col[:lev]=5 - @hname=if @col[:seg] and not @col[:seg].to_s.empty? + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? @@hname=@col[:seg].to_s else @@hname end @@ -474,7 +476,8 @@ module SiSU_DB_import @col[:lv6]+=1 @col[:lid]+=1 @col[:lev]=6 - @hname=if @col[:seg] and not @col[:seg].to_s.empty? + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? @@hname=@col[:seg].to_s else @@hname end @@ -507,7 +510,8 @@ module SiSU_DB_import @col[:lid]+=1 txt='' txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=(/(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/m).match(data).captures - @hname=if @col[:seg] and not @col[:seg].to_s.empty? + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? @@hname=@col[:seg].to_s else @@hname end @@ -523,7 +527,8 @@ module SiSU_DB_import end txt=endnotes(txt).clean_text(@base_url) end - if @sql_type=~/pg/ and txt.size > (document_clean - 1) #% examine pg build & remove limitation + if @sql_type=~/pg/ \ + and txt.size > (document_clean - 1) #% examine pg build & remove limitation puts "\n\nTOO LARGE (TXT - see error log)\n\n" open("#{Dir.pwd}/pg_documents_error_log",'a') do |error| error.puts("\n#{@opt.fns}\nTEXT BODY\n#{@col[:body].size} object #{@col[:ocn]} -> #{@col[:body].slice(0..500)}") @@ -700,54 +705,72 @@ module SiSU_DB_import out=@env.path.output markup,meta,latex,plaintext,html_toc,html_doc,xml_sax,xml_dom,pdf_p,pdf_l,concordance,sisupod='','','','','','','','','','','','' markup_li,meta_li,latex_li,plaintext_li,html_li,xml_sax_li,xml_dom_li,pdf_p_li,pdf_l_li,concordance_li,sisupod_li='','','','','','','','','','','' - if @fnb.empty? or @fnb.nil?; p 'file output path error' #remove + if @fnb.empty? \ + or @fnb.nil? + p 'file output path error' #remove end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:plain]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:plain]}")==true) plaintext,plaintext_li='plaintext,', "'#{base}/#@fnb/#{@md.fn[:plain]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:toc]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:toc]}")==true) html_toc,html_toc_li='html_toc,', "'#{base}/#@fnb/#{@md.fn[:toc]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:doc]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:doc]}")==true) html_doc,html_doc_li='html_doc,', "'#{base}/#@fnb/#{@md.fn[:doc]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:xhtml]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:xhtml]}")==true) xhtml,xhtml_li='xhtml,', "'#{base}/#@fnb/#{@md.fn[:xhtml]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:sax]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:sax]}")==true) xml_sax,xml_sax_li='xml_sax,', "'#{base}/#@fnb/#{@md.fn[:sax]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:dom]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:dom]}")==true) xml_dom,xml_dom_li='xml_dom,', "'#{base}/#@fnb/#{@md.fn[:dom]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:odf]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:odf]}")==true) odf,odf_li='odf,', "'#{base}/#@fnb/#{@md.fn[:odf]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:pdf_p]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:pdf_p]}")==true) pdf_p,pdf_p_li='pdf_p,', "'#{base}/#@fnb/#{@md.fn[:pdf_p]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:pdf_l]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:pdf_l]}")==true) pdf_l,pdf_l_li='pdf_l,', "'#{base}/#@fnb/#{@md.fn[:pdf_l]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:concordance]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:concordance]}")==true) concordance,concordance_li='concordance,', "'#{base}/#@fnb/#{@md.fn[:concordance]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tex")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tex")==true) latex_p,latex_p_li='latex_p,', "'#{base}/#@fnb/#{@opt.fns}.tex'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.landscape.tex")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.landscape.tex")==true) latex_l,latex_l_li='latex_l,', "'#{base}/#@fnb/#@opt.fns}.landscape.tex'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:digest]}")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:digest]}")==true) digest,digest_li='digest,', "'#{base}/#@fnb/#{@md.fn[:digest]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:manifest]}")==true) #revisit, was to be text, this is html + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@md.fn[:manifest]}")==true) #revisit, was to be text, this is html manifest,manifest_li='manifest,', "'#{base}/#@fnb/#{@md.fn[:manifest]}'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.meta")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.meta")==true) markup,markup_li='markup,', "'#{base}/#@fnb/#{@opt.fns}.meta'," end - if @opt.cmd !~/e/ or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tgz")==true) + if @opt.cmd !~/e/ \ + or (@opt.cmd=~/e/ and FileTest.file?("#{out}/#@fnb/#{@opt.fns}.tgz")==true) sisupod,sisupod_li='sisupod,', "'#{base}/#@fnb/#{@opt.fns}.tgz'," end @conn.execute(%{ diff --git a/lib/sisu/v0/db_load_tuple.rb b/lib/sisu/v0/db_load_tuple.rb index a140ea14..3baf2f82 100644 --- a/lib/sisu/v0/db_load_tuple.rb +++ b/lib/sisu/v0/db_load_tuple.rb @@ -62,7 +62,15 @@ module SiSU_DB_tuple def initialize(conn,col,opt) @conn,@col,@opt=conn,col,opt @col[:lev]=@col[:lev].to_i - @col[:lev]=0 unless @col[:lev]=~/^[1-6]/ or @col[:lev]==1 or @col[:lev]==2 or @col[:lev]==3 or @col[:lev]==4 or @col[:lev]==5 or @col[:lev]==6 #changed from \d+ ?? + unless @col[:lev]=~/^[1-6]/ \ + or @col[:lev]==1 \ + or @col[:lev]==2 \ + or @col[:lev]==3 \ + or @col[:lev]==4 \ + or @col[:lev]==5 \ + or @col[:lev]==6 #changed from \d+ ?? + @col[:lev]=0 + end @col[:ocn]=0 unless @col[:ocn]=~/\d+/ @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX end diff --git a/lib/sisu/v0/dbi.rb b/lib/sisu/v0/dbi.rb index 0ad4880a..17568ce6 100644 --- a/lib/sisu/v0/dbi.rb +++ b/lib/sisu/v0/dbi.rb @@ -70,13 +70,21 @@ module SiSU_DBI SiSU_Env::Load.new('dbi',true).prog @opt=opt @db=SiSU_Env::Info_db.new - if @opt.cmd =~/d/i or @opt.mod.inspect =~/--pg(?:sql)?|(?:sq)?lite/ - @sql_type=if @opt.cmd=~/D/ or @opt.mod.inspect =~/--pg(?:sql)?/; 'pg' - elsif @opt.cmd =~/d/ and @opt.mod.inspect =~/--(?:db[=-])?pg(?:sql)?/; 'pg' - elsif @opt.mod.inspect =~/--(?:sq)?lite/; 'sqlite' - elsif @opt.cmd =~/d/ and @opt.mod.inspect =~/--(?:db[=-])?(?:sq)?lite/; 'sqlite' + if @opt.cmd =~/d/i \ + or @opt.mod.inspect =~/--pg(?:sql)?|(?:sq)?lite/ + @sql_type=if @opt.cmd=~/D/ \ + or @opt.mod.inspect =~/--pg(?:sql)?/ + 'pg' + elsif @opt.cmd =~/d/ \ + and @opt.mod.inspect =~/--(?:db[=-])?pg(?:sql)?/ + 'pg' + elsif @opt.mod.inspect =~/--(?:sq)?lite/ + 'sqlite' + elsif @opt.cmd =~/d/ \ + and @opt.mod.inspect =~/--(?:db[=-])?(?:sq)?lite/ + 'sqlite' #elsif @opt.cmd =~/d/ and @opt.mod.select =~/--my(?:sql)?/; 'mysql' - else 'sqlite' + else 'sqlite' end end end diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 46a55775..e75ba2e3 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -526,7 +526,8 @@ module SiSU_Viz 'SiSU' end def markup_make_italic - if defined? italics_list and italics_list + if defined? italics_list \ + and italics_list #make=italics_list.split(/;\s+/).join('|').strip make={} if italics_list @@ -547,7 +548,8 @@ module SiSU_Viz end end def markup_make_bold - if defined? bold_list and not bold_list.empty? + if defined? bold_list \ + and not bold_list.empty? make={} if bold_list #make=bold_list.split(/;\s+/).join('|').strip diff --git a/lib/sisu/v0/digests.rb b/lib/sisu/v0/digests.rb index 7324b93b..1adc8582 100644 --- a/lib/sisu/v0/digests.rb +++ b/lib/sisu/v0/digests.rb @@ -184,7 +184,8 @@ module SiSU_Digest_view @n,@s=/MD5\((\S+?\.sst)\)=\s*([0-9a-f]{#@dl})<\/u>/.match(para)[1,2] end x=unless ocn =~ /^0$/ - if images and images.length > 0 # then get path of image & produce digest + if images \ + and images.length > 0 # then get path of image & produce digest @image_name,@image_dgst,@img=[],[],[] images.each do |i| image_source=if FileTest.file?("#{@env.path.image_source_local_tex}/#{i}") @@ -227,7 +228,8 @@ module SiSU_Digest_view metad=[@tr.dc_title,@tr.creator,@tr.translator,@tr.illustrator,@tr.prepared_by,@tr.digitized_by,@tr.description,@tr.subject,@tr.abstract,@tr.publisher,@tr.contributor,@tr.date_created,@tr.date_issued,@tr.date_available,@tr.date_modified,@tr.date_valid,@tr.date,@tr.type,@tr.format,@tr.rights,@tr.identifier,@tr.source,@tr.language,@tr.language_original,@tr.relation,@tr.coverage,@tr.keywords,@tr.comments,@tr.cls_loc,@tr.cls_dewey,@tr.cls_gutenberg,@tr.cls_isbn,@tr.prefix_a,@tr.prefix_b,@tr.sourcefile,@tr.sourcefile_digest,@tr.last_generated,@tr.sisu_version,@tr.ruby_version,@tr.sc_number,@tr.sc_date,'Skin_Digest: ','Generated by: ','Ruby version: '] metad.each do |n| m=rgx_txt(n) - if m=~/\S+/ and para=~/^#{m}:/ + if m=~/\S+/ \ + and para=~/^#{m}:/ x,o=0,18 while x < 2; o = o + 2 x=o - n.length @@ -349,15 +351,18 @@ module SiSU_Digest_view dal_structure_summary(" [*] number of headers (@) and of each heading level (:A to :C and 1 to 3)\n") end def supplementary - if defined? @md.sc_number and @md.sc_number + if defined? @md.sc_number \ + and @md.sc_number rcinfo("------------\n") rcinfo("source control information\n") rcinfo(" (the following information while not important for document content certification\n may help the publisher in locating the version referred to)\n") rcinfo(" rcs version number: #{@md.sc_number}\n") - if defined? @md.sc_date and @md.sc_date + if defined? @md.sc_date \ + and @md.sc_date rcinfo(" rcs date: #{@md.sc_date}\n") end - if defined? @md.sc_time and @md.sc_time + if defined? @md.sc_time \ + and @md.sc_time rcinfo(" rcs time: #{@md.sc_time}\n") end end diff --git a/lib/sisu/v0/help.rb b/lib/sisu/v0/help.rb index 50539d9d..1c1fd4d0 100644 --- a/lib/sisu/v0/help.rb +++ b/lib/sisu/v0/help.rb @@ -77,7 +77,8 @@ module SiSU_Help help_info=%{#{@cX.blue_hi}SiSU help#{@cX.off} #{@cX.ruby}~#{@cX.off} #{@request}} help_list=%{#{@cX.blue}sisu --help#{@cX.off} #{@cX.cyan}type keyword else "enter" to exit help:\n\tkeywords include:#{@cX.off} #{@cX.brown}list, (com)mands, short(cuts), (mod)ifiers, (env)ironment, markup, syntax, headers, headings, endnotes, tables, example, customise, skin, (dir)ectories, path, (lang)uage, db, install, setup, (conf)igure, convert, external_programs, dublincore, termsheet, search, sql, hyper(est)raier, features, external_programs, license#{@cX.off} \n} help_prompt=%{#{@cX.fuschia}exit, [or carriage return to exit help] #{@cX.off}\n#{@cX.blue_hi}SiSU help#{@cX.off} #{@cX.ruby}~#{@cX.off} } - until gotten =~/exit|quit|bye|q|^\s*$/ and ( @request.nil? or @request.empty? ) + until gotten =~/exit|quit|bye|q|^\s*$/ \ + and ( @request.nil? or @request.empty? ) @help=Help.new(@request,@color) if @request puts help_info @@ -1435,7 +1436,7 @@ WOK arch: #{@cX.blue}#{@env.arch}#{@cX.off} Directories for installation - bin: #{@cX.blue}#{Config::CONFIG['bindir']}#{@cX.off} or #{@cX.blue}#{Config::CONFIG['sitelibdir']}#{@cX.off} + bin: #{@cX.blue}#{Config::CONFIG['bindir']}#{@cX.off} or #{@cX.blue}#{Config::CONFIG['sitelibdir']}#{@cX.off} lib (site-ruby): #{@cX.blue}#{Config::CONFIG['rubylibdir']}/#{SiSU_lib}#{@cX.off} or #{@cX.blue}#{Config::CONFIG['sitelibdir']}/#{SiSU_lib}#{@cX.off} conf [etc]: #{@cX.blue}#{@env.path.etc}/sisu#{@cX.off} data (document samples, images, README): #{@cX.blue}#{@env.path.sample_data}#{@cX.off} diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index c875614d..930fdb36 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -152,8 +152,10 @@ module SiSU_HTML if @md @md.sfx='' @md.sfx='' if @md.cmd =~/z/ - if @md.cmd =~/h/ or @md.fns =~/\~[a-z]{2,3}\.s?/ #multilingual document protection is a bit arbitrary, (needed by existing server configuration), add configuration overide... - if @md.cmd =~/H/ and @md.fns =~/\~[a-z]{2,3}\.s?/ + if @md.cmd =~/h/ \ + or @md.fns =~/\~[a-z]{2,3}\.s?/ #multilingual document protection is a bit arbitrary, (needed by existing server configuration), add configuration overide... + if @md.cmd =~/H/ \ + and @md.fns =~/\~[a-z]{2,3}\.s?/ SiSU_Screen::Ansi.new(@md.cmd, 'multilingual document, creating internal url links with filetype suffix', "\n\t\t(overriding -H request, using -h mode instead)" @@ -232,7 +234,8 @@ module SiSU_HTML format_head_toc=SiSU_HTML_Format_type::Head_toc.new(@md) guide_type='horzontal' #values: horizontal or vertical @links_guide_toc << format_head_toc.links_guide_open(guide_type) - if defined? @md.lnk and @md.lnk + if defined? @md.lnk \ + and @md.lnk @md.lnk.each do |l| if defined? l[:say] target=if l[:url] !~/^\.(\.)?\//; 'external' @@ -262,7 +265,8 @@ module SiSU_HTML @data.each do |para| pg=para.dup unless pg =~/^<:code>/ - if pg =~/~[{\[][\d*+]+ / + if pg =~/~[{\[][\d*+]+ / endnote_array=[] if pg=~/~\{[\d*+].+?\}\~/m endnote_array << pg.scan(/~\{[\d*+]+(.+?)\}\~/m) @@ -313,7 +317,8 @@ module SiSU_HTML when /^\s*4~!/; Toc.new(para_toc).level_crosslink else end - if @@firstseg.nil? and para=~/^4~\S+?/ + if @@firstseg.nil? \ + and para=~/^4~\S+?/ @@firstseg=/^4~(\S+)?/.match(para)[1] end if toc @@ -372,7 +377,10 @@ WOK end para[@pat_heading] linkname,link=$1,$2 if $& - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link and link !~/#/ #% keep eye on link + if link \ + and link !~/#/ #% keep eye on link + p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + end title=unless para =~/Document Information/; linkname else link='metadata' @@ -412,7 +420,10 @@ WOK end para[@pat_heading] linkname,link=$1,$2 if $& - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link and link !~/#/ + if link \ + and link !~/#/ + p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + end format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname) toc={} toc[:seg]=format_toc.lev2 @@ -432,7 +443,10 @@ WOK para.gsub(/(.*?)<\/a>(.*)/,'\1') #2002w42 altered gsub! - problematic? - suspect para[@pat_heading] linkname,link=$1,$2 if $& - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link and link !~/#/ + if link \ + and link !~/#/ + p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + end format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname) toc={} toc[:seg]=format_toc.lev3 @@ -489,7 +503,10 @@ WOK end para[@pat_heading] linkname,link=$1,$2 if $& - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link and link !~/#/ + if link \ + and link !~/#/ + p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + end toc={} if para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ m=/#{$1}/ @@ -514,7 +531,10 @@ WOK end para[@pat_heading] linkname,link=$1,$2 if $& - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link and link !~/#/ + if link \ + and link !~/#/ + p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + end toc={} if para =~/<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ m=/#{$1}/ @@ -593,7 +613,8 @@ WOK format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,tmp_head) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold - if not @md.subtitle.nil? and not @md.subtitle.empty? + if not @md.subtitle.nil? \ + and not @md.subtitle.empty? tmp_head=@md.subtitle + "\n" format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,tmp_head) toc_shared << format_txt_obj.center_bold diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index e770a339..27e6b817 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -64,12 +64,16 @@ module SiSU_HTML_Format @paranum=paranum[/(\d+)/m,1] @paranum ||='' vz=SiSU_Env::Get_init.instance.skin - @skin_no_ocn=if defined? vz.ocn_display_off and vz.ocn_display_off == true; true + @skin_no_ocn=if defined? vz.ocn_display_off \ + and vz.ocn_display_off == true + true else false end end def ocn_display - if @md.markup.inspect =~/no_ocn/ or @md.mod.inspect =~/--no-ocn/ or @skin_no_ocn + if @md.markup.inspect =~/no_ocn/ \ + or @md.mod.inspect =~/--no-ocn/ \ + or @skin_no_ocn ocn_class='ocn_off' @paranum.gsub(/^(\d+|)$/, %{

@@ -227,7 +231,8 @@ module SiSU_HTML_Format } end def pdf - pdf=if @md.programs[:pdf] and @cf_defaults.cf_0 =~/p/ + pdf=if @md.programs[:pdf] \ + and @cf_defaults.cf_0 =~/p/ %{ @@ -255,7 +260,8 @@ module SiSU_HTML_Format end end def concordance(text) - if @md.concord_make and @md.wc_words < 300000 #max word count for display of concordance here as would now be a large file + if @md.concord_make \ + and @md.wc_words < 300000 #max word count for display of concordance here as would now be a large file %{ #{text} diff --git a/lib/sisu/v0/html_format_css.rb b/lib/sisu/v0/html_format_css.rb index 497e883c..497ae1c2 100644 --- a/lib/sisu/v0/html_format_css.rb +++ b/lib/sisu/v0/html_format_css.rb @@ -344,7 +344,8 @@ module SiSU_HTML_Format_type #{@vz.table_close}} end def subtoc_lev - one=if @one and @one =~/<\/?i>|/mi + one=if @one \ + and @one =~/<\/?i>|/mi @one.gsub(/<\/?i>|/mi,'') #removes name markers from subtoc, go directly to substantive text else @one end diff --git a/lib/sisu/v0/html_promo.rb b/lib/sisu/v0/html_promo.rb index 1fc8fb4d..1f31b3b9 100644 --- a/lib/sisu/v0/html_promo.rb +++ b/lib/sisu/v0/html_promo.rb @@ -146,23 +146,27 @@ module SiSU_HTML_promo def search_form_sisu(table=true) db=if @prod['db']=~/\S+/ @prod['db']=~/^SiSU_\S+/ ? @prod['db'] : "SiSU_#{@prod['db']}" - elsif defined? @rc['search']['sisu']['db'] and @rc['search']['sisu']['db'] =~/\S+/ + elsif defined? @rc['search']['sisu']['db'] \ + and @rc['search']['sisu']['db'] =~/\S+/ @rc['search']['sisu']['db']=~/^SiSU_\S+/ ? @prod['search']['sisu']['db'] : "SiSU_#{@prod['db']}" else nil end action=if @prod['action']=~/^http:\/\// @prod['action'] - elsif defined? @rc['search']['sisu']['action'] and @rc['search']['sisu']['action'] =~/^http:\/\// + elsif defined? @rc['search']['sisu']['action'] \ + and @rc['search']['sisu']['action'] =~/^http:\/\// @rc['search']['sisu']['action'] else nil end - form=if action and db + form=if action \ + and db '
' + @env.widget.search_form('sisusearch',action,db,table) else '' end end def search_form_hyperestraier(table=true) - action=if defined? @rc['search']['hyperestraier']['action'] and @rc['search']['hyperestraier']['action'] =~/^http:\/\// + action=if defined? @rc['search']['hyperestraier']['action'] \ + and @rc['search']['hyperestraier']['action'] =~/^http:\/\// @rc['search']['hyperestraier']['action'] else nil end @@ -176,7 +180,9 @@ module SiSU_HTML_promo if @prod['links'] #and @prod['links'] == Array links_a=[] @prod['links'].each do |x| - if x and x['url'] and x['title'] + if x \ + and x['url'] \ + and x['title'] subtitle=x['subtitle'] ? %{ - #{x['subtitle']}} : '' url_=x['url'] =~/http:/ ? x['url'] : "../#{x['url']}" #url_=x['url'] =~/http:/ ? x['url'] : "#{@env.url.root}/#{x['url']}" @@ -214,19 +220,22 @@ module SiSU_HTML_promo end def price def gbp - if defined? @prod['price']['gbp'] and @prod['price']['gbp'] + if defined? @prod['price']['gbp'] \ + and @prod['price']['gbp'] "  £ #{@prod['price']['gbp']} (GBP) " else '' end end def euro - if defined? @prod['price']['euro'] and @prod['price']['euro'] + if defined? @prod['price']['euro'] \ + and @prod['price']['euro'] "  € #{@prod['price']['euro']} (Euro) " else '' end end def usd - if defined? @prod['price']['usd'] and @prod['price']['usd'] + if defined? @prod['price']['usd'] \ + and @prod['price']['usd'] "  $ #{@prod['price']['usd']} (USD) " else '' end @@ -365,13 +374,15 @@ WOK #end def advert_extract_subject(category) #extracts products from category/subject list adverts=[] - if defined? @ad[:promo_list][category] and @ad[:promo_list][category] + if defined? @ad[:promo_list][category] \ + and @ad[:promo_list][category] @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 gbp=usd=euro=nil - if defined? @ad[:promo][type][id] and not @ad[:promo][type][id].nil? + if defined? @ad[:promo][type][id] \ + and not @ad[:promo][type][id].nil? adverts << output_form_select(type,id) end end diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index 30640f30..483b5222 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -86,7 +86,10 @@ module SiSU_HTML_scroll if para =~/^\d~metadata\s+Metadata/ para.gsub!(/(Metadata)/,'\1
') end - @rcdc=true if @rcdc==false and (para =~/^\d~metadata/ or para =~/^1~meta\s+Document Information/) + if @rcdc==false \ + and (para =~/^\d~metadata/ or para =~/^1~meta\s+Document Information/) + @rcdc=true + end if para !~/(^0~||)/ unless para =~/^<:code>/; para.gsub!(/~[{\[].+?[}\]]~\s+/m,' ') end @@ -126,13 +129,16 @@ module SiSU_HTML_scroll end end end - elsif para =~/^[1-9]~\S*/ and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/^[1-9]~\S*/ \ + and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,para) para=format_txt_obj.bold_header - elsif para =~/Endnotes?/ and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/Endnotes?/ \ + and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'
Note') para=format_txt_obj.bold_para - elsif para =~/Owner Details/ and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/Owner Details/ \ + and para !~/<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'
Owner Details') @scr[:owner_details]=format_txt_obj.bold_para para='' @@ -141,7 +147,10 @@ module SiSU_HTML_scroll format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) para=format_seg.no_paranum end - para='' if (para =~// and para =~/^(?:\^~\d+\s|)/) # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though + if para =~// \ + and para =~/^(?:\^~\d+\s|)/ # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though + para='' + end if para =~/<:center>/ #rules changed now a

(.*)/.match(para).captures format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,one,two) diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index de96dd7d..595ad2dc 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -135,10 +135,13 @@ module SiSU_HTML_seg unless para =~/^1~/; head1=$_ #; end end - if @@is4 == 1 or para =~/^|^/ - if newfile == 1 or para =~/^|^/ + if @@is4 == 1 \ + or para =~/^|^/ + if newfile == 1 \ + or para =~/^|^/ newfile=0 - if para =~/^4~\S+/ or para =~/^|^/ # @@level4 + if para =~/^4~\S+/ \ + or para =~/^|^/ # @@level4 if tracking != 0 File.mkpath(@md.dir_out) unless FileTest.directory?(@md.dir_out) #bug - added specifically for nav! not needed by regular seg, check !!! Seg.new('',@md).tail @@ -260,7 +263,8 @@ module SiSU_HTML_seg paranum=m[1].to_s @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) end - if para =~/<:(?:code|alt|verse|group)>/m or @@flag_alt==true + if para =~/<:(?:code|alt|verse|group)>/m \ + or @@flag_alt==true if para =~/<:(?:code|alt|verse|group)>/m @group_collect=[] #unless @group_collect.class == Array @group_collect << @vz.margin_txt_0 + para.gsub(/<:(?:code|alt|verse|group)-end>/m,'') #watch ! @@ -304,10 +308,12 @@ module SiSU_HTML_seg when /^code$/ @sto.seg_lev_para_ocn.code when /null/ - if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ and para !~/^/ + if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ \ + and para !~/^/ format_txt_obj.gsub_body @sto.seg_lev_para_ocn.para - elsif para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ and para =~/^/ + elsif para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ \ + and para =~/^/ format_txt_obj.gsub_body @sto.seg_lev_para_ocn.table_end else para @@ -388,7 +394,8 @@ module SiSU_HTML_seg data.each do |para| para.gsub!(/(.+?)<\/a>/mi,'\1') if @md.flag_auto_endnotes - if para =~/^[1234]~/ and not @@fn.empty? + if para =~/^[1234]~/ \ + and not @@fn.empty? @@seg_endnotes[@@fn]=[] @@seg_endnotes[@@fn] << @@seg_endnotes_array @@seg_endnotes_array=[] if para=~/^4~/ @@ -427,7 +434,8 @@ module SiSU_HTML_seg @@seg_subtoc_array << para end if @md.flag_auto_endnotes - if para =~/~[{\[][\d*+]+ / # endnote- + if para =~/~[{\[][\d*+]+ / # endnote- endnote_array=[] if para=~/~\{.+?\}\~/m endnote_array << para.scan(/~\{.+?\}\~/m) diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index ab37abb2..caf88d79 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -261,7 +261,8 @@ module SiSU_Tune image_path=if @md.fns =~/\.-ss[tm]$/; @env.url.images_external else @env.url.images_local end - ins=if u and u.strip !~/^image$/ + ins=if u \ + and u.strip !~/^image$/ %{#{caption}} else %{#{caption}} end @@ -322,13 +323,15 @@ module SiSU_Tune para.gsub!(/!new/, %{ new}) para.gsub!(/<:h(.{1,7}?)>/,'\1') para.gsub!(/<:to(\d{1,7}?)>/,'to { \1 } ') - if (para =~/\b\S+\@\S+?\.\S+/ and para !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/) + if para =~/\b\S+\@\S+?\.\S+/ \ + and para !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/ para.gsub!(/\b(\S+\@\S+?\.\S+)(\s)/,'<\1>\2') end para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2') #http ftp matches escaped, no decoration para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration - if (para =~/..\/\S+/ and para !~/(\"..\/\S+?\"|>\s*..\/\S+<)/) + if para =~/..\/\S+/ \ + and para !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ para.gsub!(/(\.\.\/\S+)/,'\1') end para.gsub!(/\n "); tell.puts_grey @@ -518,13 +538,17 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ if FileTest.file?(fns) @opt.fns=fns unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|sisupod(?:\.zip)?)$/ - if @opt.fns=~/\.kdi$/ and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/ - elsif @opt.fns=~/\.sx[sdn]\.xml$/ and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/ - elsif @opt.fns=~/\.ssi$/ and @opt.mod.inspect =~/--identify/ + if @opt.fns=~/\.kdi$/ \ + and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/ + elsif @opt.fns=~/\.sx[sdn]\.xml$/ \ + and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/ + elsif @opt.fns=~/\.ssi$/ \ + and @opt.mod.inspect =~/--identify/ else Operations.new(@opt).not_recognised end end - if @opt.fns =~/\.ssm\.sst$/ and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files + if @opt.fns =~/\.ssm\.sst$/ \ + and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files @msg,@msgs='temporary file removed',nil @tell.call.warn unless @opt.cmd =~/V/ File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER diff --git a/lib/sisu/v0/manifest.rb b/lib/sisu/v0/manifest.rb index 0776f4d1..e0617fec 100644 --- a/lib/sisu/v0/manifest.rb +++ b/lib/sisu/v0/manifest.rb @@ -240,16 +240,18 @@ module SiSU_Manifest id,file='Markup Composite File (SiSU source)',req summarize_source(id,file) end - end - if FileTest.file?("#@base_path_src/#{@md.fns}")==true - id,file='Markup (SiSU source)',@md.fns - summarize_source(id,file) + else + if FileTest.file?("#@base_path_src/#{@md.fns}")==true + id,file='Markup (SiSU source)',@md.fns + summarize_source(id,file) + end end if FileTest.file?("#@base_path_src/#{@md.fn[:sisupod]}")==true id,file='SiSU doc (zip)',@md.fn[:sisupod] summarize_source(id,file) end - if FileTest.file?("#@base_path/#{@md.fnb}")==true and @md.fnb =~/\.kdi$/ + if FileTest.file?("#@base_path/#{@md.fnb}")==true \ + and @md.fnb =~/\.kdi$/ id,file='Kdissert (.kdi source)',@md.fnb summarize_source(id,file) end @@ -339,11 +341,13 @@ module SiSU_Manifest id,info=@translate.date_valid,@md.dc_date_valid metadata(id,info) end - if @md.dc_language and @md.dc_language[:name] + if @md.dc_language \ + and @md.dc_language[:name] id,info=@translate.language,@md.dc_language[:name] metadata(id,info) end - if @md.language_original and @md.language_original[:name] + if @md.language_original \ + and @md.language_original[:name] id,info=@translate.language_original,@md.language_original[:name] metadata(id,info) end @@ -437,14 +441,17 @@ module SiSU_Manifest end end def links_tests - if defined? @md.lnk and @md.lnk + if defined? @md.lnk \ + and @md.lnk @md.lnk.each do |l| if defined? l[:say] target=if l[:url] !~/^\.(\.)?\//; 'external' else '_top' end url,lnk=l[:url],l[:say] - unless url.nil? or url.empty?; links(url,lnk,target) + unless url.nil? \ + or url.empty? + links(url,lnk,target) end end end @@ -454,7 +461,8 @@ module SiSU_Manifest begin id,file='','' vz=SiSU_Env::Get_init.instance.skin - banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ and vz.banner_home_button_only !~ /sisu\.home\.png/ + banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ \ + and vz.banner_home_button_only !~ /sisu\.home\.png/ < #{vz.banner_band}

#{@url_brace.xml_open}#@base_url/#{file}#{@url_brace.xml_close}

#{@env.widget_static.search_form}SiSU --> diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index 397b94d8..e747e22a 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -289,10 +289,12 @@ WOK '.BR' << @br << wrapped # [consider s/.BR/.PP/] end end - if @@endnotes[:para] and @@dostype =~/footnote/ #edit out to switch off endnotes following paragraph to which they belong + if @@endnotes[:para] \ + and @@dostype =~/footnote/ #edit out to switch off endnotes following paragraph to which they belong @manpage[:body] << @br @@endnotes[:para].each { |e| @manpage[:body] << e << @br } - elsif @@endnotes[:para] and @@dostype =~/endnote/ + elsif @@endnotes[:para] \ + and @@dostype =~/endnote/ @manpage[:body] << @br*2 end @@endnotes[:para]=[] @@ -387,7 +389,8 @@ WOK @sto=Split_text_object.new(para).lev_segname_para_ocn ### problem in scroll, it appears tables are getting paragraph numbers m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if para =~m and para=~/\S+/ + if para =~m \ + and para=~/\S+/ para=case @sto.format when /^(1)~(?:(\S+))?/ manpage_structure(para,$1,@sto.ocn,$2) @@ -432,11 +435,14 @@ WOK end elsif para =~/#{table_message}/ @manpage[:body] << para << @br - elsif para =~/(Note|Endnotes?)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - elsif para =~/(MetaData)/ and para =~/<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info ####suspect visit + elsif para =~/(Note|Endnotes?)/ \ + and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(MetaData)/ \ + and para =~/<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info ####suspect visit #formatMono=MonoSiSU.new('
MetaData') #para=formatMono.bold_para - elsif para.include? 'Owner Details' and para !~/<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para.include? 'Owner Details' \ + and para !~/<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ #formatMono=MonoSiSU.new('
Owner Details') #@@manpage[:owner_details]=formatMono.bold_para #para='' @@ -446,7 +452,10 @@ WOK format_text=Format_text_object.new(one,two) para=format_text.seg_no_paranum end - para='' if (para =~// and para =~/^(-\{{2}~\d+|)/) # -endnote + para='' if (para =~// \ + and para =~/^(-\{{2}~\d+|)/) # -endnote + para='' + end case para when /<:i[1-9]>/ if para =~/.*<:#>.*$/m @@ -501,7 +510,8 @@ WOK filename_manpage=SiSU_Env::SiSU_file.new(@md,@md.fn[:manpage]).mkfile_man @sisu=[] @content.each do |para| # this is a hack - if para.class == Array and para.length > 0 + if para.class == Array \ + and para.length > 0 para.each do |line| line.gsub!(/\s+$/m,'') filename_manpage.puts line #unix manpage diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index feea7cde..78099d16 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -211,12 +211,16 @@ module SiSU_ODF para.gsub!(/^([1-6])~\S*\s/,'') m=/#{$1}/ breakpage='' - if @md.fns and @md.fns != '' and @md.fns !=@@fns + if @md.fns \ + and @md.fns != '' \ + and @md.fns !=@@fns @@docstart=true @@fns=@md.fns end unless @@docstart - breakpage=if (@md.pagenew or @md.pagebreak) and (@md.pagenew =~ m or @md.pagebreak =~m); ' ' + breakpage=if (@md.pagenew or @md.pagebreak) \ + and (@md.pagenew =~ m or @md.pagebreak =~m) + ' ' else '' end end @@ -224,9 +228,11 @@ module SiSU_ODF %{#{breakpage}#{para}} end def image_src(i) - image_source=if @md.fns =~/\.ss[tm]$/ and FileTest.file?("#{@env.path.image_source_local_tex}/#{i}") #review + image_source=if @md.fns =~/\.ss[tm]$/ \ + and FileTest.file?("#{@env.path.image_source_local_tex}/#{i}") #review @env.path.image_source_local_tex - elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}") + elsif @md.fns =~/\.-ss[tm]$/ \ + and FileTest.file?("#{@env.path.image_source_remote_tex}/#{i}") @env.path.image_source_remote_tex elsif FileTest.file?("#{@env.path.image_source_tex}/#{i}") @env.path.image_source_tex @@ -251,7 +257,9 @@ module SiSU_ODF image_source=image_src(i) pwd=Dir.pwd cp("#{image_source}/#{i}","#{@env.path.odf}/Pictures/#{i}") if image_source - img=if i.to_s =~/jpg|png|gif/ and h.to_s =~/\d/ and w.to_s =~/\d/ + img=if i.to_s =~/jpg|png|gif/ \ + and h.to_s =~/\d/ \ + and w.to_s =~/\d/ @@img_count +=1 %{#{c}} #anchor-type: as-char or paragraph or char or ... else %{[image omitted]} @@ -465,7 +473,9 @@ module SiSU_ODF word.each do |w| # _ - / # | : ! ^ ~ unless para =~/^(?:0~|%+ )/m w.gsub!(/&#(?:126|152);/,'~') #126 usual - if w !~/&\S{1,7};/ or w =~/ /; w.gsub!(/&/,'&') #watch   + if w !~/&\S{1,7};/ \ + or w =~/ / + w.gsub!(/&/,'&') #watch   end end para_array << w @@ -522,7 +532,8 @@ module SiSU_ODF if d_meta; odf_metadata(d_meta) end end - @rcdc=true if @rcdc==false and (para =~/~metadata/ or para =~/1~meta\s+Document Information/) + @rcdc=true if @rcdc==false \ + and (para =~/~metadata/ or para =~/1~meta\s+Document Information/) if para !~/(^0~||)/ if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change paranum=para[@regx,3] @@ -533,7 +544,8 @@ module SiSU_ODF ### problem in scroll, it appears tables are getting paragraph numbers unless @rcdc m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if para =~m and para=~/\S+/ + if para =~m \ + and para=~/\S+/ para=case @sto.format when /^(1)~(?:(\S+))?/; odf_structure(para,$1,@sto.ocn,$2) para @@ -576,7 +588,10 @@ module SiSU_ODF format_text=OD_format::Format_text_object.new(one,two) para=format_text.seg_no_paranum end - para='' if para =~// and para =~/^(-\{{2}~\d+|)/ # -endnote + if para =~// \ + and para =~/^(-\{{2}~\d+|)/ # -endnote + para='' + end if (para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/) # i don't get the condition for no paranum end @@ -627,7 +642,9 @@ module SiSU_ODF %{#@br} else '' end - breakpage=if @md.pagenew or @md.pagebreak; ' fo:break-before="page"' + breakpage=if @md.pagenew \ + or @md.pagebreak + ' fo:break-before="page"' else '' end @@odf[:head]<<%{#@br} + diff --git a/lib/sisu/v0/options.rb b/lib/sisu/v0/options.rb index a4cdc5e4..39de0530 100644 --- a/lib/sisu/v0/options.rb +++ b/lib/sisu/v0/options.rb @@ -97,7 +97,8 @@ module SiSU_commandline s.strip! # String.strip is broken in ruby 1.9.0 (2007-09-10 patchlevel 0) [i486-linux], 2007-09-18:38/2 a=s.split(/\s+/) a.each do |x| - if x =~/^-[a-z0-5]+/i or x =~/^--\S+/ + if x =~/^-[a-z0-5]+/i \ + or x =~/^--\S+/ if x =~/^-([a-z0-5]+)/i; c << $1 end if x =~/^--\S+/; m << x @@ -141,7 +142,9 @@ module SiSU_commandline end @files << f @files.flatten! - if @files.length > 0 and @cmd.empty? and @mod.length == 0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default + if @files.length > 0 \ + and @cmd.empty? \ + and @mod.length == 0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default @cmd=shortcut.cf_0 end tell=SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n") diff --git a/lib/sisu/v0/param_identify_markup.rb b/lib/sisu/v0/param_identify_markup.rb index fcdf71cb..a5e74aa4 100644 --- a/lib/sisu/v0/param_identify_markup.rb +++ b/lib/sisu/v0/param_identify_markup.rb @@ -66,19 +66,23 @@ module SiSU_Markup_type def identify @version_determined,@version_declared,@declared_doc_type=@@version_determined,@@version_declared,@@declared_doc_type if @opt.fns != @@fns - if @cont[0] =~ /^(?:%\s+)?SiSU\s+(text|master|insert)\s+([0-9](?:\.[0-9]+){1,2})/ or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ + if @cont[0] =~ /^(?:%\s+)?SiSU\s+(text|master|insert)\s+([0-9](?:\.[0-9]+){1,2})/ \ + or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ @declared_doc_type,@version_declared=$1,$2 - elsif @cont[0] =~ /^(?:%\s+)?SiSU\s+([0-9](?:\.[0-9]+){1,2})/ or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ + elsif @cont[0] =~ /^(?:%\s+)?SiSU\s+([0-9](?:\.[0-9]+){1,2})/ \ + or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ @version_declared=$1 end @flag_57,@flag_38=false,false @cont.each_with_index do |y,i| - if @flag_57 or y =~/^:?A~\?? @title/ + if @flag_57 \ + or y =~/^:?A~\?? @title/ @version_determined=0.57 @flag_57=true break end - if @flag_38 or y =~/^:?A~/ + if @flag_38 \ + or y =~/^:?A~/ @version_determined=0.38 @flag_38=true break if i >= 200 @@ -87,7 +91,8 @@ module SiSU_Markup_type break end end - if y =~/^0~/ and not @flag_38 + if y =~/^0~/ \ + and not @flag_38 @version_determined=0.16 break end diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 86a17089..18486803 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -71,11 +71,17 @@ module SiSU_Plaintext def initialize(opt) @opt=opt @@dostype=if @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/ - if @opt.mod.inspect =~ /--footnote/ and @opt.mod.inspect =~ /--dos/; 'msdos footnotes' - elsif @opt.mod.inspect =~ /--endnote/ and @opt.mod.inspect =~ /--dos/; 'msdos endnotes' - elsif @opt.mod.inspect =~ /--footnote/; 'unix footnotes' - elsif @opt.mod.inspect =~ /--endnote/; 'unix endnotes' - else 'unix footnotes' + if @opt.mod.inspect =~ /--footnote/ \ + and @opt.mod.inspect =~ /--dos/ + 'msdos footnotes' + elsif @opt.mod.inspect =~ /--endnote/ \ + and @opt.mod.inspect =~ /--dos/ + 'msdos endnotes' + elsif @opt.mod.inspect =~ /--footnote/ + 'unix footnotes' + elsif @opt.mod.inspect =~ /--endnote/ + 'unix endnotes' + else 'unix footnotes' end else puts "#{sf} not a processed file type" end @@ -162,10 +168,12 @@ module SiSU_Plaintext @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>$/m # 2004w18 pb pn removal added @tab="\t" - @br=if md.mod.inspect =~ /--footnote/ and md.mod.inspect =~ /--dos/ + @br=if md.mod.inspect =~ /--footnote/ \ + and md.mod.inspect =~ /--dos/ @@dostype='msdos footnotes' "\r\n" - elsif md.mod.inspect =~ /--endnote/ and md.mod.inspect =~ /--dos/ + elsif md.mod.inspect =~ /--endnote/ \ + and md.mod.inspect =~ /--dos/ @@dostype='msdos endnotes' "\r\n" elsif md.mod.inspect =~ /--footnote/ @@ -291,10 +299,12 @@ WOK else @plaintext[:body] << wrapped << @br # main text, contents, body KEEP end - if @@endnotes[:para] and @@dostype =~/footnote/ #edit out to switch off endnotes following paragraph to which they belong + if @@endnotes[:para] \ + and @@dostype =~/footnote/ #edit out to switch off endnotes following paragraph to which they belong @plaintext[:body] << @br @@endnotes[:para].each {|e| @plaintext[:body] << e << @br} - elsif @@endnotes[:para] and @@dostype =~/endnote/ + elsif @@endnotes[:para] \ + and @@dostype =~/endnote/ @plaintext[:body] << @br*2 end @@endnotes[:para]=[] @@ -365,7 +375,8 @@ WOK @sto=Split_text_object.new(para).lev_segname_para_ocn ### problem in scroll, it appears tables are getting paragraph numbers m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if para =~m and para=~/\S+/ + if para =~m \ + and para=~/\S+/ para=case @sto.format when /^(1)~(?:(\S+))?/ plaintext_structure(para,$1,@sto.ocn,$2) @@ -410,11 +421,14 @@ WOK end elsif para =~/#{table_message}/ @plaintext[:body] << para << @br - elsif para =~/(Note|Endnotes?)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - elsif para =~/(MetaData)/ and para =~/<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info ####suspect visit + elsif para =~/(Note|Endnotes?)/ \ + and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(MetaData)/ \ + and para =~/<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info ####suspect visit #formatMono=MonoSiSU.new('
MetaData') #para=formatMono.bold_para - elsif para.include? 'Owner Details' and para !~/<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para.include? 'Owner Details' \ + and para !~/<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ #formatMono=MonoSiSU.new('
Owner Details') #@plaintext[:owner_details]=formatMono.bold_para #para='' @@ -424,7 +438,8 @@ WOK format_text=Format_text_object.new(one,two) para=format_text.seg_no_paranum end - para='' if (para =~// and para =~/^(-\{{2}~\d+|)/) # -endnote + para='' if (para =~// \ + and para =~/^(-\{{2}~\d+|)/) # -endnote case para when /<:i[1-9]>/ if para =~/.*<:#>.*$/m @@ -473,7 +488,8 @@ WOK filename_plaintext=SiSU_Env::SiSU_file.new(@md,@md.fn[:plain]).mkfile @sisu=[] @content.each do |para| # this is a hack - if para.class == Array and para.length > 0 + if para.class == Array \ + and para.length > 0 para.each do |line| line.gsub!(/\s+$/m,'') filename_plaintext.puts line #unix plaintext diff --git a/lib/sisu/v0/rexml.rb b/lib/sisu/v0/rexml.rb index e710c7ed..d3346a91 100644 --- a/lib/sisu/v0/rexml.rb +++ b/lib/sisu/v0/rexml.rb @@ -83,7 +83,8 @@ module SiSU_Rexml def xml begin if FileTest.file?(@fnap) - if @prog.rexml !=false and FileTest.directory?('/usr/lib/ruby/1.8/rexml/') #note values can be other than true + if @prog.rexml !=false \ + and FileTest.directory?('/usr/lib/ruby/1.8/rexml/') #note values can be other than true xmlfile=IO.readlines(@fnap,'').join begin @xmldoc=REXML::Document.new xmlfile diff --git a/lib/sisu/v0/screen_text_color.rb b/lib/sisu/v0/screen_text_color.rb index a3f1cc7f..5d79c2b1 100644 --- a/lib/sisu/v0/screen_text_color.rb +++ b/lib/sisu/v0/screen_text_color.rb @@ -69,12 +69,12 @@ module SiSU_Screen flag=SiSU_Env::Info_processing_flag.new if @cmd if flag.color #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off - if @cmd =~/c/; @use_color=false - else @use_color=true + @use_color=if @cmd =~/c/; false + else true end else - if @cmd =~/c/; @use_color=true - else @use_color=false + @use_color=if @cmd =~/c/; true + else false end end if @cmd =~/k/; @use_color=false diff --git a/lib/sisu/v0/share_src_kdissert.rb b/lib/sisu/v0/share_src_kdissert.rb index e2e00d8c..fc56ac46 100644 --- a/lib/sisu/v0/share_src_kdissert.rb +++ b/lib/sisu/v0/share_src_kdissert.rb @@ -74,7 +74,8 @@ module SiSU_Kdi_source File.mkpath(@env.path.output) unless FileTest.directory?(@env.path.output) File.mkpath(@output_path) unless FileTest.directory?(@output_path) if FileTest.directory?(@output_path) - if @opt.fns =~/\.kdi\._sst$/ and FileTest.file?(@opt.fnb) + if @opt.fns =~/\.kdi\._sst$/ \ + and FileTest.file?(@opt.fnb) cp(@opt.fnb,@output_path) end else diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index 730bf00d..6f62c69b 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -72,7 +72,8 @@ module SiSU_Format_Shared @@fns=@md.fns '' end - @hname=if col[:seg] and not col[:seg].to_s.empty? + @hname=if col[:seg] \ + and not col[:seg].to_s.empty? @@hname=col[:seg].to_s else @@hname end @@ -104,7 +105,8 @@ module SiSU_Format_Shared #image_path=if @md.fns =~/\.-ss[tm]$/; @env.url.images_external #else @env.url.images_local #end - ins=if u and u.strip !~/^image$/ + ins=if u \ + and u.strip !~/^image$/ %{[#{png}]#{caption}} else %{[#{png}] #{caption}} end diff --git a/lib/sisu/v0/shared_txt.rb b/lib/sisu/v0/shared_txt.rb index 6af436b0..e5acf36d 100644 --- a/lib/sisu/v0/shared_txt.rb +++ b/lib/sisu/v0/shared_txt.rb @@ -81,15 +81,18 @@ module SiSU_text_utils word="\n" @n_char_max_extend = @n_char_max + out[line].length line=line - elsif (out[line].length + word.length) > (@n_char_max_extend - @n_indent) and out[line] =~/\S+/ + elsif (out[line].length + word.length) > (@n_char_max_extend - @n_indent) \ + and out[line] =~/\S+/ @n_char_max_extend = @n_char_max out[line].squeeze!(' ') line += 1 end if word - out[line]=if out[line] and out[line] !~/\S+$/m + out[line]=if out[line] \ + and out[line] !~/\S+$/m "#{out[line]}#{word}" - elsif out[line] and out[line] =~/\S+/ + elsif out[line] \ + and out[line] =~/\S+/ "#{out[line]} #{word}" else "#{word.strip}" end @@ -114,7 +117,8 @@ module SiSU_text_utils @md,@p=md,para end def extract(tag,tag_content,type,attrib) - dc=if dc_tag and dc_content + dc=if dc_tag \ + and dc_content [dc_tag,dc_content,{dc_tag=>dc_content}] else nil end diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 7f9cdc83..11dead2d 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -483,11 +483,13 @@ module SiSU_XML_tags #Format content=meta_content_clean(@md.dc_source) @dc_source=%{ \n} end - if @md.dc_language and @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=%{ \n} end - if @md.language_original and @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=%{ \n} end diff --git a/lib/sisu/v0/sitemaps.rb b/lib/sisu/v0/sitemaps.rb index 740dbf76..5e16e772 100644 --- a/lib/sisu/v0/sitemaps.rb +++ b/lib/sisu/v0/sitemaps.rb @@ -150,7 +150,8 @@ WOK idx=sitemap_idx.join end def sitemap - map=if @md.dc_date_modified and @md.dc_date_modified=~/\d{4}-\d{2}-\d{2}/ + map=if @md.dc_date_modified \ + and @md.dc_date_modified=~/\d{4}-\d{2}-\d{2}/ sitemap_date_modified else sitemap_no_date end diff --git a/lib/sisu/v0/sst_convert_markup.rb b/lib/sisu/v0/sst_convert_markup.rb index 9eeb22b9..e1e691f7 100644 --- a/lib/sisu/v0/sst_convert_markup.rb +++ b/lib/sisu/v0/sst_convert_markup.rb @@ -79,7 +79,8 @@ module SiSU_Modify end def message(text) response='' - unless @opt.cmd=~/QQ/ or @opt.cmd=~/q/ + unless @opt.cmd=~/QQ/ \ + or @opt.cmd=~/q/ response=@ask.response?(%{#{ text}\nProceed? }) end end @@ -196,7 +197,8 @@ WOK end def conversion #%% do it --------------------------> - if @opt.files and @opt.files.length > 0 + if @opt.files \ + and @opt.files.length > 0 mr=nil #%% changes to make m match, r replace --------------------------> if @opt.mod.inspect =~/--help/; help @@ -234,15 +236,16 @@ WOK @new,@matched,@flag_start,@flag_end,@empty1,@empty2=true,false,false,false,false,false o="#{i}.bk" #o is for old markup_version=SiSU_Markup::Markup_identify.new(@opt).markup_version? - if (@opt.mod.inspect=~/37/ and markup_version=~/0.38/) or - (@opt.mod.inspect=~/current|38/ and markup_version=~/0.37/) + if (@opt.mod.inspect=~/37/ and markup_version=~/0.38/) \ + or (@opt.mod.inspect=~/current|38/ and markup_version=~/0.37/) puts "#{i} #{markup_version}" file=File.open(i,'r') cont=file.readlines file.close cont.each do |y| match_and_replace.each do |m,r,w| - if y =~m and y =~w + if y =~m \ + and y =~w if @new @new=false File.unlink(o) if File.exist?(o) @@ -262,9 +265,11 @@ WOK if y =~end_processing @flag_end=true end - if @flag_start and not @flag_end + if @flag_start \ + and not @flag_end match_and_replace.each do |m,r,w| - if y =~m and y =~w + if y =~m \ + and y =~w puts m.inspect + ' -> ' + r unless @opt.cmd=~/q/ puts "in: #{y}" if @opt.cmd=~/[vVM]/ y.gsub!(m,r) if m and r diff --git a/lib/sisu/v0/sst_do_inline_footnotes.rb b/lib/sisu/v0/sst_do_inline_footnotes.rb index 0bbaa131..fba5b177 100644 --- a/lib/sisu/v0/sst_do_inline_footnotes.rb +++ b/lib/sisu/v0/sst_do_inline_footnotes.rb @@ -125,7 +125,8 @@ module SiSU_Convert_footnotes 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 - if @md.en[:mismatch] == 0 or @md.mod.inspect =~/=footnotes-force/ + if @md.en[:mismatch] == 0 \ + or @md.mod.inspect =~/=footnotes-force/ meta=nil dal=SiSU_Convert_footnotes::Make.new(@md,file_array).song SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.fns}.fn").output if @md.cmd =~/v/ @@ -208,7 +209,8 @@ module SiSU_Convert_footnotes data=@data tuned_file,vocab_insert=[],[] data.each do |para| - if para =~/^1~/ and @@flag_vocab == 0 + if para =~/^1~/ \ + and @@flag_vocab == 0 vocab_insert << '@vocabulary: lex' << "\n\n" << para tuned_file << vocab_insert unless para.nil? @@flag_vocab=1 @@ -273,7 +275,8 @@ module SiSU_Convert_footnotes para.gsub!(/^8~/,'5~') para.gsub!(/^9~/,'6~') end - if para =~/<:insert\d+!?>/ and para !~/^%\s+/ + if para =~/<:insert\d+!?>/ \ + and para !~/^%\s+/ @skin.select #require "#{@md.doc_skin}" #FIX now ins=SiSU_Viz::Inserts.new @@ -328,7 +331,8 @@ module SiSU_Convert_footnotes @tuned_file << para end # debug 2003w46 adding revision control info - if @md.flag_auto_endnotes and @md.flag_separate_endnotes_make + if @md.flag_auto_endnotes \ + and @md.flag_separate_endnotes_make @tuned_file << "\n1~endnotes Endnotes <~0;0:0;u0>" #prob numbering, revisit end @tuned_file << "\n" @@ -345,7 +349,8 @@ module SiSU_Convert_footnotes para.gsub!(/^#{num}~([a-z_\.]+)\s+(.+)/i,%{#{num}~\\1 #{title_no} \\2 <:name##{title_no}>}) else para.gsub!(/^#{num}~ /,"#{num}~#{title_no} #{title_no} ") #main end - if @md.toc_lev_limit and @md.toc_lev_limit < num + if @md.toc_lev_limit \ + and @md.toc_lev_limit < num para.gsub!(/^[2-6]~(?:~\S+)?\s*/,'!_ ') end para @@ -357,7 +362,8 @@ module SiSU_Convert_footnotes @tuned_file=[] data.each do |para| unless @md.set_heading_top - if para !~/^(?:@\S+:|0~\S+)\s/m and para !~/\A\s*\Z/m + if para !~/^(?:@\S+:|0~\S+)\s/m \ + and para !~/\A\s*\Z/m @md.set_heading_top=true head=if @md.title ; ":A~ #{@md.title}" else ':A~ [no title provided]' @@ -377,7 +383,9 @@ module SiSU_Convert_footnotes @tuned_file=[] data.each do |para| unless @md.set_heading_seg - if para !~/^(?:@\S+:|0~\S+|:[ABC]~)/m and para !~/\A\s*\Z/m and para !~/<:p[bn]>/ + if para !~/^(?:@\S+:|0~\S+|:[ABC]~)/m \ + and para !~/\A\s*\Z/m \ + and para !~/<:p[bn]>/ @md.set_heading_seg=true head=if @md.title ; "1~seg [#{@md.title}]" else '1~seg [segment]' @@ -397,7 +405,8 @@ module SiSU_Convert_footnotes @tuned_file=[] data.each do |para| unless @md.set_header_title - if para !~/^%{1,2}\s/m and para !~/\A\s*\Z/m + if para !~/^%{1,2}\s/m \ + and para !~/\A\s*\Z/m @tuned_file << "0~title #{@md.heading_seg_first}" @md.title=@md.heading_seg_first @md.set_header_title=true diff --git a/lib/sisu/v0/sst_identify_markup.rb b/lib/sisu/v0/sst_identify_markup.rb index 19601c13..7fac34d5 100644 --- a/lib/sisu/v0/sst_identify_markup.rb +++ b/lib/sisu/v0/sst_identify_markup.rb @@ -93,34 +93,40 @@ WOK end def identify f=@opt.fns - if f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])$/ and File.exist?(f) + if f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])$/ \ + and File.exist?(f) file=File.open(f,'r') cont=file.readlines file.close links,oldlinks='','' markup=nil @declared_type,@declared_markup='[text?]','' - if cont[0] =~ /^(?:%\s+)?SiSU\s+(text|master|insert)\s+([0-9](?:\.[0-9]+){1,2})/ or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ + if cont[0] =~ /^(?:%\s+)?SiSU\s+(text|master|insert)\s+([0-9](?:\.[0-9]+){1,2})/ \ + or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ @declared_type,@declared_markup=$1,$2 #puts "SiSU #@declared_markup (declared markup version)" #else puts 'markup version not declared' - elsif cont[0] =~ /^(?:%\s+)?SiSU\s+([0-9](?:\.[0-9]+){1,2})/ or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ + elsif cont[0] =~ /^(?:%\s+)?SiSU\s+([0-9](?:\.[0-9]+){1,2})/ \ + or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ @declared_markup=$1 end @flag_57,@flag_38=false,false cont.each_with_index do |y,i| - if y =~/^(?:0\{?~links?|@links?:)\s/ and f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])/ + if y =~/^(?:0\{?~links?|@links?:)\s/ \ + and f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])/ links=unless y =~/\{.+?\}\S+/; oldlinks=' (pre 0.20.4 header links)' else ' (post 0.20.4 header links)' end end - if @flag_57 or y =~/^:?A~\?? @title/ + if @flag_57 \ + or y =~/^:?A~\?? @title/ version='0.57' markup=Markup_inform.new(version,'0.57' + oldlinks,@declared_markup,@declared_type) @flag_57=true break end - if @flag_38 or (y =~/^:?A~/ and f =~/(?:\.sst|\.ssm|\.ssi)/) + if @flag_38 \ + or (y =~/^:?A~/ and f =~/(?:\.sst|\.ssm|\.ssi)/) version='0.38' markup=Markup_inform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type) @flag_38=true @@ -131,12 +137,15 @@ WOK break end end - if (y =~/^1~/ and f =~/(?:\.sst|\.ssm|\.ssi)/) and not @flag_38 + if (y =~/^1~/ and f =~/(?:\.sst|\.ssm|\.ssi)/) \ + and not @flag_38 version='0.37' markup=Markup_inform.new(version,'0.37 is substantially 0.16 - 0.36 markup with new file-extension' + oldlinks,@declared_markup,@declared_type) break end - if y =~/^1~/ and f =~/\.([rs])([123])/ and not @flag_38 + if y =~/^1~/ \ + and f =~/\.([rs])([123])/ \ + and not @flag_38 t,n=$1,$2 version='0.16' instruct=if t =~/r/ @@ -146,12 +155,14 @@ WOK markup=Markup_inform.new(version,'0.16 - 0.36' + instruct + links,@declared_markup,@declared_type) break end - if y =~/^0\{~/ and not @flag_38 + if y =~/^0\{~/ \ + and not @flag_38 version='0.1' markup=Markup_inform.new(version,'0.1 - 0.15',@declared_markup,@declared_type) break end - if y =~/^0\{{3}/ and not @flag_38 + if y =~/^0\{{3}/ \ + and not @flag_38 markup=Markup_inform.new('circa. 1997','old, check date',@declared_markup,@declared_type) break end @@ -162,7 +173,9 @@ WOK end end def determine_markup_version - if @opt.fns.nil? or @opt.fns.empty?; Markup_history.new(@opt).help_identify + if @opt.fns.nil? \ + or @opt.fns.empty? + Markup_history.new(@opt).help_identify end if File.exist?(@opt.fns) if @opt.fns =~/\.(?:sst|ssm|ssi|s[123i]|r[123])/ diff --git a/lib/sisu/v0/sst_to_s_xml_dom.rb b/lib/sisu/v0/sst_to_s_xml_dom.rb index 8e3fce27..748b6bfc 100644 --- a/lib/sisu/v0/sst_to_s_xml_dom.rb +++ b/lib/sisu/v0/sst_to_s_xml_dom.rb @@ -236,7 +236,11 @@ WOK xml_element="" 3.downto(lv) do |x| y=x - 1 - @@xml[:body] << "#{@tab*5}\n" if @cont[1] or @cont[2] or @cont[3] + if @cont[1] \ + or @cont[2] \ + or @cont[3] + @@xml[:body] << "#{@tab*5}\n" + end @cont[1]=false if @cont[1] @cont[2]=false if @cont[2] @cont[3]=false if @cont[3] @@ -277,7 +281,10 @@ WOK end @cont[1]=true when 5 - @@xml[:body] << "#{@tab*5}\n" if @cont[2] or @cont[1] + if @cont[2] \ + or @cont[1] + @@xml[:body] << "#{@tab*5}\n" + end if @copen[3] == true #6{ [3,2].each { |v| @@xml[:body] << "#{@tab*n}\n" } elsif @copen[2] == true #5{ @@ -285,7 +292,11 @@ WOK end @cont[2]=true when 6 - @@xml[:body] << "#{@tab*5}\n" if @cont[3] or @cont[2] or @cont[1] + if @cont[3] \ + or @cont[2] \ + or @cont[1] + @@xml[:body] << "#{@tab*5}\n" + end [3].each { |v| @@xml[:body] << "#{@tab*n}\n" } if @copen[3] @cont[3]=true end @@ -356,7 +367,10 @@ WOK if d_meta; xml_head(d_meta) end end - @rcdc=true if @rcdc==false and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) + if @rcdc==false \ + and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) + @rcdc=true + end if para !~/(^0~|^@\S+?:||)/ @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para unless @rcdc @@ -421,16 +435,21 @@ WOK @@xml[:body] << table_structure(para) else #xml_structure xml_markup(para) - @@xml[:body] << %{#{@tab*6}} << "\n" if para[@regx] and para[@regx,2] + if para[@regx] \ + and para[@regx,2] + @@xml[:body] << %{#{@tab*6}} << "\n" + end @@xml[:body] << "#{@tab*7}#{para[@regx,2]}\n" if para[@regx,2] # main text, contents, body KEEP @@xml[:body] << "#{@tab*6}" << "\n" if para[@regx] end end elsif para =~/(Note|Endnotes?)/ - elsif para =~/(MetaData)/ and para =~/<~\d+;[m]\d+;\w\d+><#{@@dp}:#{@@dp}>$/ #debug 2003w46 add rc info + elsif para =~/(MetaData)/ \ + and para =~/<~\d+;[m]\d+;\w\d+><#{@@dp}:#{@@dp}>$/ #debug 2003w46 add rc info format_scroll=Format_scroll.new(@md,'
MetaData') para=format_scroll.bold_para - elsif para =~/(Owner Details)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#{@@dp}:#{@@dp}>$/ + elsif para =~/(Owner Details)/ \ + and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#{@@dp}:#{@@dp}>$/ format_scroll=Format_scroll.new(@md,'
Owner Details') @@xml[:owner_details]=format_scroll.bold_para para='' @@ -439,7 +458,10 @@ WOK format_text=Format_text_object.new(one,two) para=format_text.seg_no_paranum end - para='' if para =~// and para =~/^(-\{{2}~\d+|)/ # -endnote + if para =~// \ + and para =~/^(-\{{2}~\d+|)/ # -endnote + para='' + end if para =~/.*<:#>.*$/ para=case para when /<:i1>/ diff --git a/lib/sisu/v0/sst_to_s_xml_node.rb b/lib/sisu/v0/sst_to_s_xml_node.rb index cbaf7672..38c025c0 100644 --- a/lib/sisu/v0/sst_to_s_xml_node.rb +++ b/lib/sisu/v0/sst_to_s_xml_node.rb @@ -228,9 +228,11 @@ WOK end if lv.to_s =~/^[1-6]/; @@current=lv end - if o.node == 1 or lv == 1 + if o.node == 1 \ + or lv == 1 @@parent[:node][o.node]=0 - elsif @@current == lv and @@current !=nil + elsif @@current == lv \ + and @@current !=nil if @node[:no][lv-1] != nil @@parent[:node][o.node]=@node[:no][lv-1] elsif @node[:no][lv-2] != nil @@ -240,12 +242,14 @@ WOK else puts 'error' end elsif lv == nil - if o.ocn.class == Fixnum and @@current + if o.ocn.class == Fixnum \ + and @@current @@parent[:node][o.node]=@node[:no][@@current] end else puts 'error' end - if @@current == lv and @@current !=nil + if @@current == lv \ + and @@current !=nil if @node[:ocn][lv-1] != nil @@parent[:ocn][o.ocn]=@node[:ocn][lv-1] elsif @node[:ocn][lv-2] != nil @@ -255,7 +259,8 @@ WOK else puts 'error' end elsif lv == nil - if o.ocn.class == Fixnum and @@current + if o.ocn.class == Fixnum \ + and @@current @@parent[:ocn][o.ocn]=@node[:ocn][@@current] end else puts 'error' @@ -418,8 +423,11 @@ WOK obj.each do |o| para=o.txt unless o.txt =~/^%% / #comments are lost, consider if para - @rcdc=true if @rcdc==false and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) + if @rcdc==false \ + and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) if para !~/(^0~|^@\S+?:|^\s*$||)/ + @rcdc=true + end @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para unless @rcdc format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ @@ -457,7 +465,11 @@ WOK obj.each do |o| para=o.txt unless o.txt =~/^%% / #comments are lost, consider if para - @rcdc=true if @rcdc==false and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) + if @rcdc==false \ + and (para =~/~metadata/ \ + or para =~/^1~meta\s+Document Information/) + @rcdc=true + end if para !~/(^0~|^@\S+?:|^\s*$||)/ @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para unless @rcdc @@ -497,7 +509,10 @@ WOK else xml_structure(o,para,nil,nil) end end - para='' if para =~// and para =~/^(-\{{2}~\d+|)/ # -endnote + if para =~// \ + and para =~/^(-\{{2}~\d+|)/ # -endnote + para='' + end if para =~/.*<:#>.*$/ para=case para when /<:i1>/ diff --git a/lib/sisu/v0/sst_to_s_xml_sax.rb b/lib/sisu/v0/sst_to_s_xml_sax.rb index 9ea7d58c..38663f4f 100644 --- a/lib/sisu/v0/sst_to_s_xml_sax.rb +++ b/lib/sisu/v0/sst_to_s_xml_sax.rb @@ -265,7 +265,10 @@ WOK if d_meta; xml_head(d_meta) end end - @rcdc=true if @rcdc==false and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) + if @rcdc==false \ + and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) + @rcdc=true + end if para !~/(^0~|^@\S+?:|^\s*$||)/ @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para unless @rcdc @@ -324,7 +327,10 @@ WOK else xml_structure(para,nil,nil) end end - para='' if para =~// and para =~/^(-\{{2}~\d+|)/ # -endnote + if para =~// \ + and para =~/^(-\{{2}~\d+|)/ # -endnote + para='' + end if para =~/.*<:#>.*$/ para=case para when /<:i1>/ diff --git a/lib/sisu/v0/texinfo.rb b/lib/sisu/v0/texinfo.rb index a6d94c1a..c8fff3e1 100644 --- a/lib/sisu/v0/texinfo.rb +++ b/lib/sisu/v0/texinfo.rb @@ -194,20 +194,24 @@ module SiSU_TexInfo @@flag['poem']=1 end if @@flag['code'] - if @@flag['code'] and para =~ /<:code[-_](?:end|close)>/ #watch change not tested 200501 + if @@flag['code'] \ + and para =~ /<:code[-_](?:end|close)>/ #watch change not tested 200501 @@flag['code']=false end - if @@flag['code'] and para =~ /\S/ + if @@flag['code'] \ + and para =~ /\S/ sub_array=para.dup @@line_mode=sub_array.scan(/.+/) Tune.code_lines(@@line_mode) para=@@line_mode.join end elsif @@flag['poem']==1 - if @@flag['poem']==1 and para =~ /<:verse[-_](?:end|close)>/ #watch change not tested 200501 + if @@flag['poem']==1 \ + and para =~ /<:verse[-_](?:end|close)>/ #watch change not tested 200501 @@flag['poem']=0 end - if @@flag['poem']==1 and para =~ /\S/ + if @@flag['poem']==1 \ + and para =~ /\S/ sub_array=para.dup @@line_mode=sub_array.scan(/.+/) Tune.code_lines(@@line_mode) @@ -220,7 +224,8 @@ module SiSU_TexInfo def code_lines data=@data data.each do |line| - if line =~ /\S/ and line !~ /<:(code|verse).+/ + if line =~ /\S/ \ + and line !~ /<:(code|verse).+/ if @@flag['code'] line.gsub!(/^\s*(.+)/m, "\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\") @@counting+=1 if @@flag['code'] @@ -347,7 +352,8 @@ module SiSU_TexInfo data=Texinfo_make.new(data,@md).number_titles #TOGGLE to SWITCH PARAGRAPH NUMBERING (ON & OFF) data=Texinfo_make.new(data,@md).number_paras \ - if @md.fns !~ /\.e[pdr]00/ and @md.markup !~ /not_to/i + if @md.fns !~ /\.e[pdr]00/ \ + and @md.markup !~ /not_to/i end def number_titles data=@data @@ -358,8 +364,10 @@ module SiSU_TexInfo t_no1=0; t_no2=0; t_no3=0; t_no4=0; no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3); data.each do |para| - if @md.markup =~ /num_top/i and para !~ /0\\+/ - if para =~ /^[1-6]\\+(?:~\S+)?\s*/ and para !~ /<:\d-endnotes>/ + if @md.markup =~ /num_top/i \ + and para !~ /0\\+/ + if para =~ /^[1-6]\\+(?:~\S+)?\s*/ \ + and para !~ /<:\d-endnotes>/ header=para[//m, 1].gsub!(/-/m,'.') para.gsub!(/^(?:[1-6]\\+(?:~\S+)|<:([12356]|4-.+?-)>)\s*/, "\\1 #{header} ") @@ -378,7 +386,8 @@ module SiSU_TexInfo @tex_file=[] paranumber=0 data.each do |para| - if para =~/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/ and para !~ // + if para =~/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/ \ + and para !~ // parablock,paranum=/(.+?)<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/im.match(para)[1,2] do_duo=TexInfoFormat::DuoTex.new(parablock,paranum) ###is BUG para=do_duo.paraNum if parablock diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index d6420684..c080c554 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -206,7 +206,8 @@ module SiSU_TeX @dir_sisu=@dirout.path.output texfile=@md.fns.gsub(/$/,'.tex') texfile=texfile.gsub(/~/,'-') - if File.exist?(texfile) and File.size(texfile) > 0 + if File.exist?(texfile) \ + and File.size(texfile) > 0 @tex_f_no+=1 latex_do(texfile) else @@ -241,7 +242,9 @@ module SiSU_TeX @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern vz=SiSU_Env::Get_init.instance.skin - @skin_no_ocn=if defined? vz.ocn_display_off and vz.ocn_display_off == true; true + @skin_no_ocn=if defined? vz.ocn_display_off \ + and vz.ocn_display_off == true + true else false end end @@ -272,7 +275,9 @@ module SiSU_TeX if @md.flag_tables data=tables(data) end - ocn=if @md.markup.inspect =~/no_ocn/ or @md.mod.inspect =~/--no-ocn/ or @skin_no_ocn + ocn=if @md.markup.inspect =~/no_ocn/ \ + or @md.mod.inspect =~/--no-ocn/ \ + or @skin_no_ocn false else true end @@ -429,7 +434,8 @@ WOK @group_collect=[] data.each do |para| #% case follows with levels 1-6 indents & graphics mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para) - if para =~/<:(code|alt|verse|group)>/ or @@flag_alt + if para =~/<:(code|alt|verse|group)>/ \ + or @@flag_alt if para =~/<:(code|alt|verse|group)>/ @lineone=case para when /<:(alt|verse|group)>/; para @@ -521,7 +527,8 @@ WOK @tex_file << if @md.doc_skin !~/skin_mail/; @tex.doc_tail else @tex.mail_tail end - if defined? @md.lnk and @md.lnk + if defined? @md.lnk \ + and @md.lnk @md.lnk.each do |l| if l[:say] url=%<#{l[:url]}> @@ -565,7 +572,8 @@ WOK def number_paras(data,ocn) @tex_file=[] data.each do |para| - if para =~/<\\~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ and para !~/\\end\{longtable\}|/ #catch + if para =~/<\\~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ \ + and para !~/\\end\{longtable\}|/ #catch m=/(.+?)<\\~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m parablock=para[m,1] paranum=if ocn; para[m,2] diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 7849727b..3887600d 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -271,7 +271,8 @@ WOK @@dp=nil def initialize(md,string,string1=nil) @md,@string,@string1=md,string,string1 - if defined? @md.image and @md.image =~/center/ + if defined? @md.image \ + and @md.image =~/center/ @center_begin,@center_end='\begin{center}','\end{center}' else @center_begin,@center_end='','' end @@ -733,9 +734,11 @@ WOK image,m=/<:image\s+(\S+)\s+.+?width=``(\d+)''.+?>/m.match(@string).captures width=m[1] || '100' width=width.to_i*0.4 - image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") + image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \ + and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") dir.path.image_source_local_tex - elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") + elsif @md.fns =~/\.-ss[tm]$/ \ + and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") dir.path.image_source_remote_tex elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}") dir.path.image_source_tex @@ -770,14 +773,17 @@ WOK hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace caption="{\\\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" if c #caption="{\\\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c[1]}\\end{scriptsize}&}" if c - image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") + image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \ + and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") dir.path.image_source_local_tex - elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") + elsif @md.fns =~/\.-ss[tm]$/ \ + and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") dir.path.image_source_remote_tex elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}") dir.path.image_source_tex else - unless image.nil? or image.length < 2 + unless image.nil? \ + or image.length < 2 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/ end @@ -805,7 +811,8 @@ WOK end z,url=r.match(word).captures if word =~r url=url.strip - if word =~/\{\s*\S+\.?(?:png|jpg|gif)/ and word=~/\s+\d+x\d+\s+/ + if word =~/\{\s*\S+\.?(?:png|jpg|gif)/ \ + and word=~/\s+\d+x\d+\s+/ image,x,y=z.scan(/\S+/) image.gsub!(/\\/,'') width=200 @@ -818,7 +825,8 @@ WOK when /a5/; @tx.a5 else @tx.a4 end - width=if orientation =~/portrait/ #value is not currently passed + width=if \ + orientation =~/portrait/ #value is not currently passed width=if width.to_i > dm.portrait.img_px; dm.portrait.img_px else width end @@ -835,14 +843,16 @@ WOK tell.print_grey #unless @opt.cmd =~/q/ end ins=if image #most images fc etc. #% clean up ! - out=if @md.fns =~/\.(?:ssm\.)?sst$/ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") + out=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+)/ - elsif @md.fns =~/\.-ss[tm]$/ and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") + 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]" + @@ -1197,7 +1207,8 @@ WOK def a4generic end def para_num - paranumber_display=if @md.markup.inspect =~/no_ocn/ or @md.mod.inspect =~/--no-ocn/; '' + paranumber_display=if @md.markup.inspect =~/no_ocn/ \ + or @md.mod.inspect =~/--no-ocn/; '' else "\\begin{tiny}~\\end{tiny}{\\marginpar{\\begin{tiny}#@string1\\end{tiny}}}" #ocn object citation numbering end if @string !~/^([1-6a-z-]#{@@tilde}\S*|<:.+?>|#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6})/ diff --git a/lib/sisu/v0/urls.rb b/lib/sisu/v0/urls.rb index cfe242b3..b9b1e0ec 100644 --- a/lib/sisu/v0/urls.rb +++ b/lib/sisu/v0/urls.rb @@ -139,20 +139,29 @@ module SiSU_urls end end def urls_maintenance(opt,x,y) - if x=~/^([abchHmNopwxXy])/ and opt.cmd =~/[abchHmNopwxXy]/ and x=~/^[#{opt.cmd}]/ + if x=~/^([abchHmNopwxXy])/ \ + and opt.cmd =~/[abchHmNopwxXy]/ \ + and x=~/^[#{opt.cmd}]/ m=$1 f=y tool=@editor - if x =~/^m/ and @opt.cmd=~/m/ and x=~/^[#{opt.cmd}]/ and @opt.cmd =~/M/ + if x =~/^m/ \ + and @opt.cmd=~/m/ \ + and x=~/^[#{opt.cmd}]/ \ + and @opt.cmd =~/M/ tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@editor #{@env.path.dal}/#{@opt.fns}.meta") tell.maintenance unless @opt.cmd =~/q/ end - if x=~/^([hHw])/ and @opt.cmd=~/[hHw]/ and x=~/^[#{@opt.cmd}]/ + if x=~/^([hHw])/ \ + and @opt.cmd=~/[hHw]/ \ + and x=~/^[#{@opt.cmd}]/ f=if x !~/segmented/; "#{y}.html" else "#{y}.index.html" end end - if x=~/^p/ and @opt.cmd=~/p/ and x=~/^[#{@opt.cmd}]/ + if x=~/^p/ \ + and @opt.cmd=~/p/ \ + and x=~/^[#{@opt.cmd}]/ tool=@pdf_viewer if opt.cmd =~/M/ fns=@opt.fns.gsub(/~/,'-') @@ -163,7 +172,9 @@ module SiSU_urls tell.maintenance unless @opt.cmd =~/q/ end end - if x=~/^o/ and @opt.cmd=~/o/ and x=~/^[#{@opt.cmd}]/ + if x=~/^o/ \ + and @opt.cmd=~/o/ \ + and x=~/^[#{@opt.cmd}]/ tool=@odf_viewer end #if x=~/^i/ and @opt.cmd=~/i/ and x=~/^[#{@opt.cmd}]/ @@ -185,38 +196,46 @@ module SiSU_urls @pwd_stub="#@webserv_url"[m,1] @u.each do |x,y| if @opt.fns =~ @m_regular - if x=~/^([abchHNopwxXyY])/ and @opt.cmd=~/[abchHNopwxXyY]/ and x=~/^[#{@opt.cmd}]/ + if x=~/^([abchHNopwxXyY])/ \ + and @opt.cmd=~/[abchHNopwxXyY]/ \ + and x=~/^[#{@opt.cmd}]/ m=$1 tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@browser #@webserv_url/#@fnb/#{y}") tell.result unless @opt.cmd =~/q/ @opt.cmd.gsub!(/#{m}/,'') end - if x=~/^I/ and @opt.cmd =~/I/ + if x=~/^I/ \ + and @opt.cmd =~/I/ tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","cd #{@path.path.texinfo}; pinfo ./#@fnb.#{y}; cd -") tell.result unless @opt.cmd =~/q/ @opt.cmd.gsub!(/I/,'') end - if x=~/^D/ and @opt.cmd =~/D/ + if x=~/^D/ \ + and @opt.cmd =~/D/ tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI psql","#@pwd_stub::#{@opt.fns}",y) tell.result unless @opt.cmd =~/q/ @opt.cmd.gsub!(/D[iu]/,'') end - if x=~/^d/ and @opt.cmd =~/d/ + if x=~/^d/ \ + and @opt.cmd =~/d/ tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} DBI sqlite","sqlite #{@env.path.output}/sisu_sqlite.db", "#{y}") tell.result unless @opt.cmd =~/q/ @opt.cmd.gsub!(/d[iu]/,'') end - if x=~/^i/ and @opt.cmd =~/i/ + if x=~/^i/ \ + and @opt.cmd =~/i/ tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#@manpage_gen #{@path.path.manpage}/#@fnb.1 |most") tell.result unless @opt.cmd =~/q/ @opt.cmd.gsub!(/I/,'') end - if x=~/^P/ and @opt.cmd =~/P/ + if x=~/^P/ \ + and @opt.cmd =~/P/ tell=SiSU_Screen::Ansi.new(@opt.cmd,"-#{x} Psql","#@pwd_stub::#{@opt.fns}",y) tell.result unless @opt.cmd =~/q/ @opt.cmd.gsub!(/P[iu]/,'') end - if x=~/^[sS]/ and @opt.cmd =~/[sS]/ + if x=~/^[sS]/ \ + and @opt.cmd =~/[sS]/ zipfile=if @opt.fns =~/\.ssm\.sst$/; y.gsub(/(?:\~\S{2,3})?(\.ssm\.sst\.zip)$/,'.ssm.zip') else y.gsub(/(?:\~\S{2,3})?(\.sst\.zip)$/,'\1') end diff --git a/lib/sisu/v0/wikispeak.rb b/lib/sisu/v0/wikispeak.rb index a0ca2cd5..7fe7ac89 100644 --- a/lib/sisu/v0/wikispeak.rb +++ b/lib/sisu/v0/wikispeak.rb @@ -273,7 +273,8 @@ WOK @sto=Split_text_object.new(para).lev_segname_para_ocn ### problem in scroll, it appears tables are getting paragraph numbers m=/<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - if para =~m and para=~/\S+/ + if para =~m \ + and para=~/\S+/ para=case @sto.format when /^(1)~(?:(\S+))?/ wiki_structure(para,$1,@sto.ocn,$2) @@ -318,11 +319,14 @@ WOK end elsif para =~/#{table_message}/ @@wiki[:body] << para << @br - elsif para =~/(Note|Endnotes?)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - elsif para =~/(MetaData)/ and para =~/<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info ####suspect visit + elsif para =~/(Note|Endnotes?)/ \ + and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(MetaData)/ \ + and para =~/<~(\d+);[um]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info ####suspect visit #formatMono=MonoSiSU.new('
MetaData') #para=formatMono.bold_para - elsif para.include? 'Owner Details' and para !~/<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para.include? 'Owner Details' \ + and para !~/<~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ #formatMono=MonoSiSU.new('
Owner Details') #@@wiki[:owner_details]=formatMono.bold_para #para='' @@ -332,7 +336,10 @@ WOK format_text=Format_text_object.new(one,two) para=format_text.seg_no_paranum end - para='' if (para =~// and para =~/^(-\{{2}~\d+|)/) # -endnote + if (para =~// \ + and para =~/^(-\{{2}~\d+|)/) # -endnote + para='' + end case para when /<:i1>/ if para =~/.*<:#>.*$/ diff --git a/lib/sisu/v0/xhtml.rb b/lib/sisu/v0/xhtml.rb index 6b91f34f..903ce869 100644 --- a/lib/sisu/v0/xhtml.rb +++ b/lib/sisu/v0/xhtml.rb @@ -270,7 +270,11 @@ WOK if d_meta; xml_head(d_meta) end end - @rcdc=true if @rcdc==false and (para =~/~metadata/ or para =~/1~meta\s+Document Information/) + if @rcdc==false \ + and (para =~/~metadata/ \ + or para =~/1~meta\s+Document Information/) + @rcdc=true + end if para !~/(^0~||)/ if para =~/.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ paranum=para[@regx,3] @@ -330,11 +334,14 @@ WOK #@@xml[:body] << "#{@tab*7}#{para[@regx,2]}\n" if para[@regx,2] # main text, contents, body KEEP #@@xml[:body] << "#{@tab*6}
" << "\n" if para[@regx] end - elsif para =~/(Note|Endnotes?)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - elsif para =~/(MetaData)/ and para =~/<~(\d+);[m]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info + elsif para =~/(Note|Endnotes?)/ \ + and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(MetaData)/ \ + and para =~/<~(\d+);[m]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info format_scroll=Format_scroll.new(@md,'
MetaData') para=format_scroll.bold_para - elsif para =~/(Owner Details)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(Owner Details)/ \ + and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ format_scroll=Format_scroll.new(@md,'
Owner Details') @@xml[:owner_details]=format_scroll.bold_para para='' @@ -343,7 +350,10 @@ WOK format_text=Format_text_object.new(one,two) para=format_text.seg_no_paranum end - para='' if (para =~// and para =~/^(-\{{2}~\d+|)/) # -endnote + if (para =~// \ + and para =~/^(-\{{2}~\d+|)/) # -endnote + para='' + end para=case para when /<:i[1-9]>/ if para =~/.*<:#>.*$/ diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb index e739bf59..2aa8bb56 100644 --- a/lib/sisu/v0/xml.rb +++ b/lib/sisu/v0/xml.rb @@ -297,7 +297,10 @@ WOK if d_meta; xml_head(d_meta) end end - @rcdc=true if @rcdc==false and (para =~/~metadata/ or para =~/1~meta\s+Document Information/) + if @rcdc==false \ + and (para =~/~metadata/ or para =~/1~meta\s+Document Information/) + @rcdc=true + end if para !~/(^0~||)/ if para =~/.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ paranum=para[@regx,3] @@ -357,11 +360,14 @@ WOK #@@xml[:body] << "#{@tab*7}#{para[@regx,2]}\n" if para[@regx,2] # main text, contents, body KEEP #@@xml[:body] << "#{@tab*6}" << "\n" if para[@regx] end - elsif para =~/(Note|Endnotes?)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ - elsif para =~/(MetaData)/ and para =~/<~(\d+);[m]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info + elsif para =~/(Note|Endnotes?)/ \ + and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(MetaData)/ \ + and para =~/<~(\d+);[m]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info format_scroll=Format_scroll.new(@md,'
MetaData') para=format_scroll.bold_para - elsif para =~/(Owner Details)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(Owner Details)/ \ + and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ format_scroll=Format_scroll.new(@md,'
Owner Details') @@xml[:owner_details]=format_scroll.bold_para para='' @@ -370,7 +376,10 @@ WOK format_text=Format_text_object.new(one,two) para=format_text.seg_no_paranum end - para='' if para =~// and para =~/^(-\{{2}~\d+|)/ # -endnote + if para =~// \ + and para =~/^(-\{{2}~\d+|)/ # -endnote + para='' + end if para =~/.*<:#>.*$/ para=if para =~ /<:i[1-9]>/ format_text=Format_text_object.new(para,'') diff --git a/lib/sisu/v0/xml_dom.rb b/lib/sisu/v0/xml_dom.rb index 14cc162f..f8259664 100644 --- a/lib/sisu/v0/xml_dom.rb +++ b/lib/sisu/v0/xml_dom.rb @@ -225,7 +225,11 @@ WOK xml_element="" 3.downto(lv) do |x| y=x - 1 - @@xml[:body] << "#{@tab*5}\n" if @cont[1] or @cont[2] or @cont[3] + if @cont[1] \ + or @cont[2] \ + or @cont[3] + @@xml[:body] << "#{@tab*5}\n" + end #@@xml[:body] << "#{@tab*5}\n" if @cont[1] == true or @cont[2] == true or @cont[3] == true @cont[1]=false if @cont[1] @cont[2]=false if @cont[2] @@ -267,7 +271,10 @@ WOK end @cont[1]=true when 5 - @@xml[:body] << "#{@tab*5}\n" if @cont[2] or @cont[1] + if @cont[2] \ + or @cont[1] + @@xml[:body] << "#{@tab*5}\n" + end if @copen[3] == true #6~ [3,2].each { |v| @@xml[:body] << "#{@tab*n}\n" } elsif @copen[2] == true #5~ @@ -275,8 +282,14 @@ WOK end @cont[2]=true when 6 - @@xml[:body] << "#{@tab*5}\n" if @cont[3] or @cont[2] or @cont[1] - [3].each { |v| @@xml[:body] << "#{@tab*n}\n" } if @copen[3] #6{ + if @cont[3] \ + or @cont[2] \ + or @cont[1] + @@xml[:body] << "#{@tab*5}\n" + end + if @copen[3] #6{ + [3].each { |v| @@xml[:body] << "#{@tab*n}\n" } + end @cont[3]=true end end @@ -340,7 +353,11 @@ WOK if d_meta; xml_head(d_meta) end end - @rcdc=true if @rcdc==false and (para =~/~metadata/ or para =~/1~meta\s+Document Information/) + if @rcdc==false \ + and (para =~/~metadata/ \ + or para =~/1~meta\s+Document Information/) + @rcdc=true + end if para !~/(^0~||)/ if para =~/.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ paranum=para[@regx,3] @@ -403,19 +420,25 @@ WOK else 'norm' end xml_markup(para) - @@xml[:body] << %{#{@tab*6}} << "\n" if para[@regx] and para[@regx,3] + if para[@regx] \ + and para[@regx,3] + @@xml[:body] << %{#{@tab*6}} << "\n" + end @@xml[:body] << "#{@tab*7}#{para[@regx,3]}" << "\n" if para[@regx,3] @@xml[:body] << %{#{@tab*7}#{para[@regx,2]}\n} if para[@regx,2] # main text, contents, body KEEP @@xml[:body] << "#{@tab*6}" << "\n" if para[@regx] end end - elsif para =~/(Note|Endnotes?)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(Note|Endnotes?)/ \ + and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ #format_scroll=MonoSiSU.new('
Note') #para=format_scroll.boldPara - elsif para =~/(MetaData)/ and para =~/<~\d+;[m]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info + elsif para =~/(MetaData)/ \ + and para =~/<~\d+;[m]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info format_scroll=Format_scroll.new(@md,'
MetaData') para=format_scroll.bold_para - elsif para =~/(Owner Details)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ + elsif para =~/(Owner Details)/ \ + and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ format_scroll=Format_scroll.new(@md,'
Owner Details') @@xml[:owner_details]=format_scroll.bold_para para='' @@ -424,7 +447,10 @@ WOK format_text=Format_text_object.new(one,two) para=format_text.seg_no_paranum end - para='' if para =~// and para =~/^(-\{{2}~\d+|)/ # -endnote + if para =~// \ + and para =~/^(-\{{2}~\d+|)/ # -endnote + para='' + end if para =~/.*<:#>.*$/ para=case para when /<:i[1-9]>/ -- cgit v1.2.3