From 7bc559f85cb0b6c6f4cdfe127a386573b4c5d8ce Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 5 Sep 2011 10:36:28 -0400 Subject: v3: unix conditional tests (? :) remove line break markers before : cosmetic --- data/doc/sisu/CHANGELOG_v3 | 3 ++ lib/sisu/v3/cgi_sql_common.rb | 26 ++++----- lib/sisu/v3/concordance.rb | 4 +- lib/sisu/v3/dal.rb | 36 ++++++------- lib/sisu/v3/dal_numbering.rb | 4 +- lib/sisu/v3/dal_syntax.rb | 4 +- lib/sisu/v3/db_create.rb | 4 +- lib/sisu/v3/db_import.rb | 14 ++--- lib/sisu/v3/db_remove.rb | 2 +- lib/sisu/v3/db_select.rb | 2 +- lib/sisu/v3/digests.rb | 4 +- lib/sisu/v3/epub.rb | 4 +- lib/sisu/v3/epub_format.rb | 40 +++++++------- lib/sisu/v3/epub_segments.rb | 8 +-- lib/sisu/v3/git.rb | 2 +- lib/sisu/v3/harvest_authors.rb | 10 ++-- lib/sisu/v3/harvest_topics.rb | 8 +-- lib/sisu/v3/html.rb | 2 +- lib/sisu/v3/html_promo.rb | 2 +- lib/sisu/v3/html_segments.rb | 2 +- lib/sisu/v3/manifest.rb | 2 +- lib/sisu/v3/manpage.rb | 4 +- lib/sisu/v3/odf.rb | 6 +-- lib/sisu/v3/options.rb | 18 +++---- lib/sisu/v3/param.rb | 100 +++++++++++++++++------------------ lib/sisu/v3/plaintext.rb | 6 +-- lib/sisu/v3/po4a.rb | 12 ++--- lib/sisu/v3/qrcode.rb | 2 +- lib/sisu/v3/share_src.rb | 2 +- lib/sisu/v3/sisupod_make.rb | 4 +- lib/sisu/v3/sysenv.rb | 116 ++++++++++++++++++++--------------------- lib/sisu/v3/texinfo.rb | 4 +- lib/sisu/v3/texpdf.rb | 2 +- lib/sisu/v3/texpdf_format.rb | 2 +- lib/sisu/v3/urls.rb | 2 +- lib/sisu/v3/wikispeak.rb | 2 +- lib/sisu/v3/xhtml.rb | 2 +- lib/sisu/v3/xml.rb | 2 +- lib/sisu/v3/xml_dom.rb | 2 +- 39 files changed, 237 insertions(+), 234 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 5e3ee8f5..6dc5857f 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.17.orig.tar.xz sisu_3.0.17-1.dsc sisu_3.0.17-1.debian.tar.gz + * unix conditional tests ? : remove line break marker at end of line before + :, cosmetic + %% 3.0.16.orig.tar.gz (2011-08-18:33/4) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu-3.0.16 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.0.16-1 diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb index 5a2b9fde..c377e002 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v3/cgi_sql_common.rb @@ -471,7 +471,7 @@ module SiSU_CGI_sql end def previous @offset_previous >= 0 \ - ? (@@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + @offset_previous.to_s) \ + ? (@@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + @offset_previous.to_s) : '' end def start @@ -664,7 +664,7 @@ module SiSU_CGI_sql end checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','','' result_type=(cgi['view']=~/text/) \ - ? result_type={ :index => '', :text => 'checked'} \ + ? result_type={ :index => '', :text => 'checked'} : result_type={ :index => 'checked', :text => ''} @@limit=if cgi['sql_match_limit'].to_s=~/2500/ checked_sql_limit={ :l1000 => '', :l2500 => 'checked'} @@ -735,7 +735,7 @@ module SiSU_CGI_sql dtv='&dtv=' + CGI.escape(@search_for.date_valid) if @search_for.date_valid=~/\S/ fns='&fns=' + CGI.escape(@search_for.filename) if @search_for.filename=~/\S/ @@canned_search_url=(checked_all =~/checked/) \ - ? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" \ + ? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" : "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}" mod=ft=~/\S+/ ? (ft.gsub(/ft/,'s1')) : s1 @canned_base_url="#{@base}?#{mod}&db=#{cgi['db']}" @@ -809,7 +809,7 @@ module SiSU_CGI_sql puts (@header+@tail) else #% searches s1=(@search_for.text1 =~/\S/) \ - ? @search_for.text1 \ + ? @search_for.text1 : 'Unavailable' if checked_case=~/\S/ @search[:text]<<%{doc_objects.clean~'#{CGI.unescape(s1)}'} @@ -924,11 +924,11 @@ module SiSU_CGI_sql if c['tid'].to_i != oldtid.to_i ti=c['title'] can_txt_srch=(cgi['view']=~/index/) \ - ? %{search } \ + ? %{search } : %{search } title=%{toc html #{ti} [#{c['language_document_char']}] by #{c['creator_author']} #{can_txt_srch}toc html manifest
} if file_suffix=~/s/ #hmm watch file_suffix title=@text_search_flag \ - ? '

'+title \ + ? '

