From 0bf06f64d052700d097efeca73e0f2069442e9fa Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 19 Aug 2011 06:40:31 -0400 Subject: sha256 (3.0.16) --- data/doc/sisu/CHANGELOG_v3 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 4b8a22ce..8dc4dd69 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -16,9 +16,9 @@ v3 branch once stable will supersede & replace current stable v2 branch %% 3.0.16.orig.tar.gz (2011-08-18:33/4) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.0.16-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.16.orig.tar.xz - sisu_3.0.16.orig.tar.xz - sisu_3.0.16-1.dsc - sisu_3.0.16-1.debian.tar.gz + 236864d28e471b51fda01c0ec4e33d493cfd35661474958a537a4762d16f9e93 1175492 sisu_3.0.16.orig.tar.xz + 372921a35c791f3239320f639995188b50381d9434ede343a47dcadf604ad892 1223 sisu_3.0.16-1.dsc + 71266e3693a3178832852f8a49102a5f6aca4ecbdb035f892ef57996c7945c63 287210 sisu_3.0.16-1.debian.tar.gz * epub tuning * include levels A - C as individual sections -- cgit v1.2.3 From a0354001dd320dae676231603ab09693548aa2c4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 5 Sep 2011 10:30:41 -0400 Subject: v3: 3.0.17 version & changelog "opened" --- data/doc/sisu/CHANGELOG_v3 | 10 ++++++++++ data/sisu/v3/v/version.yml | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 8dc4dd69..5e3ee8f5 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -13,7 +13,16 @@ Reverse Chronological: %% Development branch UNSTABLE v3 branch once stable will supersede & replace current stable v2 branch +%% 3.0.17.orig.tar.gz (2011-01-05:36/1) +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu-3.0.17 +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.0.17-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.17.orig.tar.xz + sisu_3.0.17.orig.tar.xz + sisu_3.0.17-1.dsc + sisu_3.0.17-1.debian.tar.gz + %% 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 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.16.orig.tar.xz 236864d28e471b51fda01c0ec4e33d493cfd35661474958a537a4762d16f9e93 1175492 sisu_3.0.16.orig.tar.xz @@ -40,6 +49,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.16.orig.tar.xz (Danish, Norwegian, Swedish) %% 3.0.15.orig.tar.gz (2011-08-08:32/1) +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu-3.0.15 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.0.15-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.15.orig.tar.xz 36ad1980667223719c800d291a6b988813b81700fcba21417060c87cf0dd6f60 1173288 sisu_3.0.15.orig.tar.xz diff --git a/data/sisu/v3/v/version.yml b/data/sisu/v3/v/version.yml index ce5605f8..fc8fa807 100644 --- a/data/sisu/v3/v/version.yml +++ b/data/sisu/v3/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 3.0.16-beta-rb1.9.2p180 -:date_stamp: 2011w33/4 -:date: "2011-08-18" +:version: 3.0.17-beta-rb1.9.2p180 +:date_stamp: 2011w36/1 +:date: "2011-09-05" :project: SiSU -- cgit v1.2.3 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 From b5712bc3650a2c2d38ec5e8e4021ff4b5965dd87 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 5 Sep 2011 10:48:00 -0400 Subject: v3: Dir.chdir, remove "system cd" (change directory) use Dir.chdir --- data/doc/sisu/CHANGELOG_v3 | 2 ++ lib/sisu/v3/epub.rb | 19 +++++++++++-------- lib/sisu/v3/git.rb | 20 +++++++++++++------- lib/sisu/v3/odf.rb | 15 +++++++++------ lib/sisu/v3/texpdf.rb | 14 +++++++++----- 5 files changed, 44 insertions(+), 26 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 6dc5857f..bebc961e 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -24,6 +24,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.17.orig.tar.xz * unix conditional tests ? : remove line break marker at end of line before :, cosmetic + * Dir.chdir, remove "system cd" (change directory) use Dir.chdir + %% 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/epub.rb b/lib/sisu/v3/epub.rb index 42bc6cd9..12ec1ce0 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -670,14 +670,17 @@ module SiSU_EPUB end def output_zip mkdir_p(@md.file.output_path.epub.dir) unless FileTest.directory?(@md.file.output_path.epub.dir) - system(" - cd #{@md.env.processing_path.epub} - zip -qXr9D #{@epub_doc} * - mv #{@epub_doc} #{@md.file.place_file.epub.dir} - cd #{Dir.pwd} - ") - unless @md.opt.cmd.inspect =~/M/ - system("rm -r #{@md.env.processing_path.epub}") + if FileTest.directory?(@md.env.processing_path.epub) + pwd=Dir.pwd + Dir.chdir(@md.env.processing_path.epub) + system(" + zip -qXr9D #{@epub_doc} * + mv #{@epub_doc} #{@md.file.place_file.epub.dir} + ") + Dir.chdir(pwd) + unless @md.opt.cmd.inspect =~/M/ + system("rm -r #{@md.env.processing_path.epub}") + end end end def segtoc diff --git a/lib/sisu/v3/git.rb b/lib/sisu/v3/git.rb index 322b5846..2e76fa4a 100644 --- a/lib/sisu/v3/git.rb +++ b/lib/sisu/v3/git.rb @@ -136,16 +136,22 @@ module SiSU_Git end def git_init unless FileTest.directory?("#{@git_path[:fnb]}/.git") - system("cd #{@git_path[:fnb]}\ - && git init - ") + pwd=Dir.pwd + Dir.chdir(@git_path[:fnb]) + system("git init ") + Dir.chdir(pwd) end end def git_commit - system("cd #{@git_path[:fnb]} \ - && git add . \ - && git commit -a - ") + if FileTest.directory?("#{@git_path[:fnb]}") + pwd=Dir.pwd + Dir.chdir(@git_path[:fnb]) + system(" + git add . \ + && git commit -a + ") + Dir.chdir(pwd) + end end def populate def identify_language_versions diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index 8ff98db5..1919fa08 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -714,12 +714,15 @@ module SiSU_ODF od.close opendoc=@md.fn[:odf] mkdir_p(@md.file.output_path.odt.dir) unless FileTest.directory?(@md.file.output_path.odt.dir) - system(" - cd #{@env.processing_path.odf} - zip -qr #{opendoc} * - mv #{opendoc} #{@md.file.place_file.odt.dir} - cd #{Dir.pwd} - ") + if FileTest.directory?(@env.processing_path.odf) + pwd=Dir.pwd + Dir.chdir(@env.processing_path.odf) + system(" + zip -qr #{opendoc} * + mv #{opendoc} #{@md.file.place_file.odt.dir} + ") + Dir.chdir(pwd) + end end end end diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 155d063a..ab7995f4 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -238,11 +238,15 @@ module SiSU_TeX "#{@md.fnb}.portrait.pdf" else 'portrait.pdf' end - system(" - cd #{@md.file.output_path.pdf.dir} - rm #{mklnk} - ln -s #{pdf_p} #{mklnk} - ") + if FileTest.directory?(@md.file.output_path.pdf.dir) + pwd=Dir.pwd + Dir.chdir(@md.file.output_path.pdf.dir) + system(" + rm #{mklnk} + ln -s #{pdf_p} #{mklnk} + ") + Dir.chdir(pwd) + end end if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_l}") mklnk=if @md.file.output_dir_structure.by_language_code? \ -- cgit v1.2.3 From 22f6ac004b2b86d8554ddbc5650aa3f11d348d90 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 5 Sep 2011 11:04:42 -0400 Subject: v3: sisupod_v3 make (build); place (rsync); process (generate sisu output from) * sisupod v3 * modify pod dir structure, place sisu source in dir/[lang_code]/ e.g. dir/en/ * use tar.xz (.txz) * bundle all language version in pod * bundle .ssm and all included files for each selected language (rather than composited .ssm.sst file) (filename pattern) or named in files to be processed string * remote placement * sisu processing from sisupod v3 * rsync sisupod v3 * sysenv, check that tree is available and use as desired when available --- data/doc/sisu/CHANGELOG_v3 | 17 +++ lib/sisu/v3/hub.rb | 52 ++++++--- lib/sisu/v3/manifest.rb | 8 +- lib/sisu/v3/options.rb | 21 +++- lib/sisu/v3/remote.rb | 7 +- lib/sisu/v3/sisupod_make.rb | 194 +++++++++++++++++++------------- lib/sisu/v3/sysenv.rb | 261 +++++++++++++++++++++++++++++++++----------- 7 files changed, 394 insertions(+), 166 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index bebc961e..6749a23e 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -21,6 +21,23 @@ 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 + * sisupod v3 + * modify pod dir structure, place sisu source in dir/[lang_code]/ e.g. dir/en/ + * use tar.xz (.txz) + * bundle all language version in pod + * bundle .ssm and all included files for each selected language (rather + than composited .ssm.sst file) + * [DO] prioritize and warn where duplicate files in directory + * [DO] ideally, allow selection those files selected in command line using -G + (filename pattern) or named in files to be processed string + * remote placement + * sisu processing from sisupod v3 + * [DO] sisu processing from sisupod v2 (retain possibility) + + * rsync sisupod v3 + + * sysenv, check that tree is available and use as desired when available + * unix conditional tests ? : remove line break marker at end of line before :, cosmetic diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 5e288b96..029c2861 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -70,16 +70,27 @@ module SiSU end def pod_output(fns_pod) dir_pwd=@@env.path.pwd - dir_pod=@@env.sisupod_gen(fns_pod) - Dir.chdir(dir_pod) - content=Dir.glob("*.ss[mt]").join(' ') - if content =~/\.ss[mt]/ - Dir.chdir(dir_pwd) - @opt.fns=content #check - system("cd #{dir_pod} - sisu -CC #{@opt.cmd} #{@opt.mod.join(' ')} #{content} - cd - + dir_pod=@@env.sisupod_gen_v3(fns_pod) + Dir.chdir("#{dir_pod}/doc") + #system("ls") + files=Dir['*/*.ss[tm]'] + files_ssm=Dir['*/*.ssm'] + files_sst=Dir['*/*.sst'] + content=if files_ssm.length > 0 + files_ssm.join(' ') + elsif files_sst.length > 0 + files_sst.join(' ') + else + p 'no files found' + end + @opt.fns=content #check + if FileTest.directory?("#{dir_pod}/doc") + Dir.chdir("#{dir_pod}/doc") + system(" + sisu3 -CC #{@opt.cmd} #{@opt.mod.join(' ')} #{content} + #sisu3 -CC #{@opt.cmd} -G #{@opt.mod.join(' ')} #{content} ") + Dir.chdir(dir_pwd) end @pwd=`pwd`.strip Dir.chdir(@pwd) @@ -92,10 +103,15 @@ module SiSU if not @opt.files.empty? @opt.files.each_with_index do |fns,i| env=SiSU_Env::Info_env.new(fns) - if fns =~ /sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip|\.ssp)$/ + if fns =~ /sisupod(?:\.txz)?|\S+?(?:\.ss[mt]\.txz|\.ssp)$/ # env=SiSU_Env::Info_env.new(fns) require_relative 'remote' # remote.rb #check - pod_name=SiSU_Remote::Remote_download.new(fns).pod.name + pod_name=if fns =~ /http:\/\/\S+?(?:\.ss[mt]\.txz|\.ssp)$/ + SiSU_Remote::Remote_download.new(fns).pod.name + else + re_p=/(\S+?\.ss[mt](?:\.txz)?)$/ + re_p.match(fns).captures.join + end SiSU_Screen::Ansi.new(@opt.cmd,pod_name).puts_blue unless @opt.cmd =~/q/ @opt.files.shift pod_output(pod_name) @@ -317,7 +333,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ path[:xsd]=path[:xml] + '/xsd' path[:xsd]=path[:xml] + '/rnc' path[:xsd]=path[:xml] + '/rng' - re_p=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip|[^\/]+?\.ssp)$/ + re_p=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/ unless @opt.files.join(',') =~ re_p #do not mix pods with source markup files in command line unless ( FileTest.directory?(path[:css]) \ and FileTest.directory?(path[:xsd]) ) @@ -361,9 +377,10 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ begin path_image='./_sisu/processing/external_document/image' path_skin='./_sisu/processing/external_document/skin/doc' - @get_s,@get_p=[],[] + @get_s,@get_p,@get_pl=[],[],[] re_s=/((?:https?|file):\/\/\S+?\.sst)$/ - re_p=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\.ssp))/ + re_p=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/ + re_pl=/^(\/\S+?\.ss[mt]\.txz)/ @opt.files.each do |fns| if fns =~re_s @get_s << re_s.match(fns)[1] if re_s @@ -371,6 +388,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ if fns =~re_p @get_p << re_p.match(fns)[1] if re_p end + if fns =~re_pl + @get_pl << re_pl.match(fns)[1] if re_p + end end if @get_s.length > 0 #% remote markup file .sst require_relative 'remote' # remote.rb @@ -394,7 +414,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') } if @opt.act[:sisupod] #% --sisupod, -S make sisupod - op('sisupod_make','sisupod (zip)') + op('sisupod_make','sisupod (txz)') if @opt.fns=~/\.kdi._sst/ op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source end @@ -535,7 +555,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ @opt.files.each do |fns| if FileTest.file?(fns) @opt.fns=fns - unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\S+?\.ssp)$/ + unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\S+?\.ssp)$/ if @opt.cmd.inspect=~/-P/ elsif @opt.fns=~/\.kdi$/ \ and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/ diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index d4e150f0..3b34d0b2 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -456,8 +456,7 @@ WOK else if FileTest.file?(@f.place_file.src.dir)==true pth=@f.output_path.src.dir - rel=@f.output_path.src.rel - #rel=@f.output_path.src.rel_sm + rel=@f.output_path.src.rel_sm url=@f.output_path.src.url id,file='Markup (SiSU source)',@f.base_filename.src summarize_sources(id,file,pth,rel,url) @@ -465,10 +464,9 @@ WOK end if FileTest.file?(@f.place_file.sisupod.dir)==true pth=@f.output_path.sisupod.dir - rel=@f.output_path.sisupod.rel - #rel=@f.output_path.sisupod.rel_sm + rel=@f.output_path.sisupod.rel_sm url=@f.output_path.sisupod.url - id,file='SiSU doc (zip)',@f.base_filename.sisupod + id,file='SiSU doc (tar.xz)',@f.base_filename.sisupod summarize_sources(id,file,pth,rel,url) end if FileTest.file?(@f.place_file.pot.dir)==true diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 77031ea4..ac31a896 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -62,9 +62,9 @@ module SiSU_commandline require_relative 'sysenv' # sysenv.rb @@base_path=nil class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:base_stub,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:lng_base,:what + attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:lng_base,:what def initialize(a) - @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@lng_base,@base_path,@base_stub='','','','','','','','','','','','','' + @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','','' @f_pths,@files,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::Info_env.new @lng_base=@env.language_default_set @@ -197,12 +197,18 @@ module SiSU_commandline a.uniq.each do |x| if x =~/^-[a-z0-5]+/i \ or x =~/^--\S+/ - if x =~/^-([a-z0-5]+)/i; c << $1 + if x =~/^-([a-z0-5]+)/i + c << $1 end - if x =~/^--\S+/; m << x + if x =~/^--\S+/ + m << x end - elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.zip|sisupod(\.zip)?)$/ - if x =~/^(?:https?|file):\/\/\S+/; f << x + elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.txz|sisupod(\.txz)?)$/ + if x =~/^(?:https?|file):\/\/\S+/ \ + or x =~/\S+?\.ss[mt]\.txz|sisupod\.txz/ \ + && FileTest.file?(x) + x=x.gsub(/^file:\/\//,'') + f << x elsif FileTest.file?(x) ### FIX pt=Pathname.new(x) @@ -586,6 +592,9 @@ module SiSU_commandline def pth @pth end + def sub_location + pth.gsub(/#{base_path}/,'') + end def lng @lng end diff --git a/lib/sisu/v3/remote.rb b/lib/sisu/v3/remote.rb index 5537d7b4..bda7529b 100644 --- a/lib/sisu/v3/remote.rb +++ b/lib/sisu/v3/remote.rb @@ -165,7 +165,6 @@ module SiSU_Remote require 'net/http' for requested_pod in get_p pod_info=Remote_download.new(requested_pod) - @opt.fns=pod_info.pod.name Net::HTTP.start(pod_info.pod.site) do |http| resp=http.get("#{pod_info.pod.path}/#{pod_info.pod.name_source}") open(pod_info.pod.name,'wb') do |file| @@ -181,12 +180,12 @@ module SiSU_Remote @requested_file=requested_file end def pod - re_p_div=/https?:\/\/([^\/]+)(\/\S+)\/(sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip)?|[^\/]+?\.ssp)$/ - re_p=/(sisupod(?:\.zip)?|\S+?\.ss[mt](?:\.zip)?|[^\/]+?\.ssp)$/ + re_p_div=/https?:\/\/([^\/]+)(\/\S+)\/(sisupod(?:\.txz)?|\S+?(?:\.ss[mt]\.txz)?|[^\/]+?\.ssp)$/ + re_p=/(sisupod(?:\.txz)?|\S+?\.ss[mt](?:\.txz)?|[^\/]+?\.ssp)$/ if @requested_file =~ re_p_div @site,@pth,@pod= re_p_div.match(@requested_file).captures elsif @requested_file =~ re_p - @pod= re_p.match(@requested_file).captures + @pod=re_p.match(@requested_file).captures.join end def site @site diff --git a/lib/sisu/v3/sisupod_make.rb b/lib/sisu/v3/sisupod_make.rb index 9c280df5..dd6c89c2 100644 --- a/lib/sisu/v3/sisupod_make.rb +++ b/lib/sisu/v3/sisupod_make.rb @@ -66,41 +66,38 @@ module SiSU_Doc require_relative 'particulars' # particulars.rb def initialize(opt) @opt=opt - m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m + m=/.+\/(?:src\/)?(\S+)/im @date=SiSU_Env::Info_date.new.dt @env=SiSU_Env::Info_env.new(@opt.fns) @ver=SiSU_Env::Info_version.instance.get_version @ans=SiSU_Response::Response.new pod_path="#{@env.processing_path.processing}/sisupod" - @v=if @opt.cmd =~/[VM]/; 'v' - else '' - end + @v=(@opt.cmd =~/[VM]/) ? 'v' : '' @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) @file=@particulars.file - @local_path="#{@file.output_path.sisupod.dir}" #@local_path="#{@env.path.output}/#{@env.fnb}" - @zipfile=if @opt.fns =~/\.ssm\.sst$/; @opt.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm') - else @opt.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1') - end + @local_path="#{@file.output_path.sisupod.dir}" + @zipfile=(@opt.fns =~/\.ssm\.sst$/) \ + ? @opt.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm') + : @opt.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1') mkdir_p(pod_path) unless FileTest.directory?(pod_path) rm_rf("#{@env.processing_path.processing}sisupod/*") if FileTest.directory?("#{@env.processing_path.processing}sisupod") end 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_title_hi + ? SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (txz)',@opt.fns).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (txz)',@opt.fns).green_title_hi end unless @opt.fns.empty? unless @opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@opt.cmd,'Make sisu document (zip) and place in output directory',"#{@opt.fns} -> file://#{@file.output_path.sisupod.dir}/#{@zipfile}.zip").warn if @opt.cmd =~/[MVv]/ + SiSU_Screen::Ansi.new(@opt.cmd,'Make sisu document (txz) and place in output directory',"#{@opt.fns} -> file://#{@file.output_path.sisupod.dir}/#{@zipfile}.txz").warn if @opt.cmd =~/[MVv]/ end directories sisupod_build - sisupod_zip - #sisupod_7zip + sisupod_xz else if @opt.cmd =~/[MVv]/ - SiSU_Screen::Ansi.new(@opt.cmd,'Make (zip) of sisu work directory',"#{@env.stub_pwd}\_#{@date}.zip").warn + SiSU_Screen::Ansi.new(@opt.cmd,'Make (zip (txz)) of sisu work directory',"#{@env.stub_pwd}\_#{@date}.txz").warn SiSU_Screen::Ansi.new(@opt.cmd,'').blue_tab end ans=@ans.response?('make sisupod of entire directory?') @@ -109,7 +106,7 @@ module SiSU_Doc end end def sisupod_zip_directory - sisupod_directory="sisupod-#{@env.stub_pwd}-#{@date}.ssp" # "sisupod-#{@env.stub_pwd}-#{@date}.zip" + sisupod_directory="sisupod-#{@env.stub_pwd}-#{@date}.ssp" unless File.symlink?('sisupod'); File.symlink(Dir.pwd,'sisupod') end re_base_dir='^sisupod/([^.][^/]*\.(ssm|ssi|sst)$|_sisu/)' @@ -131,15 +128,15 @@ module SiSU_Doc else puts "the required systemlink 'sisupod' could not be created on the current directory: remove the file or directory named 'sisupod' within #{Dir.pwd}" end if @opt.cmd =~/[MVv]/ - SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (tar gzip)',@opt.fns).green_hi_blue - SiSU_Screen::Ansi.new(@opt.cmd,'Zipped directory',sisupod_directory).warn + SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (tar xz)',@opt.fns).green_hi_blue + SiSU_Screen::Ansi.new(@opt.cmd,'Zipped directory (tgz)',sisupod_directory).warn SiSU_Screen::Ansi.new('',sisupod_directory).blue_tab end end def directories - SiSU_Env::Info_env.new.sisupod + SiSU_Env::Info_env.new.sisupod_v3(@opt) end - def select(skin='') # skin loading logic here + def select_skin(skin='') #skin loading logic here load "#{SiSU_lib}/defaults.rb" @skin={} skin_path = [ @@ -165,37 +162,59 @@ module SiSU_Doc end @skin end - def sisupod_build #see also sisupod in sysenv + def images_extract(f,images) + rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ + if f !~/^%+\s/ \ + and f =~rgx_image + images << f.scan(rgx_image).uniq + end + images.flatten + end + def sisupod_build #see also sisupod in sysenv + @pwd=Dir.pwd @rgx_rb_image=/["'](\S+?\.(?:png|jpg|gif))["']/ @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/ @rgx_skin=/^\s+:skin:\s+(\S+)/ - @rgx_doc_import=/^%\s\s*\|(\S+?\.ss[ti])\|@\|\^\|>>ok/ + @rgx_doc_import=/^<<\s*(\S+?\.ss[ti])/ use_file=@opt.fns =~/(?:\.ssm|\.ssm\.sst)$/ \ ? @opt.fns.gsub(/\.ssm\.sst$/,'.ssm') : @opt.fns file_array=IO.readlines(use_file,'') skin,images,doc_import=[],[],[] - file_array.each do |f| #% work area + doc_import_dir=@opt.sub_location + file_array.each do |f| #% work area if f !~/^%+\s/ skin << f.scan(@rgx_skin).uniq.flatten if f =~@rgx_skin if f !~/^%+\s/ \ and f =~@rgx_image - images << f.scan(@rgx_image).uniq + images=images_extract(f,images) + end + if use_file =~/\.ssm$/ + doc_import << f.scan(@rgx_doc_import) if f =~@rgx_doc_import + end + end + end + if doc_import.length > 0 + doc_import=doc_import.uniq.flatten + doc_import.each do |fn| + file_array=IO.readlines(fn,'') + file_array.each do |f| #% work area + if f !~/^%+\s/ \ + and f =~@rgx_image + images=images_extract(f,images) + end end - elsif f =~/^%\s/ \ - and @opt.fns =~/\.ssm\.sst$/ - doc_import << f.scan(@rgx_doc_import).uniq if f =~@rgx_doc_import end end docskin=nil if skin \ and skin.length > 0 docskin=skin.pop.flatten.join - skin_source=select(docskin) + skin_source=select_skin(docskin) else - skin_source=select + skin_source=select_skin end - docskin_place="#{@env.processing_path.processing}/sisupod/_sisu/skin/#{skin_source[:type]}" + docskin_place="#{@env.processing_path.processing}/sisupod/doc/_sisu/skin/#{skin_source[:type]}" if skin_source[:type] =~/dir/ docskin_with_path="#{docskin_place}/skin_#{@env.stub_pwd}.rb" docskin=[docskin_with_path.gsub(/.+?\/(skin_\S+?)\.rb/,'\1')] @@ -208,9 +227,9 @@ module SiSU_Doc cp_r(skin_source[:name],"#{docskin_place}/#{docskin}.rb") skinfile_array=IO.readlines(skin_source[:name],'') para_images=[] - skinfile_array.each do |f| #% work area + skinfile_array.each do |f| #% work area unless f =~/^%+ / #hmmm - images << f.scan(@rgx_rb_image).uniq if f =~@rgx_rb_image #and FileTest.file?(f.scan(@rgx_rb_image).uniq) + images << f.scan(@rgx_rb_image).uniq if f =~@rgx_rb_image #does not really discriminate, may duplicate images in sisu file, and may take images from default image pool end end @@ -224,11 +243,12 @@ module SiSU_Doc images.uniq! images.delete_if {|x| x =~/https?:\/\// } #images.sort! - image_path_pwd='_sisu/image' + path_pod="#{@env.processing_path.processing}/sisupod" path_pod_conf="#{@env.processing_path.processing}/sisupod/_sisu" - images_path_pod="#{path_pod_conf}/image" + images_path_pod="#{path_pod}/image" #unattractive hard coding ... ! - images_pwd="#{@env.path.pwd}/#{image_path_pwd}" + image_path='_sisu/image' + images_pwd="#{@env.path.pwd}/#{image_path}" ##sequence copies base images, defaults used in all html outputs #image_source_base='/usr/share/sisu/image' #dir_pwd=Dir.pwd @@ -238,58 +258,67 @@ module SiSU_Doc # cp_r(i,"#{images_path_pod}/#{i}") #end #Dir.chdir(dir_pwd) - if FileTest.directory?(image_path_pwd) + if FileTest.directory?(images_pwd) images=images.uniq images.each do |i| cp_r("#{images_pwd}/#{i}","#{images_path_pod}/#{i}") if FileTest.file?("#{images_pwd}/#{i}") end - #chmod(0755, dir_images_www) - else puts "\tWARN, did not find - #{image_path_pod}" + else puts "\tWARN, did not find - #{images_pwd} #{images_path_pod}" end end - x=@env.document_language_versions_found #check multiple document language versions (param not used) - if doc_import.flatten.length > 0 \ - and @opt.fns =~/\.ssm\.sst$/ - doc_import.flatten.each do |f| - cp_r("#{@env.path.pwd}/#{f}","#{@env.processing_path.processing}/sisupod/#{f}") + if doc_import.length > 0 \ + and use_file =~/\.ssm$/ + doc_import.each do |f| + cp_r("#{@env.path.pwd}#{doc_import_dir}/#{f}","#{@env.processing_path.processing}/sisupod/doc/#{@opt.lng}/#{f}") end end + x=@env.document_language_versions_found #check multiple document language versions (param not used) if x[:f] \ - and x[:f].length > 1 #store multiple document language versions, sisupod + and x[:f].length > 0 #store multiple document language versions, sisupod x[:f].each do |f| - cp_r("#{@env.path.pwd}/#{f}","#{@env.processing_path.processing}/sisupod/#{f}") + (use_file =~/\.ssm$/) \ + ? cp_r("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}","#{@env.processing_path.processing}/sisupod/doc/#{f[:l]}/#{f[:n]}") + : cp_r("#{@env.path.pwd}/#{f[:f]}","#{@env.processing_path.processing}/sisupod/doc/#{f[:l]}/#{f[:n]}") end - elsif @opt.fns =~/\.ssm\.sst/ - ssm=@opt.fns.gsub(/\.ssm\.sst/,'.ssm') - cp_r("#{@env.path.pwd}/#{ssm}","#{@env.processing_path.processing}/sisupod/#{ssm}") - else cp_r("#{@env.path.pwd}/#{@opt.fns}","#{@env.processing_path.processing}/sisupod/#{@opt.fns}") end #NB not all possibilies met, revisit, also in case of composite file may wish to add README end - def sisupod_7zip #look at later + def sisupod_xz mkdir_p(@file.output_path.sisupod.dir) unless FileTest.directory?(@file.output_path.sisupod.dir) - system(%{ - cd #{@env.processing_path.processing} - echo "SiSU sisupod #{@ver[:version]}" > sisu_zip.txt - #7zip -qz #{@opt.fns}.7z sisu_zip.txt < sisu_zip.txt - 7zr a -t7z -m0=lzma -mx=9 -ms=on #{@zipfile}.7z sisu_zip.txt - 7zr a -t7z -m0=lzma -mx=9 -ms=on #{@zipfile}.7z sisupod - #7zip -qr #{@zipfile}.7z sisupod - mv #{@zipfile}.7z #{@file.place_file.sisupod.dir} & - rm -r sisupod/* && cd #{@env.path.pwd} - }) - SiSU_Screen::Ansi.new('',"#{@opt.fns}.7z").blue_tab unless @opt.cmd =~/q/ + tree=(@opt.cmd =~/[vVM]/ \ + && SiSU_Env::System_call.new.program_found?('tree')) \ + ? 'tree sisupod' + : '' + if FileTest.directory?(@env.processing_path.processing) + Dir.chdir(@env.processing_path.processing) + system(%{ + #{tree} + tar -cJf #{@zipfile}.txz sisupod + #echo "#{@file.place_file.sisupod.dir}" + mv #{@zipfile}.txz #{@file.place_file.sisupod.dir} & + rm -r sisupod/* + }) + Dir.chdir(@env.path.pwd) + SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz").blue_tab unless @opt.cmd =~/q/ + else + SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz not built").blue_tab + end end def sisupod_zip mkdir_p(@file.output_path.sisupod.dir) unless FileTest.directory?(@file.output_path.sisupod.dir) - system(%{ - cd #{@env.processing_path.processing} - echo "SiSU sisupod #{@ver[:version]}" > sisu_zip.txt - zip -qz #{@zipfile}.zip sisu_zip.txt < sisu_zip.txt - zip -qr #{@zipfile}.zip sisupod - mv #{@zipfile}.zip #{@file.place_file.sisupod.dir} & - rm -r sisupod/* && cd #{@env.path.pwd} - }) - SiSU_Screen::Ansi.new('',"#{@zipfile}.zip").blue_tab if @opt.cmd =~/[MVv]/ + if FileTest.directory?(@env.processing_path.processing) + Dir.chdir(@env.processing_path.processing) + system(%{ + echo "SiSU sisupod #{@ver[:version]}" > sisu_zip.txt + zip -qz #{@zipfile}.zip sisu_zip.txt < sisu_zip.txt + zip -qr #{@zipfile}.zip sisupod + mv #{@zipfile}.zip #{@file.place_file.sisupod.dir} & + rm -r sisupod/* + }) + Dir.chdir(@env.path.pwd) + SiSU_Screen::Ansi.new('',"#{@zipfile}.zip").blue_tab if @opt.cmd =~/[MVv]/ + else + SiSU_Screen::Ansi.new('',"#{@zipfile}.zip not built").blue_tab + end end end end @@ -305,16 +334,33 @@ question?: should you permit the packing of multiple files in remove previously existing contents of _/sisu/sisupod & make directory structure: +v3 --> _sisu sisupod - sisu - content.sst [file content] - filename.sst [link to content.sst] + doc + manifest.txt + en/content.sst [file content] + fr/content.sst _sisu conf skin/ - doc [relevant skin if any other than default] - image [all images for specific document gathered here] + doc [relevant skin if any other than default] + image (ln -s ../../image) + audio (ln -s ../../audio) + video (ln -s ../../video) + image [all images for specific document gathered here] + audio + video + +v2 --> + _sisu + sisupod + content.sst [file content] + filename.sst [link to content.sst] + _sisu/ + skin/ + doc [relevant skin if any other than default] + image/ [all images for specific document gathered here] sisu _sisu diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 070ba4f8..475a8369 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -376,27 +376,17 @@ module SiSU_Env end if @fns \ and @fns != '' #watch - #if multilingual - m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ - @@fnn ||=@fns[m,1] - @@fnb ||=@fns[m,2] - @@fnt ||=@fns[m,3] - @@flv ||=document_language_versions_found[:f] - unless @@fns =~/\S+?\.zip/ - @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' - elsif @@fnb; @@fnb + '.sst.zip' - else '' # e.g. termsheet - end + m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ + @@fnn ||=@fns[m,1] + @@fnb ||=@fns[m,2] + @@fnt ||=@fns[m,3] + @@flv ||=document_language_versions_found[:f] + unless @@fns =~/\S+?\.zip/ + @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' + elsif @@fnb; @@fnb + '.sst.zip' + else '' # e.g. termsheet end - #else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/ - # @@fnb ||=@fns[m,1] - # @@fnt ||=@fns[m,2] - # unless @@fns =~/\S+?\.zip/ - # @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' - # else @@fnb + '.sst.zip' - # end - # end - #end + end end @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz end @@ -455,31 +445,52 @@ module SiSU_Env end def document_language_versions_found #REVISIT @fn={} - unless (@fns.nil? \ - or @fns.empty?) + filename=(@fns =~/\.ssm\.sst$/) \ + ? @fns.gsub(/\.ssm\.sst$/,'.ssm') + : @fns + unless (filename.nil? \ + or filename.empty?) if output_dir_structure.by_language_code? - m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/ - @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3] - else m=/(.+?)\.((?:-|ssm\.)?sst$)/ - @fn[:b]=@fn[:m]=@fns[m,1] - @fn[:t]=@fns[m,2] + m=/((.+?)(?:\~\w{2,3})?)\.(sst|ssm)$/ + @fn[:b],@fn[:m],@fn[:t]=filename[m,1],filename[m,2],filename[m,3] + else m=/(.+?)\.(sst|ssm)$/ + @fn[:b]=@fn[:m]=filename[m,1] + @fn[:t]=filename[m,2] end end + lng_base=Info_env.new.language_default_set lang=SiSU_Env::Standardise_language.new langs=lang.codes x=[] - if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}" + if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}") + n=@fn[:m].gsub(/^.+?\//,'') + n =n + '.' + @fn[:t] + x << { f: "#{@fn[:m]}.#{@fn[:t]}", l: lng_base, n: n } end - x << @fns + #x << { f: "#{@fns}", l: lng_base } langs.each do |l| lng=SiSU_Env::Standardise_language.new(l) if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") - x << "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}" + x << { f: "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code } elsif FileTest.file?("#{@fn[:m]}~#{lng.name}.#{@fn[:t]}") - x << "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}" + x << { f: "#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code } + end + if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") + if FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") + x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code } + elsif FileTest.file?("#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}") + x << { f: "#{lng.code}/#{@fn[:m]}~#{lng.name}.#{@fn[:t]}", l: lng.code } + end + end + if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") + if FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") + x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code } + elsif FileTest.file?("#{lng.code}/#{@fn[:m]}.#{@fn[:t]}") + x << { f: "#{lng.code}/#{@fn[:m]}.#{@fn[:t]}", l: lng.code } + end end end - @fn[:f]=x.uniq! + @fn[:f]=x @fn end def published_manifests?(output_base) @@ -1075,24 +1086,80 @@ module SiSU_Env def stub_pod @stub_pod end - def sisupod + def sisupod_v3(opt) #processing_path.processing # sisupod - # sisu - # content.sst [file content] - # filename.sst [link to content.sst] + # doc/ + # manifest.txt + # en/content.sst [file content] + # fr/content.sst # _sisu - # conf - # skin/ - # doc [relevant skin if any other than default] - # image [all images for specific document gathered here] + # skin/ + # doc [relevant skin if any other than default] + # image@ (ln -s ../../image) + # audio@ (ln -s ../../audio) + # video@ (ln -s ../../video) + # image/ [all images for specific document gathered here] + # audio/ + # video/ + spp="#{processing_path.processing}/sisupod" + sppc="#{spp}/doc/_sisu" + lng_dirs=[] + if FileTest.directory?(spp) \ + or FileTest.file?(spp) + rm_rf(spp) + end + paths=[] + flv=Env_call.new(opt.fns).document_language_versions_found + flv[:f].each {|l| lng_dirs << l[:l] } + lng_dirs.uniq! + lng_dirs.each do |lng| + paths << "#{spp}/doc/#{lng}" + end + paths \ + << "#{spp}/image" \ + << "#{sppc}/skin/doc" \ + << "#{sppc}/skin/dir" \ + << "#{sppc}/skin/site" + #<< "#{spp}/audio" \ + #<< "#{spp}/video" \ + paths.each do |x| + unless FileTest.directory?(x) + mkdir_p(x) + end + end + if FileTest.directory?(sppc) + pwd=Dir.pwd + Dir.chdir(sppc) + system(" + ln -s ../../image + #ln -s ../../audio + #ln -s ../../video + ") + Dir.chdir(pwd) + end + end + def sisupod_v2 + #processing_path.processing + # sisupod + # content.sst [file content] + # filename.sst [link to content.sst] + # _sisu + # skin/ + # doc [relevant skin if any other than default] + # image [all images for specific document gathered here] sisupod_processing_path="#{processing_path.processing}/sisupod" if FileTest.directory?(sisupod_processing_path) \ or FileTest.file?(sisupod_processing_path) rm_rf(sisupod_processing_path) end paths=[] - paths=["#{processing_path.processing}/sisupod/_sisu/skin/doc","#{processing_path.processing}/sisupod/_sisu/skin/dir","#{processing_path.processing}/sisupod/_sisu/skin/site","#{processing_path.processing}/sisupod/_sisu/image"] + paths=[ + "#{processing_path.processing}/sisupod/_sisu/skin/doc", + "#{processing_path.processing}/sisupod/_sisu/skin/dir", + "#{processing_path.processing}/sisupod/_sisu/skin/site", + "#{processing_path.processing}/sisupod/_sisu/image" + ] paths.each {|x| mkdir_p(x) unless FileTest.directory?(x) } end def defaults #multiple default directories @@ -2370,7 +2437,8 @@ WOK if defined? @rc['program_set']['file_encoding']; is=@rc['program_set']['encoding'] end if is.nil? \ - or is==true; is='encoding' + or is==true + is='encoding' end is end @@ -2385,6 +2453,40 @@ WOK system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d #{processing_path.odf_pth}") end def sisupod_gen(fns_pod) + sisupod_gen_v3(fns_pod) + end + def sisupod_gen_v3(fns_pod) + pwd=Dir.pwd + sisupod_processing_path="#{processing_path.processing}/sisupod" + if FileTest.directory?(sisupod_processing_path) \ + or FileTest.file?(sisupod_processing_path) + rm_rf(sisupod_processing_path) + end + unless FileTest.directory?(sisupod_processing_path) + mkdir_p(sisupod_processing_path) + end + f_pod=if FileTest.file?("#{Dir.pwd}/#{fns_pod}") + "#{Dir.pwd}/#{fns_pod}" + elsif FileTest.file?(fns_pod) + fns_pod + end + if f_pod \ + && FileTest.file?(f_pod) + tree=(SiSU_Env::System_call.new.program_found?('tree')) \ + ? "tree #{processing_path.processing}/sisupod" + : '' + if FileTest.directory?(processing_path.processing) + Dir.chdir(processing_path.processing) + system(%{tar xJf #{f_pod}}) + Dir.chdir(pwd) + end + #system(tree) #enable if (/[vVM]/) + else + SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/ + end + sisupod_processing_path + end + def sisupod_gen_v2(fns_pod) pwd=Dir.pwd sisupod_processing_path="#{processing_path.processing}/sisupod" if FileTest.directory?(sisupod_processing_path) \ @@ -3715,9 +3817,9 @@ WOK : (@fno + '.pot') end def sisupod - if @md.fns =~/\.ssm\.sst$/; @md.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm.zip') - else @md.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1.zip') - end + (@md.fns =~/\.ssm\.sst$/) \ + ? @md.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm.txz') + : @md.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1.txz') end self end @@ -3747,6 +3849,9 @@ WOK "#{output_path.base.dir}/#{@ft}" end end + def ab_pod + "#{output_path.base.dir}/#{@ft}" + end self end def url @@ -3773,6 +3878,9 @@ WOK "#{output_path.base.url}/#{@ft}" end end + def ab_pod + "#{output_path.base.url}/#{@ft}" + end self end def rel @@ -3794,13 +3902,53 @@ WOK end def ab_src if @env.output_dir_structure.by_language_code? - "../../#{@ft}/#{@md.opt.lng}" + "#{@ft}/#{@md.opt.lng}" + else + "#{@ft}" + end + end + def ab_pod + if @env.output_dir_structure.by_language_code? + "#{@ft}" else "#{@ft}" end end self end + def rel_sm + def abc + if @env.output_dir_structure.by_language_code? + "#{@md.opt.lng}/#{@ft}" + elsif @env.output_dir_structure.by_filetype? + "#{@ft}" + else + "#{@md.fnb}" + end + end + def ab + if @env.output_dir_structure.by_language_code? + "#{@md.opt.lng}/#{@ft}" + else + "#{@ft}" + end + end + def ab_src + if @env.output_dir_structure.by_language_code? + "#{@ft}/#{@md.opt.lng}" + else + "#{@ft}" + end + end + def ab_pod + if @env.output_dir_structure.by_language_code? + "../../#{@ft}/#{@md.opt.lng}" + else + "../#{@ft}" + end + end + self + end def rcp def abc if @env.output_dir_structure.by_language_code? @@ -3914,16 +4062,7 @@ WOK set_path(ft).rcp.ab_src end def rel_sm - if @env.output_dir_structure.by_language_code? - '' - #"#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}" - elsif @env.output_dir_structure.by_filetype? - '' - #"#{output_path.base.dir}/#{@ft}" - else - '' - #"#{output_path.base.dir}/#{@md.fnb}" - end + set_path(ft).rel_sm.ab_src end self end @@ -3932,19 +4071,19 @@ WOK Gt[:src] + '/' + Gt[:pod] end def dir - set_path(ft).dir.ab_src + set_path(ft).dir.ab_pod end def url - set_path(ft).url.ab_src + set_path(ft).url.ab_pod end def rel - set_path(ft).rel.ab_src + set_path(ft).rel.ab_pod end def rcp - set_path(ft).rcp.ab_src + set_path(ft).rcp.ab_pod end def rel_sm - #"#{output_path.base.rel}/pod" + set_path(ft).rel_sm.ab_pod end self end -- cgit v1.2.3