From 967a86f0fa0c96f5816dc14e3f5208b9fb21944a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 29 Aug 2014 19:31:58 -0400 Subject: v5 v6: cosmetic code --- lib/sisu/v5/se_programs.rb | 6 ++++-- lib/sisu/v5/sitemaps.rb | 6 ++++-- lib/sisu/v5/sst_to_s_xml_sax.rb | 4 ++-- lib/sisu/v5/xhtml.rb | 4 +++- lib/sisu/v5/xml_dom.rb | 4 ++-- lib/sisu/v5/xml_sax.rb | 4 ++-- lib/sisu/v6/se_programs.rb | 6 ++++-- lib/sisu/v6/sitemaps.rb | 6 ++++-- lib/sisu/v6/sst_to_s_xml_sax.rb | 4 ++-- lib/sisu/v6/xhtml.rb | 4 +++- lib/sisu/v6/xml_dom.rb | 4 ++-- lib/sisu/v6/xml_sax.rb | 4 ++-- 12 files changed, 34 insertions(+), 22 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/se_programs.rb b/lib/sisu/v5/se_programs.rb index 4eef1ce9..66d61036 100644 --- a/lib/sisu/v5/se_programs.rb +++ b/lib/sisu/v5/se_programs.rb @@ -113,8 +113,10 @@ module SiSU_Sys_Call and locale !~/utf-?8/i true else - program_ref="(not available)" unless program_found?(program) - program_ref="(UTF-8)" if locale =~/utf-?8/i + program_ref="(not available)" \ + unless program_found?(program) + program_ref="(UTF-8)" \ + if locale =~/utf-?8/i false end end diff --git a/lib/sisu/v5/sitemaps.rb b/lib/sisu/v5/sitemaps.rb index fd2d58c6..d04dd382 100644 --- a/lib/sisu/v5/sitemaps.rb +++ b/lib/sisu/v5/sitemaps.rb @@ -86,7 +86,8 @@ module SiSU_Sitemaps # @file=SiSU_Env::FileOp.new(@md) @rdf=SiSU_XML_Tags::RDF.new(@md) @fnb_utf8_xml=@md.fnb.dup - @trans.char_enc.utf8(@fnb_utf8_xml) if @sys.locale =~/utf-?8/i #% utf8 + @trans.char_enc.utf8(@fnb_utf8_xml) \ + if @sys.locale =~/utf-?8/i output_map(sitemap) elsif @opt.selections.str =~/--sitemaps/ @sitemap_idx_fn='sitemapindex.xml' @@ -144,7 +145,8 @@ module SiSU_Sitemaps WOK sitemap_files.each do |s| f=s.gsub(/.+?\/sitemap_([^\/]+?)\.xml$/,'\1') - @trans.char_enc.utf8(f) if @sys.locale =~/utf-?8/i #% utf8 + @trans.char_enc.utf8(f) \ + if @sys.locale =~/utf-?8/i sitemap_idx << < #{@env.path.url.remote}/#{f}/sitemap.xml diff --git a/lib/sisu/v5/sst_to_s_xml_sax.rb b/lib/sisu/v5/sst_to_s_xml_sax.rb index fe685983..b72868a1 100644 --- a/lib/sisu/v5/sst_to_s_xml_sax.rb +++ b/lib/sisu/v5/sst_to_s_xml_sax.rb @@ -395,8 +395,8 @@ WOK dir=SiSU_Env::InfoEnv.new @@xml[:head],@@xml[:body]=[],[] css=SiSU_Env::CSS_Select.new(@md).xml_sax - encoding=if @sys.locale =~/utf-?8/i; '' - else '' + encoding=if @sys.locale =~/utf-?8/i then '' + else '' end @@xml[:open] =<' : '' + encoding=(@sys.locale =~/utf-?8/i) \ + ? '' + : '' @@xml[:open] =<' - else '' + encoding=if @sys.locale =~/utf-?8/i then '' + else '' end @@xml[:open] =<' - else '' + encoding=if @sys.locale =~/utf-?8/i then '' + else '' end @@xml[:open] =< #{@env.path.url.remote}/#{f}/sitemap.xml diff --git a/lib/sisu/v6/sst_to_s_xml_sax.rb b/lib/sisu/v6/sst_to_s_xml_sax.rb index 0be6ffa0..a780e810 100644 --- a/lib/sisu/v6/sst_to_s_xml_sax.rb +++ b/lib/sisu/v6/sst_to_s_xml_sax.rb @@ -395,8 +395,8 @@ WOK dir=SiSU_Env::InfoEnv.new @@xml[:head],@@xml[:body]=[],[] css=SiSU_Env::CSS_Select.new(@md).xml_sax - encoding=if @sys.locale =~/utf-?8/i; '' - else '' + encoding=if @sys.locale =~/utf-?8/i then '' + else '' end @@xml[:open] =<' : '' + encoding=(@sys.locale =~/utf-?8/i) \ + ? '' + : '' @@xml[:open] =<' - else '' + encoding=if @sys.locale =~/utf-?8/i then '' + else '' end @@xml[:open] =<' - else '' + encoding=if @sys.locale =~/utf-?8/i then '' + else '' end @@xml[:open] =< Date: Fri, 29 Aug 2014 19:34:45 -0400 Subject: v5 v6: hub, sisu version info, when & what to report --- lib/sisu/v5/hub.rb | 1 + lib/sisu/v5/hub_actions.rb | 19 +++++++++++-------- lib/sisu/v5/hub_options.rb | 4 +++- lib/sisu/v6/hub.rb | 1 + lib/sisu/v6/hub_actions.rb | 19 +++++++++++-------- lib/sisu/v6/hub_options.rb | 4 +++- 6 files changed, 30 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 68db1f13..eda98084 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -207,6 +207,7 @@ module SiSU def actions_without_files actions=SiSU_Hub_Actions::HubActions.new(@opt) actions.report.version_info? + actions.report.version_dir? actions.prepare.site? actions.prepare.sql? end diff --git a/lib/sisu/v5/hub_actions.rb b/lib/sisu/v5/hub_actions.rb index 785f507e..5f99f444 100644 --- a/lib/sisu/v5/hub_actions.rb +++ b/lib/sisu/v5/hub_actions.rb @@ -72,6 +72,17 @@ module SiSU_Hub_Actions SiSU_Env::InfoAbout.new(@opt).sisu_version end end + def version_dir? + if @opt.act[:version_info][:set]==:on \ + || @opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + ' ' + File.dirname(__FILE__) + ).grey + end + end self end def prepare @@ -853,14 +864,6 @@ module SiSU_Hub_Actions end def init? SiSU_Env::InfoProcessingFlag.new - if (@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - ' ' + File.dirname(__FILE__) - ).grey - end if @opt.act[:ao][:set]==:on \ or @opt.act[:maintenance][:set]==:on #% --maintenance, -M env=SiSU_Env::InfoEnv.new(@opt.fns) diff --git a/lib/sisu/v5/hub_options.rb b/lib/sisu/v5/hub_options.rb index bc96b878..d871c9c3 100644 --- a/lib/sisu/v5/hub_options.rb +++ b/lib/sisu/v5/hub_options.rb @@ -316,7 +316,9 @@ module SiSU_Commandline c,w='','' m,f,pth,lng,lngs=[],[],[],[],[] lng_is='' - a=s.split(/\s+/) + a=(s.nil?) \ + ? ['-v'] + : s.split(/\s+/) r_l=Px[:lng_lst].join('|') a.uniq.each do |x| if x =~/^-[a-z0-5]+/i \ diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb index cd66bc17..2558a9db 100644 --- a/lib/sisu/v6/hub.rb +++ b/lib/sisu/v6/hub.rb @@ -207,6 +207,7 @@ module SiSU def actions_without_files actions=SiSU_Hub_Actions::HubActions.new(@opt) actions.report.version_info? + actions.report.version_dir? actions.prepare.site? actions.prepare.sql? end diff --git a/lib/sisu/v6/hub_actions.rb b/lib/sisu/v6/hub_actions.rb index 2be0304b..54d0ccd2 100644 --- a/lib/sisu/v6/hub_actions.rb +++ b/lib/sisu/v6/hub_actions.rb @@ -72,6 +72,17 @@ module SiSU_Hub_Actions SiSU_Env::InfoAbout.new(@opt).sisu_version end end + def version_dir? + if @opt.act[:version_info][:set]==:on \ + || @opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + ' ' + File.dirname(__FILE__) + ).grey + end + end self end def prepare @@ -853,14 +864,6 @@ module SiSU_Hub_Actions end def init? SiSU_Env::InfoProcessingFlag.new - if (@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - ' ' + File.dirname(__FILE__) - ).grey - end if @opt.act[:ao][:set]==:on \ or @opt.act[:maintenance][:set]==:on #% --maintenance, -M env=SiSU_Env::InfoEnv.new(@opt.fns) diff --git a/lib/sisu/v6/hub_options.rb b/lib/sisu/v6/hub_options.rb index 5625963b..336f0d93 100644 --- a/lib/sisu/v6/hub_options.rb +++ b/lib/sisu/v6/hub_options.rb @@ -316,7 +316,9 @@ module SiSU_Commandline c,w='','' m,f,pth,lng,lngs=[],[],[],[],[] lng_is='' - a=s.split(/\s+/) + a=(s.nil?) \ + ? ['-v'] + : s.split(/\s+/) r_l=Px[:lng_lst].join('|') a.uniq.each do |x| if x =~/^-[a-z0-5]+/i \ -- cgit v1.2.3 From 90f6210fe416897a7959a65d82b9de1cfa3bc572 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 29 Aug 2014 19:38:50 -0400 Subject: v5 v6: dp, texpdf, copyright_and_license, minor fix, used by texpdf --- lib/sisu/v5/dp.rb | 18 +++++++++++++++++- lib/sisu/v5/texpdf.rb | 5 ++--- lib/sisu/v6/dp.rb | 18 +++++++++++++++++- lib/sisu/v6/texpdf.rb | 5 ++--- 4 files changed, 38 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/dp.rb b/lib/sisu/v5/dp.rb index 33c6c565..00cf8525 100644 --- a/lib/sisu/v5/dp.rb +++ b/lib/sisu/v5/dp.rb @@ -158,9 +158,25 @@ module SiSU_Param class MdDefault def rights(author,date) @author,@date=author,date + def assignment(author) + 'copyright not explicitly stated, ' \ + + 'program "assigning" copyright to author: ' \ + + author + end def all s=nil if @author + #puts assignment(@author) + s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ + ? ("Copyright (C) #{$1} #{@author}") + : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d + end + s + end + def copyright_and_license + s=nil + if @author + #puts assignment(@author) s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ ? ("Copyright (C) #{$1} #{@author}") : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d @@ -584,7 +600,7 @@ module SiSU_Param ' \\\\ ' end def copyright_and_license - s=if @h['all'] then @h['all'] + s=if @h['copyright_and_license'] then @h['copyright_and_license'] else s='' if defined? copyright.text \ diff --git a/lib/sisu/v5/texpdf.rb b/lib/sisu/v5/texpdf.rb index c2c9dc70..e35c7ccf 100644 --- a/lib/sisu/v5/texpdf.rb +++ b/lib/sisu/v5/texpdf.rb @@ -448,10 +448,9 @@ module SiSU_TeX end if defined? @md.rights.all \ and not @md.rights.all.empty? - rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed - sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,rght.copyright.copyright_and_license) + sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.rights.copyright.copyright_and_license.dup) copymark='Copyright {\begin{small}{\copyright\end{small}} ' - #copymark='Copyright {\begin{small}^{\copyright\end{small}} ' + #copymark='Copyright {\begin{small}^{\copyright\end{small}} ' copyright=sp_char.special_characters_safe.gsub(/\s*Copyright \(C\)/, copymark) @@rights||="\n #{Tex[:backslash]*2}[3]\\ \\linebreak #{copyright}" end diff --git a/lib/sisu/v6/dp.rb b/lib/sisu/v6/dp.rb index 111896d7..595cee3e 100644 --- a/lib/sisu/v6/dp.rb +++ b/lib/sisu/v6/dp.rb @@ -158,9 +158,25 @@ module SiSU_Param class MdDefault def rights(author,date) @author,@date=author,date + def assignment(author) + 'copyright not explicitly stated, ' \ + + 'program "assigning" copyright to author: ' \ + + author + end def all s=nil if @author + #puts assignment(@author) + s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ + ? ("Copyright (C) #{$1} #{@author}") + : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d + end + s + end + def copyright_and_license + s=nil + if @author + #puts assignment(@author) s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ ? ("Copyright (C) #{$1} #{@author}") : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d @@ -584,7 +600,7 @@ module SiSU_Param ' \\\\ ' end def copyright_and_license - s=if @h['all'] then @h['all'] + s=if @h['copyright_and_license'] then @h['copyright_and_license'] else s='' if defined? copyright.text \ diff --git a/lib/sisu/v6/texpdf.rb b/lib/sisu/v6/texpdf.rb index 10bfa961..57eab29d 100644 --- a/lib/sisu/v6/texpdf.rb +++ b/lib/sisu/v6/texpdf.rb @@ -448,10 +448,9 @@ module SiSU_TeX end if defined? @md.rights.all \ and not @md.rights.all.empty? - rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed - sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,rght.copyright.copyright_and_license) + sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.rights.copyright.copyright_and_license.dup) copymark='Copyright {\begin{small}{\copyright\end{small}} ' - #copymark='Copyright {\begin{small}^{\copyright\end{small}} ' + #copymark='Copyright {\begin{small}^{\copyright\end{small}} ' copyright=sp_char.special_characters_safe.gsub(/\s*Copyright \(C\)/, copymark) @@rights||="\n #{Tex[:backslash]*2}[3]\\ \\linebreak #{copyright}" end -- cgit v1.2.3