'+title : '
'+title @counter_txt_doc+=1 oldtid=c['tid'].to_i @@ -950,7 +950,7 @@ module SiSU_CGI_sql search_regex=[] build=unescaped_search.scan(/\S+/).each do |g| (g.to_s =~/(AND|OR)/) \ - ? (search_regex << '|') \ + ? (search_regex << '|') : (search_regex << %{#{g.to_s}}) end search_regex=search_regex.join(' ') @@ -961,7 +961,7 @@ module SiSU_CGI_sql else nil end matched_para=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \ - ? (c['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{\\1})) \ + ? (c['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{\\1})) : c['body'] %{

ocn #{c['ocn']}:

#{matched_para}} elsif c['suffix'] =~/1/ #doc @@ -983,7 +983,7 @@ module SiSU_CGI_sql else @counter_txt_ocn+=1 output=c['suffix'] !~/1/ \ - ? title+index \ + ? title+index : %{#{title}#{c['ocn'].sort}, } end end @@ -1017,7 +1017,7 @@ module SiSU_CGI_sql if e['metadata_tid'].to_i != oldtid.to_i ti=e['title'] can_txt_srch=(cgi['view']=~/index/) \ - ? %{search } \ + ? %{search } : %{search } title=%{

toc html #{ti} [#{e['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}toc html manifest
} if file_suffix=~/s/ @counter_endn_doc+=1 @@ -1028,7 +1028,7 @@ module SiSU_CGI_sql or (cgi['view']!~/index/ and cgi['search'] !~/search db/) #% txt endnotes @counter_endn_ocn+=1 matched_endnote=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \ - ? matched=e['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{\\1}) \ + ? matched=e['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{\\1}) : e['body'] output=%{#{title}
note #{e['nr']} referred to from ocn #{e['ocn']}: #{matched_endnote}} else #elsif cgi['view']=~/index/ #doc #FIX #% idx endnotes @@ -1038,7 +1038,7 @@ module SiSU_CGI_sql @counters_endn=if @counter_endn_doc > 0 if checked_stats =~/\S/ @@lt_e=@counter_endn_ocn==dbi_statement.sql_match_limit.to_i \ - ? true \ + ? true : false start=(@@offset.to_i+1).to_s range=(@@offset.to_i+@counter_endn_ocn.to_i).to_s @@ -1054,7 +1054,7 @@ module SiSU_CGI_sql limit=dbi_statement.sql_match_limit.to_s @@lt_t ||=false; @@lt_e ||=false canned=(@@lt_t or @@lt_e) \ - ? dbi_statement.pre_next(true,@image_src).to_s \ + ? dbi_statement.pre_next(true,@image_src).to_s : dbi_statement.pre_next(false,@image_src).to_s limit=dbi_statement.sql_match_limit.to_s cgi.out{@header.force_encoding("UTF-8") + @counters_txt.force_encoding("UTF-8") + @counters_endn.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @body_main.force_encoding("UTF-8") + @endnotes.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @tail.force_encoding("UTF-8")} #% print cgi_output_header+counters+body+endnotes diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v3/concordance.rb index f8118cd0..683b092e 100644 --- a/lib/sisu/v3/concordance.rb +++ b/lib/sisu/v3/concordance.rb @@ -78,10 +78,10 @@ module SiSU_Concordance loc=@env.url.output_tell unless @md.opt.cmd =~/q/ tool=(@md.opt.cmd =~/[MVv]/) \ - ? "#{@env.program.web_browser} #{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}" \ + ? "#{@env.program.web_browser} #{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}" : "[#{@opt.f_pth[:lng_is]}]" @md.opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@md.opt.cmd,"Concordance",tool).grey_title_hi \ + ? SiSU_Screen::Ansi.new(@md.opt.cmd,"Concordance",tool).grey_title_hi : SiSU_Screen::Ansi.new(@md.opt.cmd,'Concordance',tool).green_title_hi end wordmax=@env.concord_max diff --git a/lib/sisu/v3/dal.rb b/lib/sisu/v3/dal.rb index 2475a6ea..5c059677 100644 --- a/lib/sisu/v3/dal.rb +++ b/lib/sisu/v3/dal.rb @@ -114,7 +114,7 @@ module SiSU_DAL dal=[] @@dal_array=[] @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \ - ? @fnx \ + ? @fnx : @opt.fns create_dal rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@@fns).error @@ -128,7 +128,7 @@ module SiSU_DAL unless @@fns==@opt.fns \ or @@fns==@fnx @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \ - ? @fnx \ + ? @fnx : @opt.fns @@dal_array=[] end @@ -144,7 +144,7 @@ module SiSU_DAL unless @@fns==@opt.fns \ or @@fns==@fnx @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \ - ? @fnx \ + ? @fnx : @opt.fns @@idx_arr[:sst]=[] end @@ -160,7 +160,7 @@ module SiSU_DAL unless @@fns==@opt.fns \ or @@fns==@fnx @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \ - ? @fnx \ + ? @fnx : @opt.fns @@idx_arr[:tex]=[] end @@ -176,7 +176,7 @@ module SiSU_DAL unless @@fns==@opt.fns \ or @@fns==@fnx @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \ - ? @fnx \ + ? @fnx : @opt.fns @@idx_arr[:html]=[] end @@ -192,7 +192,7 @@ module SiSU_DAL unless @@fns==@opt.fns \ or @@fns==@fnx @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \ - ? @fnx \ + ? @fnx : @opt.fns @@idx_arr[:xthml]=[] end @@ -208,7 +208,7 @@ module SiSU_DAL unless @@fns==@opt.fns \ or @@fns==@fnx @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \ - ? @fnx \ + ? @fnx : @opt.fns @@map_arr[:nametags]=[] end @@ -224,7 +224,7 @@ module SiSU_DAL unless @@fns==@opt.fns \ or @@fns==@fnx @@fns=(@fnx && @fnx =~/\.ss[tmi]$/) \ - ? @fnx \ + ? @fnx : @opt.fns @@map_arr[:ocn_htmlseg]=[] end @@ -239,12 +239,12 @@ module SiSU_DAL dal_array=[] unless @opt.cmd =~/q/ tell=(@opt.cmd=~/[vVM]/) \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction') \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction') : SiSU_Screen::Ansi.new(@opt.cmd,'Document Abstraction',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}") tell.green_title_hi end fn=(@fnx && @fnx =~/\.ss[tmi]$/) \ - ? @fnx \ + ? @fnx : @opt.fns file_array=@env.read_source_file(fn) file_array.each do |l| @@ -268,7 +268,7 @@ module SiSU_DAL dal=[] dal=if FileTest.file?(@fnm) (RUBY_VERSION < '1.9') \ - ? (File.open(@fnm){ |f| dal=Marshal.load(f)}) \ + ? (File.open(@fnm){ |f| dal=Marshal.load(f)}) : (File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)}) else SiSU_DAL::Source.new(@opt).create_dal end @@ -277,7 +277,7 @@ module SiSU_DAL dal=[] dal=if FileTest.file?(@fnc) (RUBY_VERSION < '1.9') \ - ? (File.open(@fnc){ |f| dal=Marshal.load(f)}) \ + ? (File.open(@fnc){ |f| dal=Marshal.load(f)}) : (File.open(@fnc,'r:utf-8'){ |f| dal=Marshal.load(f)}) else SiSU_DAL::Source.new(@opt).create_dal end @@ -286,7 +286,7 @@ module SiSU_DAL m=[] m=if FileTest.file?(@idx_sst) (RUBY_VERSION < '1.9') \ - ? (File.open(@idx_sst){ |f| m=Marshal.load(f)}) \ + ? (File.open(@idx_sst){ |f| m=Marshal.load(f)}) : (File.open(@idx_sst,'r:utf-8'){ |f| m=Marshal.load(f)}) else nil end @@ -295,7 +295,7 @@ module SiSU_DAL m=[] m=if FileTest.file?(@idx_tex) (RUBY_VERSION < '1.9') \ - ? (File.open(@idx_tex){ |f| m=Marshal.load(f)}) \ + ? (File.open(@idx_tex){ |f| m=Marshal.load(f)}) : (File.open(@idx_tex,'r:utf-8'){ |f| m=Marshal.load(f)}) else nil end @@ -304,7 +304,7 @@ module SiSU_DAL m=[] m=if FileTest.file?(@idx_html) (RUBY_VERSION < '1.9') \ - ? (File.open(@idx_html){ |f| m=Marshal.load(f)}) \ + ? (File.open(@idx_html){ |f| m=Marshal.load(f)}) : (File.open(@idx_html,'r:utf-8'){ |f| m=Marshal.load(f)}) else nil end @@ -313,7 +313,7 @@ module SiSU_DAL m=[] m=if FileTest.file?(@idx_xhtml) (RUBY_VERSION < '1.9') \ - ? (File.open(@idx_xhtml){ |f| m=Marshal.load(f)}) \ + ? (File.open(@idx_xhtml){ |f| m=Marshal.load(f)}) : (File.open(@idx_xhtml,'r:utf-8'){ |f| m=Marshal.load(f)}) else nil end @@ -322,7 +322,7 @@ module SiSU_DAL m=[] m=if FileTest.file?(@map_nametags) (RUBY_VERSION < '1.9') \ - ? (File.open(@map_nametags){ |f| m=Marshal.load(f)}) \ + ? (File.open(@map_nametags){ |f| m=Marshal.load(f)}) : (File.open(@map_nametags,'r:utf-8'){ |f| m=Marshal.load(f)}) else nil end @@ -331,7 +331,7 @@ module SiSU_DAL m=[] m=if FileTest.file?(@map_ocn_htmlseg) (RUBY_VERSION < '1.9') \ - ? (File.open(@map_ocn_htmlseg){ |f| m=Marshal.load(f)}) \ + ? (File.open(@map_ocn_htmlseg){ |f| m=Marshal.load(f)}) : (File.open(@map_ocn_htmlseg,'r:utf-8'){ |f| m=Marshal.load(f)}) else nil end diff --git a/lib/sisu/v3/dal_numbering.rb b/lib/sisu/v3/dal_numbering.rb index 0a49c3da..52cb4c7f 100644 --- a/lib/sisu/v3/dal_numbering.rb +++ b/lib/sisu/v3/dal_numbering.rb @@ -169,7 +169,7 @@ module SiSU_numbering tag=heading_tag_clean(tag) dob.tags=[tag,dob.tags].flatten if tag !~/^\d+$/ #check whether will work across file types with stop signs (dob.obj =~/(Article|Clause|Section)\s+/) \ - ? (dob.obj.gsub!(/(Article|Clause|Section)\s+/,"\\1 #{title_no} ")) \ + ? (dob.obj.gsub!(/(Article|Clause|Section)\s+/,"\\1 #{title_no} ")) : (dob.obj.gsub!(/^/,"#{title_no}. ")) #fix stop later end if dob.ln !=no1 \ @@ -355,7 +355,7 @@ module SiSU_numbering if defined? dob.ocn \ and dob.ocn @segname=((dob.is=='heading'|| dob.is=='heading_insert') && dob.ln==4 && (defined? dob.name)) \ - ? (dob.name) \ + ? (dob.name) : @segname tags["#{dob.ocn}"]={ segname: @segname } ocn_html_seg[dob.ocn]=if dob.is =~/heading/ diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb index bb1aacbe..a412ef3d 100644 --- a/lib/sisu/v3/dal_syntax.rb +++ b/lib/sisu/v3/dal_syntax.rb @@ -89,7 +89,7 @@ module SiSU_Syntax end @http_m=%r{\{.+?\}https?://\S+|https?:\S+|:\S+|\.\.\/\S+|#\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|block|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}} @manmkp_ital=emph_italics \ - ? '[i/*]\\{.+?\\}[i/*]' \ + ? '[i/*]\\{.+?\\}[i/*]' : '[i/]\\{.+?\\}[i/]' tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)} tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?} @@ -104,7 +104,7 @@ module SiSU_Syntax /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/ end @manmkp_bold=emph_italics \ - ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]' \ + ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]' : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]' @line_scan_bold=if (defined? @md.make.bold[:str] \ and @md.make.bold[:str]) \ diff --git a/lib/sisu/v3/db_create.rb b/lib/sisu/v3/db_create.rb index 1804410a..5f8b2465 100644 --- a/lib/sisu/v3/db_create.rb +++ b/lib/sisu/v3/db_create.rb @@ -66,7 +66,7 @@ module SiSU_DB_create @opt,@conn,@file,@sql_type=opt,conn,file,sql_type @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX @comment=(@sql_type=='pg') \ - ? (Comment.new(@conn,@sql_type)) \ + ? (Comment.new(@conn,@sql_type)) : nil @@dl ||=SiSU_Env::Info_env.new.digest.length end @@ -81,7 +81,7 @@ module SiSU_DB_create def create_db @env=SiSU_Env::Info_env.new(@opt.fns) tell=(@sql_type=='sqlite') \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create Sqlite db tables in:',%{"#{@env.path.output}/sisu_sqlite.db"}) \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create Sqlite db tables in:',%{"#{@env.path.output}/sisu_sqlite.db"}) : SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create PG db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) tell.colorize if @opt.cmd =~/vVM/ SiSU_Env::System_call.new.create_pg_db(@env.path.stub_pwd) if @sql_type=='pg' #watch use of path.stub_pwd instead of stub diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb index ac6f0104..856817e1 100644 --- a/lib/sisu/v3/db_import.rb +++ b/lib/sisu/v3/db_import.rb @@ -88,14 +88,14 @@ module SiSU_DB_import @db=SiSU_Env::Info_db.new if @sql_type=='sqlite' @driver_sqlite3=(@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \ - ? true \ + ? true : false end sql='SELECT MAX(lid) FROM doc_objects' begin @col[:lid] ||=0 @col[:lid]=@driver_sqlite3 \ - ? @conn.execute( sql ).join.to_i \ + ? @conn.execute( sql ).join.to_i : @conn.execute( sql ) { |x| x.fetch_all.flatten[0] } rescue puts "#{__FILE__}:#{__LINE__}" if @opt.cmd =~/M/ @@ -104,7 +104,7 @@ module SiSU_DB_import sql='SELECT MAX(nid) FROM endnotes' begin @id_n=@driver_sqlite3 \ - ? @conn.execute( sql ).join.to_i \ + ? @conn.execute( sql ).join.to_i : @id_n=@conn.execute( sql ) { |x| x.fetch_all.flatten[0] } @id_n ||=0 rescue @@ -128,7 +128,7 @@ module SiSU_DB_import AND metadata_and_text.language_document_char = '#{@opt.lng}' ;} file_exist=@sql_type=~/sqlite/ \ - ? @conn.get_first_value(select_first_match) \ + ? @conn.get_first_value(select_first_match) : @conn.select_one(select_first_match) if not file_exist t_d=[] # transaction_data @@ -554,17 +554,17 @@ module SiSU_DB_import end def standard x=(@txt =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/) \ - ? @txt.scan(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/) \ + ? @txt.scan(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/) : nil end def asterisk x=(@txt =~/#{Mx[:en_b_o]}\*.+?#{Mx[:en_b_c]}/) \ - ? @txt.scan(/#{Mx[:en_b_o]}[*](\d+).+?#{Mx[:en_b_c]}/) \ + ? @txt.scan(/#{Mx[:en_b_o]}[*](\d+).+?#{Mx[:en_b_c]}/) : nil end def plus x=(@txt =~/#{Mx[:en_b_o]}\+.+?#{Mx[:en_b_c]}/) \ - ? @txt.scan(/#{Mx[:en_b_o]}[+](\d+).+?#{Mx[:en_b_c]}/) \ + ? @txt.scan(/#{Mx[:en_b_o]}[+](\d+).+?#{Mx[:en_b_c]}/) : nil end def clean_text(base_url=nil) diff --git a/lib/sisu/v3/db_remove.rb b/lib/sisu/v3/db_remove.rb index cfa19c9f..a390b2cc 100644 --- a/lib/sisu/v3/db_remove.rb +++ b/lib/sisu/v3/db_remove.rb @@ -68,7 +68,7 @@ module SiSU_DB_remove def remove driver_sqlite3=if @sql_type=='sqlite' (@conn.inspect.match(/^(.{10})/)[1]==@db.sqlite.conn_sqlite3.inspect.match(/^(.{10})/)[1]) \ - ? true \ + ? true : false end del_id=if driver_sqlite3 diff --git a/lib/sisu/v3/db_select.rb b/lib/sisu/v3/db_select.rb index 0cd34bcd..75a0a718 100644 --- a/lib/sisu/v3/db_select.rb +++ b/lib/sisu/v3/db_select.rb @@ -81,7 +81,7 @@ module SiSU_DB_select end if @conn.class==NilClass db=@sql_type=='sqlite' \ - ? @db.sqlite.db \ + ? @db.sqlite.db : @db.psql.db puts %{no connection with #{@sql_type} database established, createdb "#{db}"?} exit diff --git a/lib/sisu/v3/digests.rb b/lib/sisu/v3/digests.rb index a4be38e4..eac2e81d 100644 --- a/lib/sisu/v3/digests.rb +++ b/lib/sisu/v3/digests.rb @@ -76,10 +76,10 @@ module SiSU_Digest_view @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array unless @opt.cmd =~/q/ tool=(@opt.cmd =~/[MVv]/) \ - ? "#{@env.program.text_editor} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}" \ + ? "#{@env.program.text_editor} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,"Document #{@dg} Digests",tool).green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,"Document #{@dg} Digests",tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,"Document #{@dg} Digests",tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}").flow if @opt.cmd =~/[MV]/ end diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index e2d65111..42bc6cd9 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -86,10 +86,10 @@ module SiSU_EPUB loc=@env.path.url.output_tell unless @opt.cmd =~/q/ tool=(@opt.cmd =~/[MVvz]/) \ - ? "#{@env.program.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" \ + ? "#{@env.program.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}").flow if @opt.cmd =~/[MV]/ end diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 1de067e4..345bee95 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1419,7 +1419,7 @@ WOK end def navmap_sisu_toc(no) id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ - ? '' \ + ? '' : "-#{no}" < @@ -1433,7 +1433,7 @@ WOK def navpoint(dob,no,name=nil) name=name ? name : dob.name id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ - ? '' \ + ? '' : "-#{no}" < @@ -1485,13 +1485,13 @@ WOK m='' @md.creator.author_detail.each do |x| surname=x[:the] \ - ? x[:the] \ + ? x[:the] : '' other_names=x[:others] \ - ? ', ' + x[:others] \ + ? ', ' + x[:others] : '' m=(m.empty?) \ - ? (surname + other_names) \ + ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m.gsub!(//,'>') m.gsub!(/<br(?: \/)?>/,';') @@ -1507,13 +1507,13 @@ WOK m='' @md.creator.editor_detail.each do |x| surname=x[:the] \ - ? x[:the] \ + ? x[:the] : '' other_names=x[:others] \ - ? ', ' + x[:others] \ + ? ', ' + x[:others] : '' m=(m.empty?) \ - ? (surname + other_names) \ + ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m.gsub!(//,'>') m.gsub!(/<br(?: \/)?>/,';') @@ -1529,13 +1529,13 @@ WOK m='' @md.creator.translator_detail.each do |x| surname=x[:the] \ - ? x[:the] \ + ? x[:the] : '' other_names=x[:others] \ - ? ', ' + x[:others] \ + ? ', ' + x[:others] : '' m=(m.empty?) \ - ? (surname + other_names) \ + ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m.gsub!(//,'>') m.gsub!(/<br(?: \/)?>/,';') @@ -1551,13 +1551,13 @@ WOK m='' @md.creator.illustrator_detail.each do |x| surname=x[:the] \ - ? x[:the] \ + ? x[:the] : '' other_names=x[:others] \ - ? ', ' + x[:others] \ + ? ', ' + x[:others] : '' m=(m.empty?) \ - ? (surname + other_names) \ + ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m.gsub!(//,'>') m.gsub!(/<br(?: \/)?>/,';') @@ -1767,7 +1767,7 @@ WOK #{@vz.epub_png_nav_nxt} } if @md.firstseg =~/\S+/ DISABLE[:epub][:internal_navigation] \ - ? '' \ + ? '' : %{

#{firstseg}

} end def seg_head_navigation_band_bottom @@ -1775,7 +1775,7 @@ WOK #{@vz.epub_png_nav_nxt} } if @md.firstseg =~/\S+/ DISABLE[:epub][:internal_navigation] \ - ? '' \ + ? '' : %{

