From 02cc96fb1393812f5b35fbb6770d0469cafe07f0 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 1 Oct 2012 15:36:21 -0400 Subject: v3: cosmetic code, if, else, remove some semicolons (;) replace with newlines --- data/doc/sisu/CHANGELOG_v3 | 1 + lib/sisu/v3/cgi_sql_common.rb | 2 +- lib/sisu/v3/dal_syntax.rb | 6 ++++-- lib/sisu/v3/db_import.rb | 4 +++- lib/sisu/v3/db_select.rb | 4 +++- lib/sisu/v3/dbi_discreet.rb | 4 +++- lib/sisu/v3/epub.rb | 3 ++- lib/sisu/v3/epub_segments.rb | 3 ++- lib/sisu/v3/param.rb | 6 ++++-- lib/sisu/v3/shared_sem.rb | 6 ++++-- lib/sisu/v3/sysenv.rb | 3 ++- 11 files changed, 29 insertions(+), 13 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 08b0c846..2a1d6977 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -33,6 +33,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.3.3.orig.tar.xz * v3: cosmetic, code * true ? x : y + * if, else, remove some semicolons (;) replace with newlines * v3: sisu -v, provide version information, fix diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb index 401b67f6..7a3ba387 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v3/cgi_sql_common.rb @@ -652,7 +652,7 @@ module SiSU_CGI_SQL begin # all code goes in begin section @search={ :text => [], :endnotes => [] } q=CGI.new - @db=if cgi['db'] =~/\S+/; + @db=if cgi['db'] =~/\S+/ @stub=/#{@db_name_prefix}(\S+)/.match(cgi['db'])[1] cgi['db'] else diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb index 75bb8f53..839fb399 100644 --- a/lib/sisu/v3/dal_syntax.rb +++ b/lib/sisu/v3/dal_syntax.rb @@ -285,8 +285,10 @@ module SiSU_DAL_Syntax w=w.gsub(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end else - w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! - elsif w =~/^\/_\s+/; italicise(w) + w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/ + embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! + elsif w =~/^\/_\s+/ + italicise(w) else w end end diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb index 225e9da2..f533e7f1 100644 --- a/lib/sisu/v3/db_import.rb +++ b/lib/sisu/v3/db_import.rb @@ -73,7 +73,9 @@ module SiSU_DbImport @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX @env=SiSU_Env::InfoEnv.new(@opt.fns) @dal="#{@env.processing_path.dal}" - if @opt.fns.empty? or @opt.cmd.empty?; @fnb='' + @fnb=if @opt.fns.empty? \ + or @opt.cmd.empty? + '' else @md=SiSU_Param::Parameters.new(@opt).get @md.fnb diff --git a/lib/sisu/v3/db_select.rb b/lib/sisu/v3/db_select.rb index e446c48a..b2773b97 100644 --- a/lib/sisu/v3/db_select.rb +++ b/lib/sisu/v3/db_select.rb @@ -94,7 +94,9 @@ module SiSU_DbSelect @db=SiSU_Env::InfoDb.new @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql" File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') - elsif @opt.fns and @opt.fns.inspect =~/create/; nil #sort variations later + elsif @opt.fns \ + and @opt.fns.inspect =~/create/ + nil #sort variations later else nil end else nil diff --git a/lib/sisu/v3/dbi_discreet.rb b/lib/sisu/v3/dbi_discreet.rb index 49313a93..fc10fd71 100644 --- a/lib/sisu/v3/dbi_discreet.rb +++ b/lib/sisu/v3/dbi_discreet.rb @@ -168,7 +168,9 @@ module SiSU_DBI_Discreet #% database building @db=SiSU_Env::InfoDb.new @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql" File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') - elsif @opt.fns and @opt.fns.inspect =~/create/; nil #sort variations later + elsif @opt.fns \ + and @opt.fns.inspect =~/create/ + nil #sort variations later else nil end else nil diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index a3364606..f3b94e3d 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -336,7 +336,8 @@ module SiSU_EPUB and link !~/#/ #% keep eye on link p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,link) end - title=if dob.obj !~/Document Information/; linkname + title=if dob.obj !~/Document Information/ + linkname else link='metadata' %{#{linkname}} diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index 0f45fe23..896ed152 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -359,7 +359,8 @@ WOK sto.seg_heading4 # work on see SplitTextObject elsif dob.ln==5 sto.seg_heading5 - elsif dob.ln==6; sto.seg_heading6 + elsif dob.ln==6 + sto.seg_heading6 end elsif dob.is==:para if dob.indent \ diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index dbcbcbab..26d09041 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -168,7 +168,8 @@ module SiSU_Param s=if s.class==String \ and s.length <= l s - elsif s.class==NilClass; nil + elsif s.class==NilClass + nil elsif s.class !=String STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" s @@ -1358,7 +1359,8 @@ module SiSU_Param if para =~/~\{|\^~ |~\^|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m @flag_auto_endnotes,@flag_endnotes=true,true end - if para =~/^(?:table\{|\{table)/i; @flag_tables=true + if para =~/^(?:table\{|\{table)/i + @flag_tables=true end end if para =~/^:?A~/ diff --git a/lib/sisu/v3/shared_sem.rb b/lib/sisu/v3/shared_sem.rb index bd906efc..1fa919c2 100644 --- a/lib/sisu/v3/shared_sem.rb +++ b/lib/sisu/v3/shared_sem.rb @@ -104,11 +104,13 @@ module SiSU_Sem puts matched[0] unless matched[0].nil? end def if_pair_c - if @para=~/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m; puts "#{$1}:{ #{$2} }:#{$1}" + if @para=~/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m + puts "#{$1}:{ #{$2} }:#{$1}" end end def if_pair_sc - if @para=~/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/; puts ";{ #{$1} };#{$2}" + if @para=~/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/ + puts ";{ #{$1} };#{$2}" end end def match_pair_c diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 0786119c..a9df7b2a 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -5641,7 +5641,8 @@ WOK class InfoSkin def initialize(md=nil,skin=nil) @md=md - @d_sk=if skin.class==String ; skin + @d_sk=if skin.class==String + skin elsif defined? md.doc_skin \ and md.doc_skin md.doc_skin -- cgit v1.2.3