From ba862b944247ccbcc82921a47957ebdbcb3f5df3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 5 Feb 2014 18:29:55 -0500 Subject: v5 v6: ao, html book index linking, follow --strict option --- lib/sisu/v5/ao_idx.rb | 17 +++++++++-------- lib/sisu/v6/ao_idx.rb | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/ao_idx.rb b/lib/sisu/v5/ao_idx.rb index aa5f6609..43d5aeda 100644 --- a/lib/sisu/v5/ao_idx.rb +++ b/lib/sisu/v5/ao_idx.rb @@ -67,6 +67,7 @@ module SiSU_AO_BookIndex @rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/ @rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/ @rgx_idx_ocn=/(.+?)~(\d+)/ + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @env ||=SiSU_Env::InfoEnv.new(@md.fns) end def indexing_song @@ -199,15 +200,15 @@ module SiSU_AO_BookIndex if x['node_0_terms'].is_a?(Array) x['node_0_terms'].each do |a| if a[:range] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{a[:range]}, } + idx[:html][@q]=idx[:html][@q] + %{#{a[:range]}, } idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:range]}, } print a[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on elsif a[:ocn] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{a[:ocn]}, } + idx[:html][@q]=idx[:html][@q] + %{#{a[:ocn]}, } idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:ocn]}, } print a[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on else p 'error' @@ -227,15 +228,15 @@ module SiSU_AO_BookIndex print "\n\t" + k + ', ' if @md.opt.act[:verbose_plus][:set]==:on y.each do |z| if z[:range] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{z[:range]}, } + idx[:html][@q]=idx[:html][@q] + %{#{z[:range]}, } idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:range]}, } print z[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on elsif z[:ocn] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{z[:ocn]}, } + idx[:html][@q]=idx[:html][@q] + %{#{z[:ocn]}, } idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:ocn]}, } print z[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on else p 'error' diff --git a/lib/sisu/v6/ao_idx.rb b/lib/sisu/v6/ao_idx.rb index cd6ab26f..eaaf7a90 100644 --- a/lib/sisu/v6/ao_idx.rb +++ b/lib/sisu/v6/ao_idx.rb @@ -67,6 +67,7 @@ module SiSU_AO_BookIndex @rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/ @rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/ @rgx_idx_ocn=/(.+?)~(\d+)/ + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @env ||=SiSU_Env::InfoEnv.new(@md.fns) end def indexing_song @@ -199,15 +200,15 @@ module SiSU_AO_BookIndex if x['node_0_terms'].is_a?(Array) x['node_0_terms'].each do |a| if a[:range] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{a[:range]}, } + idx[:html][@q]=idx[:html][@q] + %{#{a[:range]}, } idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:range]}, } print a[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on elsif a[:ocn] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{a[:ocn]}, } + idx[:html][@q]=idx[:html][@q] + %{#{a[:ocn]}, } idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:ocn]}, } print a[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on else p 'error' @@ -227,15 +228,15 @@ module SiSU_AO_BookIndex print "\n\t" + k + ', ' if @md.opt.act[:verbose_plus][:set]==:on y.each do |z| if z[:range] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{z[:range]}, } + idx[:html][@q]=idx[:html][@q] + %{#{z[:range]}, } idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:range]}, } print z[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on elsif z[:ocn] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{z[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{z[:ocn]}, } + idx[:html][@q]=idx[:html][@q] + %{#{z[:ocn]}, } idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:ocn]}, } print z[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on else p 'error' -- cgit v1.2.3 From 9f10ff9b7667f7e62cf17943dc6dae5a260776bd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 5 Feb 2014 18:31:28 -0500 Subject: v5 v6: utils, code markers & messages, notes/warning/errors, fix --- lib/sisu/v5/ao_images.rb | 12 ++++++------ lib/sisu/v5/utils.rb | 46 +++++++++++++++++++++++++++++++++++----------- lib/sisu/v6/ao_images.rb | 12 ++++++------ lib/sisu/v6/utils.rb | 46 +++++++++++++++++++++++++++++++++++----------- 4 files changed, 82 insertions(+), 34 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/ao_images.rb b/lib/sisu/v5/ao_images.rb index d01c98b8..b72f66a3 100644 --- a/lib/sisu/v5/ao_images.rb +++ b/lib/sisu/v5/ao_images.rb @@ -62,12 +62,12 @@ =end module SiSU_AO_Images class Images - #begin - # require 'RMagick' - # include Magick - #rescue LoadError - # SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('RMagic NOT FOUND (LoadError)') - #end + begin + require 'RMagick' + include Magick + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark('RMagic NOT FOUND') + end def initialize(md,data) @md,@data=md,data end diff --git a/lib/sisu/v5/utils.rb b/lib/sisu/v5/utils.rb index 1c04d886..4894df9d 100644 --- a/lib/sisu/v5/utils.rb +++ b/lib/sisu/v5/utils.rb @@ -95,23 +95,29 @@ module SiSU_Utils end def var(v,x) h={ c: nil, m: '' } - if v.class == Hash + if v.is_a?(Hash) h[:c] = (defined? v[:c]) ? v[:c] : '' h[:m] = (defined? v[:m]) ? v[:m] : '' - else - if v.class == Symbol + elsif (v.is_a?(Symbol) \ + and x.is_a?(String)) + if v.is_a?(Symbol) h[:c]=v - elsif v.class == String + elsif v.is_a?(String) h[:m]=v end - if x.class == Symbol - h[:c]=x - elsif x.class == String + if x.is_a?(String) h[:m]=x end - h[:c] = (defined? h[:c]) ? h[:c] : '' - h[:m] = (defined? h[:m]) ? h[:m] : '' + elsif (v.is_a?(Symbol) \ + or v.is_a?(String)) + if v.is_a?(Symbol) + h[:c]=v + elsif v.is_a?(String) + h[:m]=v + end end + h[:c] = (defined? h[:c]) ? h[:c] : '' + h[:m] = (defined? h[:m]) ? h[:m] : '' h[:c]=ansi(h[:c]) h[:m]=message(h[:m]) h @@ -128,10 +134,28 @@ module SiSU_Utils puts set(v,x) end def warn(v=nil,x=nil) - STDERR.puts set(v,'*WARN* ' + x) + if (v.is_a?(Symbol) \ + and x.is_a?(String)) + x= '*WARN* ' + x + elsif v.is_a?(String) + v='*WARN* ' + v + x=nil + else + v,x='*WARN*',nil + end + STDERR.puts set(v,x) end def error(v=nil,x=nil) - STDERR.puts set(v,'*ERROR* ' + x) + if (v.is_a?(Symbol) \ + and x.is_a?(String)) + x= '*ERROR* ' + x + elsif v.is_a?(String) + v='*ERROR* ' + v + x=nil + else + v,x='*ERROR*',nil + end + STDERR.puts set(v,x) end end class Path diff --git a/lib/sisu/v6/ao_images.rb b/lib/sisu/v6/ao_images.rb index 0279994d..05bc8e63 100644 --- a/lib/sisu/v6/ao_images.rb +++ b/lib/sisu/v6/ao_images.rb @@ -62,12 +62,12 @@ =end module SiSU_AO_Images class Images - #begin - # require 'RMagick' - # include Magick - #rescue LoadError - # SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('RMagic NOT FOUND (LoadError)') - #end + begin + require 'RMagick' + include Magick + rescue LoadError + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark('RMagic NOT FOUND') + end def initialize(md,data) @md,@data=md,data end diff --git a/lib/sisu/v6/utils.rb b/lib/sisu/v6/utils.rb index 60925f22..8f9e17b8 100644 --- a/lib/sisu/v6/utils.rb +++ b/lib/sisu/v6/utils.rb @@ -95,23 +95,29 @@ module SiSU_Utils end def var(v,x) h={ c: nil, m: '' } - if v.class == Hash + if v.is_a?(Hash) h[:c] = (defined? v[:c]) ? v[:c] : '' h[:m] = (defined? v[:m]) ? v[:m] : '' - else - if v.class == Symbol + elsif (v.is_a?(Symbol) \ + and x.is_a?(String)) + if v.is_a?(Symbol) h[:c]=v - elsif v.class == String + elsif v.is_a?(String) h[:m]=v end - if x.class == Symbol - h[:c]=x - elsif x.class == String + if x.is_a?(String) h[:m]=x end - h[:c] = (defined? h[:c]) ? h[:c] : '' - h[:m] = (defined? h[:m]) ? h[:m] : '' + elsif (v.is_a?(Symbol) \ + or v.is_a?(String)) + if v.is_a?(Symbol) + h[:c]=v + elsif v.is_a?(String) + h[:m]=v + end end + h[:c] = (defined? h[:c]) ? h[:c] : '' + h[:m] = (defined? h[:m]) ? h[:m] : '' h[:c]=ansi(h[:c]) h[:m]=message(h[:m]) h @@ -128,10 +134,28 @@ module SiSU_Utils puts set(v,x) end def warn(v=nil,x=nil) - STDERR.puts set(v,'*WARN* ' + x) + if (v.is_a?(Symbol) \ + and x.is_a?(String)) + x= '*WARN* ' + x + elsif v.is_a?(String) + v='*WARN* ' + v + x=nil + else + v,x='*WARN*',nil + end + STDERR.puts set(v,x) end def error(v=nil,x=nil) - STDERR.puts set(v,'*ERROR* ' + x) + if (v.is_a?(Symbol) \ + and x.is_a?(String)) + x= '*ERROR* ' + x + elsif v.is_a?(String) + v='*ERROR* ' + v + x=nil + else + v,x='*ERROR*',nil + end + STDERR.puts set(v,x) end end class Path -- cgit v1.2.3 From bbbb88fa93768a67e59019a191f3a84cb5fc1d3b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 5 Feb 2014 18:32:38 -0500 Subject: v5 v6: sysenv, concordance redirected paths, watch --- lib/sisu/v5/sysenv.rb | 5 ++++- lib/sisu/v6/sysenv.rb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index f2b5bd27..537e52ca 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -5201,7 +5201,10 @@ WOK fh=default_hash_build(fh,Sfx[:html]) fh[:lng]=lang_code?(fh[:lng]) fnh=if output_dir_structure.dump_or_redirect? - @md.fnb + '.concordance' + ft + { + fn: 'concordance', + ft: fh[:ft], + } else { fn: 'concordance', diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index db1bdc91..60d963dc 100644 --- a/lib/sisu/v6/sysenv.rb +++ b/lib/sisu/v6/sysenv.rb @@ -5201,7 +5201,10 @@ WOK fh=default_hash_build(fh,Sfx[:html]) fh[:lng]=lang_code?(fh[:lng]) fnh=if output_dir_structure.dump_or_redirect? - @md.fnb + '.concordance' + ft + { + fn: 'concordance', + ft: fh[:ft], + } else { fn: 'concordance', -- cgit v1.2.3