#{firstseg}

} end def manifest_link(text) #watch fix removed font size 2 @@ -1954,7 +1954,7 @@ WOK } if f_nxt==true DISABLE[:epub][:internal_navigation] \ - ? '' \ + ? '' : %{

#{pre} #{toc} @@ -2282,17 +2282,17 @@ WOK end def title_heading1 id_u=DISABLE[:epub][:per_section_title] \ - ? '' \ + ? '' : title_heading('h1','tiny') end def title_heading2 id_u=DISABLE[:epub][:per_section_title] \ - ? '' \ + ? '' : title_heading('h2','tiny') end def title_heading3 id_u=DISABLE[:epub][:per_section_title] \ - ? '' \ + ? '' : title_heading('h3','tiny') end def title_heading4 diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index f110dfe4..7e4c412e 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -301,7 +301,7 @@ WOK if dob.is=='heading' \ and dob.ln =~/^[1-6]/ @@seg[:dot_nav]= (@@tracker < @@seg_total-1) \ - ? format_head_seg.dot_control_pre_next \ + ? format_head_seg.dot_control_pre_next : format_head_seg.dot_control_pre end @@seg[:title]=format_head_seg.head @@ -311,7 +311,7 @@ WOK format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) if @@tracker < @@seg_total-1 @@segtocband=(@@tracker==0) \ - ? format_head_seg.toc_next2 \ + ? format_head_seg.toc_next2 : format_head_seg.toc_pre_next2 else @@segtocband=format_head_seg.toc_pre2 #if format_head_seg.toc_pre2 end @@ -390,7 +390,7 @@ WOK and dob.hang =~/[0-9]/ if dob.bullet_ (dob.indent =~/[1-9]/) \ - ? sto.format('li',"i#{dob.indent}") \ + ? sto.format('li',"i#{dob.indent}") : sto.format('li','bullet') elsif dob.indent == dob.hang sto.format('p',"i#{dob.indent}") @@ -485,7 +485,7 @@ WOK @@fn=dob.name else @@fn=(dob.name =~/\S+/) \ - ? dob.name \ + ? dob.name : '' end end diff --git a/lib/sisu/v3/git.rb b/lib/sisu/v3/git.rb index 45eb3f75..322b5846 100644 --- a/lib/sisu/v3/git.rb +++ b/lib/sisu/v3/git.rb @@ -114,7 +114,7 @@ module SiSU_Git end unless @opt.cmd =~/q/ @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Git path',@git_path[:fnb]).green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Git path',@git_path[:fnb]).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'Git path',@git_path[:fnb]).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,"Git path","#{@opt.fns} -> #{@git_path[:fnb]}").warn if @opt.cmd =~/[MVv]/ end diff --git a/lib/sisu/v3/harvest_authors.rb b/lib/sisu/v3/harvest_authors.rb index c59a9111..1320be41 100644 --- a/lib/sisu/v3/harvest_authors.rb +++ b/lib/sisu/v3/harvest_authors.rb @@ -216,17 +216,17 @@ module HARVEST_authors css_path,topics='','' if @env.output_dir_structure.by_language_code? css_path=(type !~/maintenance/) \ - ? '../../_sisu/css/harvest.css' \ + ? '../../_sisu/css/harvest.css' : 'harvest.css' topics='topics.html' elsif @env.output_dir_structure.by_filetype? css_path=(type !~/maintenance/) \ - ? '../_sisu/css/harvest.css' \ + ? '../_sisu/css/harvest.css' : 'harvest.css' topics="topics.#{lng}.html" elsif @env.output_dir_structure.by_filename? css_path=(type !~/maintenance/) \ - ? '../_sisu/css/harvest.css' \ + ? '../_sisu/css/harvest.css' : 'harvest.css' topics="topics.#{lng}.html" end @@ -281,7 +281,7 @@ WOK a << '

' @alph.each do |x| a << ((x =~/[0-9]/) \ - ? '' \ + ? '' : %{#{x}, }) end a=a.join @@ -351,7 +351,7 @@ WOK end work=[ "#{x[:date]} #{x[:title]}", %{

#{x[:date]} #{x[:title]}, #{x[:author][:authors_s]}

} ] works<<=(@output[lng][:html_mnt].class==File) \ - ? (work.concat([%{

[src]  #{x[:date]} #{x[:title]}, #{x[:author][:authors_s]} -- [#{x[:file]}.sst]

}])) \ + ? (work.concat([%{

[src]  #{x[:date]} #{x[:title]}, #{x[:author][:authors_s]} -- [#{x[:file]}.sst]

}])) : work end works.sort_by {|x| x[0]}.each do |x| diff --git a/lib/sisu/v3/harvest_topics.rb b/lib/sisu/v3/harvest_topics.rb index c3204de9..9ab78f46 100644 --- a/lib/sisu/v3/harvest_topics.rb +++ b/lib/sisu/v3/harvest_topics.rb @@ -310,17 +310,17 @@ module HARVEST_topics css_path,authors='','' if @env.output_dir_structure.by_language_code? css_path=(type !~/maintenance/) \ - ? '../../_sisu/css/harvest.css' \ + ? '../../_sisu/css/harvest.css' : 'harvest.css' authors='authors.html' elsif @env.output_dir_structure.by_filetype? css_path=(type !~/maintenance/) \ - ? '../_sisu/css/harvest.css' \ + ? '../_sisu/css/harvest.css' : 'harvest.css' authors="authors.#{lng}.html" elsif @env.output_dir_structure.by_filename? css_path=(type !~/maintenance/) \ - ? '../_sisu/css/harvest.css' \ + ? '../_sisu/css/harvest.css' : 'harvest.css' authors="authors.#{lng}.html" end @@ -375,7 +375,7 @@ WOK a << '

' @alph.each do |x| a << ((x =~/[0-9]/) \ - ? '' \ + ? '' : %{#{x}, }) end a=a.join diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb index 744cceca..000efc2e 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v3/html.rb @@ -91,7 +91,7 @@ module SiSU_HTML else "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" end @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}").flow if @opt.cmd =~/[MV]/ end diff --git a/lib/sisu/v3/html_promo.rb b/lib/sisu/v3/html_promo.rb index 91f63ac1..f4777a1e 100644 --- a/lib/sisu/v3/html_promo.rb +++ b/lib/sisu/v3/html_promo.rb @@ -150,7 +150,7 @@ module SiSU_HTML_promo elsif defined? @rc['search']['sisu']['db'] \ and @rc['search']['sisu']['db'] =~/\S+/ (@rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ - ? @prod['search']['sisu']['db'] \ + ? @prod['search']['sisu']['db'] : "#{Db[:name_prefix]}#{@prod['db']}" else nil end diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v3/html_segments.rb index e6dc0d35..67bfa319 100644 --- a/lib/sisu/v3/html_segments.rb +++ b/lib/sisu/v3/html_segments.rb @@ -240,7 +240,7 @@ module SiSU_HTML_seg segfilename="#{@file.output_path.html_seg.dir}/#{@@seg_name_html[tracking-1]}#{@md.lang_code_insert}#{Sfx[:html]}" output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] minitoc=(@env.html_minitoc?) \ - ? @minitoc \ + ? @minitoc : '' if dob.is=='heading' \ or @@seg_name_html[tracking-1] !~/endnotes|book_index|metadata/ diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index f94534a4..d4e150f0 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -87,7 +87,7 @@ module SiSU_Manifest unless @opt.cmd =~/q/ url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}").green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}").green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i end diff --git a/lib/sisu/v3/manpage.rb b/lib/sisu/v3/manpage.rb index e23caa76..29c17b45 100644 --- a/lib/sisu/v3/manpage.rb +++ b/lib/sisu/v3/manpage.rb @@ -84,11 +84,11 @@ module SiSU_Manpage @env=SiSU_Env::Info_env.new(@opt.fns) path=@env.path.output_tell tool=(@opt.cmd =~/[MVv]/) \ - ? "#{@env.program.text_editor} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}" \ + ? "#{@env.program.text_editor} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" @opt.cmd=~/[MVvz]/ \ && @opt.cmd !~/q/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Manpage',tool).green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Manpage',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'Manpage',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").flow if @opt.cmd =~/[MV]/ @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index 49856a87..8ff98db5 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -84,10 +84,10 @@ module SiSU_ODF @env.odf_structure unless @opt.cmd =~/q/ tool=(@opt.cmd =~/[MVv]/) \ - ? "#{@env.program.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}" \ + ? "#{@env.program.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool).green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").flow if @opt.cmd =~/[MV]/ end @@ -266,7 +266,7 @@ module SiSU_ODF end t=map_nametags[url] \ && map_nametags[url][:segname] \ - ? %{#{txt.strip}#{trail}} \ + ? %{#{txt.strip}#{trail}} : %{#{txt.strip}#{trail}} end t diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 5b179a57..77031ea4 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -212,7 +212,7 @@ module SiSU_commandline u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ t=/.+\/(#{r})$/ l_p = (pt.split[0].realpath.to_s[t,1]) \ - ? pt.split[0].realpath.to_s[t,1] \ + ? pt.split[0].realpath.to_s[t,1] : nil #: '' lng << l_p @@ -233,7 +233,7 @@ module SiSU_commandline f: pt.split[1].to_s, pth_stub: pt.split[0].realpath.to_s[u,1], lng: (pt.split[0].realpath.to_s[t,1]) \ - ? pt.split[0].realpath.to_s[t,1] \ + ? pt.split[0].realpath.to_s[t,1] : nil, lng_is: lng_is } @@ -257,31 +257,31 @@ module SiSU_commandline y=case x when /0/ (x=~/^-1\S+/) \ - ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') \ + ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') : x.gsub(/^-0/,shortcut.cf_0 + ' ') when /1/ (x=~/^-1\S+/) \ - ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') \ + ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') : x.gsub(/^-1/,shortcut.cf_1 + ' ') when /2/ (x=~/^-2\S+/) \ - ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') \ + ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') : x.gsub(/^-2/,shortcut.cf_2 + ' ') when /3/ (x=~/^-3\S+/) \ - ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') \ + ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') : x.gsub(/^-3/,shortcut.cf_3 + ' ') when /4/ (x=~/^-4\S+/) \ - ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') \ + ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') : x.gsub(/^-4/,shortcut.cf_4 + ' ') when /5/ (x=~/^-5\S+/) \ - ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') \ + ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') : x.gsub(/^-5/,shortcut.cf_5 + ' ') when /6/ (x=~/^-6\S+/) \ - ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1') \ + ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1') : x.gsub(/^-6/,shortcut.cf_5 + ' ') else x end diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 58d3aba9..1be55583 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -132,7 +132,7 @@ module SiSU_Param s=nil if @author s ||=((@date =~/([12][890]\d{2})/ ) \ - ? ("Copyright (C) #{$1} #{@author}") \ + ? ("Copyright (C) #{$1} #{@author}") : ('Copyright (C)' + @author)) #matches years 1800 through 20\d\d 2004w19 end s @@ -145,7 +145,7 @@ module SiSU_Param s=nil if @author s ||=((@date =~/([12][890]\d{2})/ ) \ - ? ("Copyright (C) #{$1} #{@author}") \ + ? ("Copyright (C) #{$1} #{@author}") : ('Copyright (C)' + @author)) #matches years 1800 through 20\d\d 2004w19 end s @@ -259,14 +259,14 @@ module SiSU_Param end def short s=@h['short'] \ - ? @h['short'] \ + ? @h['short'] : @h['main'] l,n=Db[:col_title_part],'title.short' validate_length(s,l,n) end def full s=@h['subtitle'] \ - ? (@h['main'] + ' - ' + @h['subtitle']) \ + ? (@h['main'] + ' - ' + @h['subtitle']) : @h['main'] l,n=Db[:col_title],'title.full' validate_length(s,l,n) @@ -295,17 +295,17 @@ module SiSU_Param end def author_detail s=@h['author'] \ - ? @h['author'] \ + ? @h['author'] : @h['main'] names=name_format(s) names[:name_a_h] end def editor names=@h['editor'] \ - ? name_format(@h['editor']) \ + ? name_format(@h['editor']) : nil s=(names.class==Hash) \ - ? names[:name_str] \ + ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.editor' @@ -315,18 +315,18 @@ module SiSU_Param end def editor_detail names=@h['editor'] \ - ? name_format(@h['editor']) \ + ? name_format(@h['editor']) : nil (names.class==Hash) \ - ? names[:name_a_h] \ + ? names[:name_a_h] : nil end def contributor names=@h['contributor'] \ - ? name_format(@h['contributor']) \ + ? name_format(@h['contributor']) : nil s=(names.class==Hash) \ - ? names[:name_str] \ + ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.author' @@ -336,18 +336,18 @@ module SiSU_Param end def contributor_detail names=@h['contributor'] \ - ? name_format(@h['contributor']) \ + ? name_format(@h['contributor']) : nil (names.class==Hash) \ - ? names[:name_a_h] \ + ? names[:name_a_h] : nil end def illustrator names=@h['illustrator'] \ - ? name_format(@h['illustrator']) \ + ? name_format(@h['illustrator']) : nil s=(names.class==Hash) \ - ? names[:name_str] \ + ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.illustrator' @@ -357,18 +357,18 @@ module SiSU_Param end def illustrator_detail names=@h['illustrator'] \ - ? name_format(@h['illustrator']) \ + ? name_format(@h['illustrator']) : nil (names.class==Hash) \ - ? names[:name_a_h] \ + ? names[:name_a_h] : nil end def photographer names=@h['photographer'] \ - ? name_format(@h['photographer']) \ + ? name_format(@h['photographer']) : nil s=(names.class==Hash) \ - ? names[:name_str] \ + ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.photographer' @@ -378,18 +378,18 @@ module SiSU_Param end def photographer_detail names=@h['photographer'] \ - ? name_format(@h['photographer']) \ + ? name_format(@h['photographer']) : nil (names.class==Hash) \ - ? names[:name_a_h] \ + ? names[:name_a_h] : nil end def translator names=@h['translator'] \ - ? name_format(@h['translator']) \ + ? name_format(@h['translator']) : nil s=(names.class==Hash) \ - ? names[:name_str] \ + ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.translator' @@ -399,18 +399,18 @@ module SiSU_Param end def translator_detail names=@h['translator'] \ - ? name_format(@h['translator']) \ + ? name_format(@h['translator']) : nil (names.class==Hash) \ - ? names[:name_a_h] \ + ? names[:name_a_h] : nil end def audio names=@h['audio'] \ - ? name_format(@h['audio']) \ + ? name_format(@h['audio']) : nil s=(names.class==Hash) \ - ? names[:name_str] \ + ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.audio' @@ -420,18 +420,18 @@ module SiSU_Param end def audio_detail names=@h['audio'] \ - ? name_format(@h['audio']) \ + ? name_format(@h['audio']) : nil (names.class==Hash) \ - ? names[:name_a_h] \ + ? names[:name_a_h] : nil end def digitized_by names=@h['digitized_by'] \ - ? name_format(@h['digitized_by']) \ + ? name_format(@h['digitized_by']) : nil s=(names.class==Hash) \ - ? names[:name_str] \ + ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.digitized_by' @@ -441,18 +441,18 @@ module SiSU_Param end def digitized_by_detail names=@h['digitized_by'] \ - ? name_format(@h['digitized_by']) \ + ? name_format(@h['digitized_by']) : nil (names.class==Hash) \ - ? names[:name_a_h] \ + ? names[:name_a_h] : nil end def prepared_by names=@h['prepared_by'] \ - ? name_format(@h['prepared_by']) \ + ? name_format(@h['prepared_by']) : nil s=(names.class==Hash) \ - ? names[:name_str] \ + ? names[:name_str] : nil s=if s l,n=Db[:col_name],'creator.prepared_by' @@ -462,11 +462,11 @@ module SiSU_Param end def prepared_by_detail names=@h['prepared_by'] \ - ? name_format(@h['prepared_by']) \ + ? name_format(@h['prepared_by']) : nil names=name_format(@h['prepared_by']) (names.class==Hash) \ - ? names[:name_a_h] \ + ? names[:name_a_h] : nil end self @@ -491,35 +491,35 @@ module SiSU_Param end def translation s=@h['translation'] \ - ? @h['translation'] \ + ? @h['translation'] : nil l,n=Db[:col_info_note],'rights.copyright.translation' validate_length(s,l,n) end def illustrations s=@h['illustrations'] \ - ? @h['illustrations'] \ + ? @h['illustrations'] : nil l,n=Db[:col_info_note],'rights.copyright.illustrations' validate_length(s,l,n) end def photographs s=@h['photographs'] \ - ? @h['photographs'] \ + ? @h['photographs'] : nil l,n=Db[:col_info_note],'rights.copyright.photographs' validate_length(s,l,n) end def digitization s=@h['digitization'] \ - ? @h['digitization'] \ + ? @h['digitization'] : nil l,n=Db[:col_info_note],'rights.copyright.digitization' validate_length(s,l,n) end def audio s=@h['audio'] \ - ? @h['audio'] \ + ? @h['audio'] : nil l,n=Db[:col_info_note],'rights.copyright.audio' validate_length(s,l,n) @@ -528,7 +528,7 @@ module SiSU_Param end def license s=@h['license'] \ - ? @h['license'] \ + ? @h['license'] : nil l,n=Db[:col_info_note],'rights.license' validate_length(s,l,n) @@ -752,7 +752,7 @@ module SiSU_Param end def breaks pagebreaks=((@h['breaks'] =~/;/) \ - ? (@h['breaks'].split(/;\s*/)) \ + ? (@h['breaks'].split(/;\s*/)) : [ @h['breaks'] ]) page_new,page_break=nil,nil pagebreaks.each do |x| @@ -764,7 +764,7 @@ module SiSU_Param def language l=if @h['language'] && (@h['language']=~/\S{2,}/) ((@h['language'] =~/,/) \ - ? (@h['language'].split(/,\s*/)) \ + ? (@h['language'].split(/,\s*/)) : [ @h['language'] ]) else [ 'en' ] end @@ -812,7 +812,7 @@ module SiSU_Param end def texpdf_font @h['texpdf_font'] && (@h['texpdf_font']=~/\S{3,}/) \ - ? @h['texpdf_font'] \ + ? @h['texpdf_font'] : @env.font.texpdf end def skin @@ -939,7 +939,7 @@ module SiSU_Param @authors,@topic_register_array,@papersize_array=[],[],[] @lvs=[nil,0,0,0,0,0,0] @lang_code_insert=(@opt.dir_structure_by =~/language/) \ - ? '' \ + ? '' : ".#{@opt.lng}" @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/ @@ -1028,7 +1028,7 @@ module SiSU_Param sv=(@opt.cmd =~/[VMv]/) ? ("SiSU version (#{@sisu_version[:version]})") : '' s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\-\S+)?$/)[1..3] tell=(@markup_version_declared.to_f==@markup_version.determined) \ - ? SiSU_Screen::Ansi.new(@opt.cmd,"Markup version (#{@markup_version.series} version #{@markup_version.determined})",sv) \ + ? SiSU_Screen::Ansi.new(@opt.cmd,"Markup version (#{@markup_version.series} version #{@markup_version.determined})",sv) : SiSU_Screen::Ansi.new(@opt.cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version.series} version #{@markup_version.determined})",sv) ok=if s_a.to_i > sm_a.to_i true @@ -1139,7 +1139,7 @@ module SiSU_Param if defined? @make.manpage \ and @make.manpage @man_section=(defined? @make.manpage.section) \ - ? @make.manpage.section \ + ? @make.manpage.section : 1 end end @@ -1332,7 +1332,7 @@ module SiSU_Param @filesize=(File.size(fn)).to_s if @sys.openssl !=false skin=@doc_skin \ - ? (SiSU_Env::Info_skin.new(@opt,@doc_skin).select) \ + ? (SiSU_Env::Info_skin.new(@opt,@doc_skin).select) : SiSU_Env::Info_skin.new(@opt).select @dgst,@dgst_skin=[],[] if @env.digest.type =~/sha256/ diff --git a/lib/sisu/v3/plaintext.rb b/lib/sisu/v3/plaintext.rb index aee1e56f..9a426acb 100644 --- a/lib/sisu/v3/plaintext.rb +++ b/lib/sisu/v3/plaintext.rb @@ -84,10 +84,10 @@ module SiSU_Plaintext unless @opt.cmd =~/q/ path=env.path.output_tell tool=(@opt.cmd =~/[MVv]/) \ - ? "#{env.program.text_editor} #{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}" \ + ? "#{env.program.text_editor} #{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool).green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}").flow if @opt.cmd =~/[MV]/ end @@ -152,7 +152,7 @@ module SiSU_Plaintext notes=@n.flatten notes.each do |e| util=(e.to_s =~/^\[[\d*+]+\]:/) \ - ? (SiSU_text_utils::Wrap.new(e.to_s,@wrap_width,4,1)) \ + ? (SiSU_text_utils::Wrap.new(e.to_s,@wrap_width,4,1)) : (SiSU_text_utils::Wrap.new(e.to_s,@wrap_width,1,1)) wrap=util.line_wrap if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v3/po4a.rb index a1f4991a..d5c6109b 100644 --- a/lib/sisu/v3/po4a.rb +++ b/lib/sisu/v3/po4a.rb @@ -106,10 +106,10 @@ module SiSU_po4a unless @opt.cmd =~/q/ path=env.path.output_tell tool=(@opt.cmd =~/[MVv]/) \ - ? "#{env.program.text_editor} #{path}/#{md.fnb}/#{md.fn[:plain]}" \ + ? "#{env.program.text_editor} #{path}/#{md.fnb}/#{md.fn[:plain]}" : @opt.fns @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Pot po4a',tool).green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Pot po4a',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'Pot po4a',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{md.fnb}/#{md.fn[:plain]}").flow if @opt.cmd =~/[MV]/ end @@ -165,7 +165,7 @@ module SiSU_po4a def initialize(fn,data_src,data_trn,md_src,md_trn,wrap_width) @fn,@data_src,@data_trn,@md_src,@md_trn,@wrap_width=fn,data_src,data_trn,md_src,md_trn,wrap_width @md=(md_trn.nil?) \ - ? md_src \ + ? md_src : md_trn @brace_url=SiSU_Viz::Skin.new.url_decoration @vz=SiSU_Env::Get_init.instance.skin @@ -712,7 +712,7 @@ GSUB #@endnotes,@copen,@pot_contents_close=Array.new(3){[]} a_l=if data_trn a_l=(data_src.length >= data_trn.length) \ - ? data_src.length \ + ? data_src.length : data_trn.length else data_src.length @@ -720,7 +720,7 @@ GSUB s,t=0,0 if @md.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/ (data_trn.nil?) \ - ? pot_metadata_src \ + ? pot_metadata_src : pot_metadata_src_trn end 0.upto(a_l-1) do |i| @@ -925,7 +925,7 @@ GSUB end def po4a #%pot output file_pot=(@md.opt.f_pth[:lng] ==opt.lng_base) \ - ? @file.write_file.pot \ + ? @file.write_file.pot : @file.write_file.po @sisu=[] emptyline=0 diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb index b31bc7a5..fe9ca432 100644 --- a/lib/sisu/v3/qrcode.rb +++ b/lib/sisu/v3/qrcode.rb @@ -84,7 +84,7 @@ module SiSU_QRcode unless @opt.cmd =~/q/ url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'QR code',"#{xbrowser} #{url_html}").green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'QR code',"#{xbrowser} #{url_html}").green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'QR code',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i end diff --git a/lib/sisu/v3/share_src.rb b/lib/sisu/v3/share_src.rb index f1703b37..17641815 100644 --- a/lib/sisu/v3/share_src.rb +++ b/lib/sisu/v3/share_src.rb @@ -73,7 +73,7 @@ module SiSU_Markup def read unless @opt.cmd =~/q/ @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns).green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,"Copy sisu markup file to output directory","#{@opt.fns} -> #{@file.output_path.src.dir}").warn if @opt.cmd =~/[MVv]/ end diff --git a/lib/sisu/v3/sisupod_make.rb b/lib/sisu/v3/sisupod_make.rb index f54f43d9..9c280df5 100644 --- a/lib/sisu/v3/sisupod_make.rb +++ b/lib/sisu/v3/sisupod_make.rb @@ -87,7 +87,7 @@ module SiSU_Doc def read unless @opt.cmd =~/q/ @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (zip)',@opt.fns).green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (zip)',@opt.fns).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (zip)',@opt.fns).green_title_hi end unless @opt.fns.empty? @@ -171,7 +171,7 @@ module SiSU_Doc @rgx_skin=/^\s+:skin:\s+(\S+)/ @rgx_doc_import=/^%\s\s*\|(\S+?\.ss[ti])\|@\|\^\|>>ok/ use_file=@opt.fns =~/(?:\.ssm|\.ssm\.sst)$/ \ - ? "#{@env.processing_path.composite_file}/#{@opt.fnb}.ssm.sst" \ + ? @opt.fns.gsub(/\.ssm\.sst$/,'.ssm') : @opt.fns file_array=IO.readlines(use_file,'') skin,images,doc_import=[],[],[] diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index f5d14583..070ba4f8 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -218,10 +218,10 @@ module SiSU_Env stub_pwd=@@pwd[m,1] @@rc_path=["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] @@yamlrc_path=(stub_pwd !~/^sisupod$/) \ - ? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]) \ + ? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]) : ["#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] #security policy: prevent reading of sisurc.yml in sisupod @@ad_path=(stub_pwd !~/^sisupod$/) \ - ? (["#{@@pwd}/_sisu/skin/yml","#{@@home}/.sisu/skin/yml","#{@@sisu_etc}/skin/yml"]) \ + ? (["#{@@pwd}/_sisu/skin/yml","#{@@home}/.sisu/skin/yml","#{@@sisu_etc}/skin/yml"]) : ["#{@@home}/.sisu",@@sisu_etc] attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:yamlrc_path,:ad_path def initialize @@ -251,7 +251,7 @@ module SiSU_Env require @prog else @mandatory \ - ? (SiSU_Screen::Ansi.new(@cmd,"module required: #{@prog}").warn) \ + ? (SiSU_Screen::Ansi.new(@cmd,"module required: #{@prog}").warn) : (SiSU_Screen::Ansi.new(@cmd,"#{@prog} load requested").warn) end load_prog @@ -691,14 +691,14 @@ module SiSU_Env db_name="#{Db[:name_prefix]}#{dbname_stub}" program_ref="\n\t\tcreatedb dbname #{db_name} #for postgresql database creation" (program_found?(program)) \ - ? system("#{program} #{dbname_name}") \ + ? system("#{program} #{dbname_name}") : (puts "\tWARN: #{program} is not available #{program_ref}") end def relaxng(cmd='') #trang - convert between different schema languages for XML program='trang' program_ref="\n\t\tsee " (program_found?(program)) \ - ? system("#{program} #{@input} #{@output}") \ + ? system("#{program} #{@input} #{@output}") : (puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/) end def qrencode #qrcode - for generating QR code @@ -708,7 +708,7 @@ module SiSU_Env found \ ? (system(%{ echo "#{@input}" | #{program} -s 3 -o #{@output} - })) \ + })) : (puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/) #found end @@ -730,7 +730,7 @@ module SiSU_Env program=@prog.tidy program_ref="\n\t\tsee " (program_found?(program)) \ - ? system("#{@prog.tidy} -xml #{@input} > #{@output}") \ + ? system("#{@prog.tidy} -xml #{@input} > #{@output}") : (puts "\tWARN: #{program} is not installed #{program_ref}") end def tex2pdf_engine @@ -759,11 +759,11 @@ module SiSU_Env texpdf_cmd=case texpdf when /xetex/ @input =~/landscape\.tex$/ \ - ? %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize} -l" #{@input} #{tell}\n} \ + ? %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize} -l" #{@input} #{tell}\n} : %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n} when /xelatex/ @input =~/landscape\.tex$/ \ - ? %{#{texpdf} -interaction=#{mode} -papersize="#{papersize} -l" #{@input} #{tell}\n} \ + ? %{#{texpdf} -interaction=#{mode} -papersize="#{papersize} -l" #{@input} #{tell}\n} : %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n} when /pdftex/; "#{texpdf} -interaction=#{mode} -fmt=pdflatex #{@input} #{tell}\n" when /pdflatex/; "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n" @@ -776,7 +776,7 @@ module SiSU_Env program='makeinfo' program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/" (program_found?(program)) \ - ? system("#{program} #{@input}\n") \ + ? system("#{program} #{@input}\n") : (puts "\tWARN: #{program} is not installed #{program_ref}") end def scp @@ -1016,13 +1016,13 @@ module SiSU_Env def concord_max ((defined? @rc['processing']['concord_max']) \ && @rc['processing']['concord_max']) \ - ? @rc['processing']['concord_max'] \ + ? @rc['processing']['concord_max'] : (defaults[:concord_max]) end def language_default_set #set directory (default) language ((defined? @rc['default']['language']) \ && @rc['default']['language'] =~/\S+/) \ - ? @rc['default']['language'] \ + ? @rc['default']['language'] : 'en' end def markup_emphasis @@ -1047,7 +1047,7 @@ module SiSU_Env && (@rc['default']['text_wrap'].to_s=~/\d\d+/) \ && (@rc['default']['text_wrap'].to_i > 19) \ && (@rc['default']['text_wrap'].to_i < 201)) \ - ? @rc['default']['text_wrap'].to_i \ + ? @rc['default']['text_wrap'].to_i : 78 end #def by_language? @@ -1101,13 +1101,13 @@ module SiSU_Env def html_seg_title_banner? ((defined? @rc['html']['seg_title_banner']) \ && @rc['html']['seg_title_banner']==true) \ - ? @rc['html']['seg_title_banner'] \ + ? @rc['html']['seg_title_banner'] : false end def html_quick_ref? ((defined? @rc['html']['quick_ref']) \ && @rc['html']['quick_ref']==true) \ - ? @rc['html']['quick_ref'] \ + ? @rc['html']['quick_ref'] : false end def html_minitoc? @@ -1127,13 +1127,13 @@ module SiSU_Env def odt_ocn? ((defined? @rc['odt']['ocn']) \ && @rc['odt']['ocn']==true) \ - ? @rc['odt']['ocn'] \ + ? @rc['odt']['ocn'] : false end def plaintext_ocn? ((defined? @rc['plaintext']['ocn']) \ && @rc['plaintext']['ocn']==true) \ - ? @rc['plaintext']['ocn'] \ + ? @rc['plaintext']['ocn'] : false end def widget #needs (md) #move @@ -1222,7 +1222,7 @@ module SiSU_Env db=if rc['search']['sisu']['flag']==true \ and rc['search']['sisu']['db']=~/\S+/ (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ - ? rc['search']['sisu']['db'] \ + ? rc['search']['sisu']['db'] : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" else nil end @@ -1279,7 +1279,7 @@ WOK db=if rc['search']['sisu']['flag']==true \ and rc['search']['sisu']['db']=~/\S+/ (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ - ? rc['search']['sisu']['db'] \ + ? rc['search']['sisu']['db'] : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" else nil end @@ -1376,7 +1376,7 @@ WOK and rc['search']['sisu']['flag']==true db=if rc['search']['sisu']['db']=~/\S+/ (rc['search']['sisu']['db']=~/^#{Db[:name_prefix]}\S+/) \ - ? rc['search']['sisu']['db'] \ + ? rc['search']['sisu']['db'] : "#{Db[:name_prefix]}#{rc['search']['sisu']['db']}" else nil end @@ -1449,7 +1449,7 @@ WOK def texpdf (defined? @rc['default']['texpdf_font']) \ && (@rc['default']['texpdf_font']=~/\S{3,}/) \ - ? @rc['default']['texpdf_font'] \ + ? @rc['default']['texpdf_font'] : 'Liberation Sans' #'Liberation Sans' #'Liberation Serif' end self @@ -1601,7 +1601,7 @@ WOK end def man #check use (defined? @rc['webserv']['man']) \ - ? "#{webserv}/#{@rc['webserv']['man']}" \ + ? "#{webserv}/#{@rc['webserv']['man']}" : defaults[:webserv_man] end def webserv_path #testing, check need, remove @@ -1658,7 +1658,7 @@ WOK end def feed (defined? @rc['webserv']['feed']) \ - ? ("#{public_output}/#{@rc['webserv']['feed']}") \ + ? ("#{public_output}/#{@rc['webserv']['feed']}") : (defaults[:webserv_feed]) end def feed_home @@ -1670,12 +1670,12 @@ WOK end def cgi (defined? @rc['webserv']['cgi']) \ - ? "#{@rc['webserv']['cgi']}" \ + ? "#{@rc['webserv']['cgi']}" : (defaults[:webserv_cgi]) end def php (defined? @rc['webserv']['php']) \ - ? "#{public_output}/#{@rc['webserv']['php']}" \ + ? "#{public_output}/#{@rc['webserv']['php']}" : (defaults[:webserv_php]) end # programs @@ -1764,7 +1764,7 @@ WOK end def stub_dir (usr_dir?) \ - ? ("#{root_dir}/#{user}/#{stub_pwd}") \ + ? ("#{root_dir}/#{user}/#{stub_pwd}") : ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path] end def processing #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc) @@ -1822,7 +1822,7 @@ WOK and not @rc['git']['dir'].nil? \ and not @rc['git']['dir'].empty? x=(@rc['git']['dir'] =~/^(?:~|home)$/) \ - ? home + '/' + 'sisu:' \ + ? home + '/' + 'sisu:' : @rc['git']['dir'] + '/' + 'sisu:' else defaults[:processing_git] end @@ -2223,7 +2223,7 @@ WOK def pdf_viewer ((defined? @rc['program_select']['pdf_viewer']) \ && @rc['program_select']['pdf_viewer'] =~/\S\S+/) \ - ? @rc['program_select']['pdf_viewer'] \ + ? @rc['program_select']['pdf_viewer'] : 'pdf-viewer' #'evince' end def web_browser @@ -2255,13 +2255,13 @@ WOK def epub_viewer ((defined? @rc['program_select']['epub_viewer']) \ && @rc['program_select']['epub_viewer'] =~/\S\S+/) \ - ? @rc['program_select']['epub_viewer'] \ + ? @rc['program_select']['epub_viewer'] : 'ebook-viewer' #'calibre' 'fbreader' end def xml_viewer ((defined? @rc['program_select']['xml_viewer']) \ && @rc['program_select']['xml_viewer'] =~/\S\S+/) \ - ? @rc['program_select']['xml_viewer'] \ + ? @rc['program_select']['xml_viewer'] : text_editor end def xml_editor @@ -2270,7 +2270,7 @@ WOK def odf_viewer ((defined? @rc['program_select']['odf_viewer']) \ && @rc['program_select']['odf_viewer'] =~/\S\S+/) \ - ? @rc['program_select']['odf_viewer'] \ + ? @rc['program_select']['odf_viewer'] : 'lowriter' #'odf-viewer','oowriter' end def manpage_viewer @@ -2279,13 +2279,13 @@ WOK def manpage_generator ((defined? @rc['program_select']['man']) \ && @rc['program_select']['man'] =~/\S\S+/) \ - ? @rc['program_select']['man'] \ + ? @rc['program_select']['man'] : 'nroff -man' #'nroff -man' #'groff -man -Tascii' end def texinfo ((defined? @rc['program_select']['info_viewer']) \ && @rc['program_select']['info_viewer'] =~/\S\S+/) \ - ? @rc['program_select']['info_viewer'] \ + ? @rc['program_select']['info_viewer'] : 'pinfo -f' #'pinfo -f' 'info' 'tkinfo' end def file_encoding @@ -2348,7 +2348,7 @@ WOK x=if output_dir_structure.by_language_code? (( defined? @rc['default']['language_file']) \ && @rc['default']['language_file'] != nil) \ - ? @rc['default']['language_file'] \ + ? @rc['default']['language_file'] : 1 else 0 end @@ -2376,7 +2376,7 @@ WOK end def papersize # paper settings, default overidden in param if set within document (defined? @rc['default']['papersize']) \ - ? @rc['default']['papersize'].downcase \ + ? @rc['default']['papersize'].downcase : (defaults[:papersize].downcase) end def odf_structure @@ -2473,7 +2473,7 @@ WOK super() @opt=opt #,opt.fns,opt.cmd @env=(@opt.fns && !(@opt.fns.empty?) \ - ? (SiSU_Env::Info_env.new(@opt.fns)) \ + ? (SiSU_Env::Info_env.new(@opt.fns)) : (SiSU_Env::Info_env.new('dummy.sst'))) if @opt.cmd =~/m/; @md=SiSU_Param::Parameters.new(@opt).get end @@ -2573,22 +2573,22 @@ WOK else '*' + filetypes # one relevant file type end @source_path=(@fnb && !(@fnb.empty?) \ - ? "#{@env.path.output}/#{@fnb}" \ + ? "#{@env.path.output}/#{@fnb}" : @env.path.output) @source_path_epub=(@fnb && !(@fnb.empty?) \ - ? "#{@env.path.output}/epub" \ + ? "#{@env.path.output}/epub" : @env.path.output_epub) @source_path_src=(@fnb && !(@fnb.empty?) \ - ? "#{@env.path.output}/src" \ + ? "#{@env.path.output}/src" : @env.path.output_src) @source_path_pod=(@fnb && !(@fnb.empty?) \ - ? "#{@env.path.output}/pod" \ + ? "#{@env.path.output}/pod" : @env.path.output_pod) @source_path_harvest=(@fnb && !(@fnb.empty?) \ - ? "#{@env.path.output}/manifest" \ + ? "#{@env.path.output}/manifest" : @env.path.output_harvest) @local_sisu_source=(@filetypes =~/\S/) \ - ? "#{@source_path}/#{@filetypes}" \ + ? "#{@source_path}/#{@filetypes}" : @source_path end end @@ -2609,7 +2609,7 @@ WOK def zap def main_output (@zap !~/\/\//) \ - ? (rm_rf(@zap) if FileTest.directory?(@zap)) \ + ? (rm_rf(@zap) if FileTest.directory?(@zap)) : (puts 'suspect zap request, ignored') end def site_map @@ -2687,32 +2687,32 @@ WOK def rhost def r1 (defined? SiSU_Env::Info_remote_host.new.remote_host[0][:name]) \ - ? (SiSU_Env::Info_remote_host.new.remote_host[0][:name]) \ + ? (SiSU_Env::Info_remote_host.new.remote_host[0][:name]) : nil end def r2 (defined? SiSU_Env::Info_remote_host.new.remote_host[1][:name]) \ - ? (SiSU_Env::Info_remote_host.new.remote_host[1][:name]) \ + ? (SiSU_Env::Info_remote_host.new.remote_host[1][:name]) : nil end def r3 (defined? SiSU_Env::Info_remote_host.new.remote_host[2][:name]) \ - ? (SiSU_Env::Info_remote_host.new.remote_host[2][:name]) \ + ? (SiSU_Env::Info_remote_host.new.remote_host[2][:name]) : nil end def r4 (defined? SiSU_Env::Info_remote_host.new.remote_host[3][:name]) \ - ? (SiSU_Env::Info_remote_host.new.remote_host[3][:name]) \ + ? (SiSU_Env::Info_remote_host.new.remote_host[3][:name]) : nil end def r5 (defined? SiSU_Env::Info_remote_host.new.remote_host[4][:name]) \ - ? (SiSU_Env::Info_remote_host.new.remote_host[4][:name]) \ + ? (SiSU_Env::Info_remote_host.new.remote_host[4][:name]) : nil end def r6 (defined? SiSU_Env::Info_remote_host.new.remote_host[5][:name]) \ - ? (@ls + SiSU_Env::Info_remote_host.new.remote_host[5][:name]) \ + ? (@ls + SiSU_Env::Info_remote_host.new.remote_host[5][:name]) : nil end self @@ -3706,12 +3706,12 @@ WOK end def po #check (@fno.empty?) \ - ? (@md.fn[:po]) \ + ? (@md.fn[:po]) : (@fno + '.po') end def pot (@fno.empty?) \ - ? (@md.fn[:pot]) \ + ? (@md.fn[:pot]) : (@fno + '.pot') end def sisupod @@ -4528,14 +4528,14 @@ WOK def share_source? ((defined? @rc['db']['share_source']) \ && @rc['db']['share_source']==true) \ - ? @rc['db']['share_source'] \ + ? @rc['db']['share_source'] : false end def engine def default ((defined? @rc['db']['engine']['default']) \ && @rc['db']['engine']['default']=~/postgresql|sqlite/) \ - ? @rc['db']['engine']['default'] \ + ? @rc['db']['engine']['default'] : 'sqlite' end self @@ -4544,7 +4544,7 @@ WOK def user ((defined? @rc['db']['postgresql']['user']) \ && @rc['db']['postgresql']['user']=~/\S+/) \ - ? @rc['db']['postgresql']['user'] \ + ? @rc['db']['postgresql']['user'] : @env.user end def db #db_name @@ -4554,24 +4554,24 @@ WOK ((defined? @rc['db']['postgresql']['port']) \ && ( @rc['db']['postgresql']['port'] =~/\d+/ \ || @rc['db']['postgresql']['port'].class==Fixnum)) \ - ? @rc['db']['postgresql']['port'] \ + ? @rc['db']['postgresql']['port'] : (@defaults[:postgresql_port]) end def password ((defined? @rc['db']['postgresql']['password']) \ && @rc['db']['postgresql']['password']=~/\S+/) \ - ? @rc['db']['postgresql']['password'] \ + ? @rc['db']['postgresql']['password'] : '' end def host ((defined? @rc['db']['postgresql']['host']) \ && @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ - ? @rc['db']['postgresql']['host'] \ + ? @rc['db']['postgresql']['host'] : '' end def dbi (psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ - ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}" \ + ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}" : "DBI:Pg:database=#{psql.db};port=#{psql.port}" end def conn_dbi diff --git a/lib/sisu/v3/texinfo.rb b/lib/sisu/v3/texinfo.rb index f1e3d5a2..ab1b7c98 100644 --- a/lib/sisu/v3/texinfo.rb +++ b/lib/sisu/v3/texinfo.rb @@ -98,11 +98,11 @@ module SiSU_TexInfo def song begin tool=(@opt.cmd =~/[MVv]/) \ - ? "#{@env.program.texinfo} #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.texinfo}" \ + ? "#{@env.program.texinfo} #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.texinfo}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" tell=@opt.cmd=~/[MVvz]/ \ && @opt.cmd !~/q/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'TexInfo',tool).green_hi_blue \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'TexInfo',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'TexInfo',tool).green_title_hi tell @md=SiSU_Param::Parameters.new(@opt).get diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 30775a3a..155d063a 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -308,7 +308,7 @@ module SiSU_TeX rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed sp_char=SiSU_TeX_Pdf::Special_characters.new(@md,rght.copyright.all) copymark=@md.author_copymark \ - ? '{\begin{small}\copyright\end{small}} ' \ + ? '{\begin{small}\copyright\end{small}} ' : '' copymark='Copyright {\begin{small}\copyright\end{small}} ' copyright=sp_char.special_characters_safe.gsub(/^\s*Copyright \(C\)/, copymark) diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index 76f0630a..bf1c2a37 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -559,7 +559,7 @@ module SiSU_TeX_Pdf ocn_lnk=(url=~/^\d+$/ ? url : ocn_lnk) if ocn_lnk and not ocn_lnk.empty? idx \ - ? (str.sub!(rgx_url_internal,"\\hyperlink{#{ocn_lnk}}{#{link}}")) \ + ? (str.sub!(rgx_url_internal,"\\hyperlink{#{ocn_lnk}}{#{link}}")) : (str.sub!(rgx_url_internal,"#{@brace_rel.tex_open}\\hyperlink{#{ocn_lnk}}{#{link}}#{@brace_rel.tex_close}")) else puts %{name tag: "#{url}" not found} diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index 5f9b8f00..cbb11ba5 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -274,7 +274,7 @@ module SiSU_urls unless @opt.cmd =~/q/ i="(output manifest) [#{@opt.f_pth[:lng_is]}] #{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'URLs').grey_title_hi \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'URLs').grey_title_hi : SiSU_Screen::Ansi.new(@opt.cmd,'URL',i).green_hi_blue SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").flow if @opt.cmd =~/[MVv]/ end diff --git a/lib/sisu/v3/wikispeak.rb b/lib/sisu/v3/wikispeak.rb index 72e2e2b0..5b34372a 100644 --- a/lib/sisu/v3/wikispeak.rb +++ b/lib/sisu/v3/wikispeak.rb @@ -79,7 +79,7 @@ module SiSU_Wikispeak @env=SiSU_Env::Info_env.new(@opt.fns) path=@env.path.output_tell tool=(@opt.cmd =~/[MVv]/) \ - ? "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:wiki]}" \ + ? "#{@env.program.text_editor} #{path}/#{@md.fnb}/#{@md.fn[:wiki]}" : '' SiSU_Screen::Ansi.new(@opt.cmd,'Wikispeak',tool).green_hi_blue unless @opt.cmd =~/q/ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}").flow if @opt.cmd =~/[MV]/ diff --git a/lib/sisu/v3/xhtml.rb b/lib/sisu/v3/xhtml.rb index 569b1dc3..a9d860e1 100644 --- a/lib/sisu/v3/xhtml.rb +++ b/lib/sisu/v3/xhtml.rb @@ -89,7 +89,7 @@ module SiSU_XHTML else "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" end @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XHTML',tool).colorize \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XHTML',tool).colorize : SiSU_Screen::Ansi.new(@opt.cmd,'XHTML',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"/#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").flow if @opt.cmd =~/[MV]/ end diff --git a/lib/sisu/v3/xml.rb b/lib/sisu/v3/xml.rb index 73e9345c..2328d767 100644 --- a/lib/sisu/v3/xml.rb +++ b/lib/sisu/v3/xml.rb @@ -88,7 +88,7 @@ module SiSU_XML_SAX else "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" end @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',tool).colorize \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',tool).colorize : SiSU_Screen::Ansi.new(@opt.cmd,'XML SAX',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").flow if @opt.cmd =~/[MV]/ end diff --git a/lib/sisu/v3/xml_dom.rb b/lib/sisu/v3/xml_dom.rb index 664bccdc..913de9a0 100644 --- a/lib/sisu/v3/xml_dom.rb +++ b/lib/sisu/v3/xml_dom.rb @@ -86,7 +86,7 @@ module SiSU_XML_DOM else "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" end @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',tool).colorize \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',tool).colorize : SiSU_Screen::Ansi.new(@opt.cmd,'XML DOM',tool).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").flow if @opt.cmd =~/[MV]/ end -- cgit v1.2.3