From edd89902036bde18c91031470e19c871a182cf6d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 23 Oct 2013 23:40:45 -0400 Subject: v5: options & downstream, more use of opt.act instead of opt.cmd * opt.act.*.set==:on instead of opt.cmd =~/\S/ --- data/doc/sisu/CHANGELOG_v5 | 2 + lib/sisu/v5/cgi_pgsql.rb | 8 +- lib/sisu/v5/cgi_sqlite.rb | 6 +- lib/sisu/v5/composite.rb | 20 ++-- lib/sisu/v5/concordance.rb | 23 +++-- lib/sisu/v5/conf.rb | 12 +-- lib/sisu/v5/constants.rb | 30 +++--- lib/sisu/v5/dal.rb | 29 ++++-- lib/sisu/v5/dal_doc_str.rb | 16 +-- lib/sisu/v5/dal_idx.rb | 14 +-- lib/sisu/v5/dal_images.rb | 14 ++- lib/sisu/v5/dal_numbering.rb | 23 ++++- lib/sisu/v5/db_create.rb | 54 +++++++--- lib/sisu/v5/db_drop.rb | 4 +- lib/sisu/v5/db_import.rb | 35 +++++-- lib/sisu/v5/db_indexes.rb | 10 +- lib/sisu/v5/db_load_tuple.rb | 28 ++++-- lib/sisu/v5/db_remove.rb | 10 +- lib/sisu/v5/db_select.rb | 18 ++-- lib/sisu/v5/db_sqltxt.rb | 4 +- lib/sisu/v5/db_tests.rb | 4 +- lib/sisu/v5/dbi.rb | 14 +-- lib/sisu/v5/dbi_discrete.rb | 12 +-- lib/sisu/v5/digests.rb | 31 +++--- lib/sisu/v5/embedded.rb | 19 +++- lib/sisu/v5/epub.rb | 40 +++++--- lib/sisu/v5/epub_concordance.rb | 4 +- lib/sisu/v5/epub_format.rb | 2 +- lib/sisu/v5/epub_segments.rb | 6 +- lib/sisu/v5/epub_tune.rb | 12 ++- lib/sisu/v5/git.rb | 24 ++--- lib/sisu/v5/harvest.rb | 4 +- lib/sisu/v5/harvest_authors.rb | 11 +- lib/sisu/v5/harvest_topics.rb | 19 ++-- lib/sisu/v5/html.rb | 38 +++++-- lib/sisu/v5/html_format.rb | 2 +- lib/sisu/v5/html_minitoc.rb | 8 +- lib/sisu/v5/html_promo.rb | 2 +- lib/sisu/v5/html_segments.rb | 6 +- lib/sisu/v5/html_tune.rb | 12 ++- lib/sisu/v5/hub.rb | 78 ++++++++------ lib/sisu/v5/manifest.rb | 21 ++-- lib/sisu/v5/manpage.rb | 17 +++- lib/sisu/v5/odf.rb | 33 +++--- lib/sisu/v5/odf_format.rb | 10 +- lib/sisu/v5/options.rb | 179 +++++++++++++++++++++++++-------- lib/sisu/v5/param.rb | 41 +++++--- lib/sisu/v5/param_make.rb | 2 +- lib/sisu/v5/plaintext.rb | 37 ++++--- lib/sisu/v5/plaintext_format.rb | 2 +- lib/sisu/v5/po4a.rb | 52 ++++++---- lib/sisu/v5/qrcode.rb | 30 ++++-- lib/sisu/v5/remote.rb | 22 ++-- lib/sisu/v5/rexml.rb | 9 +- lib/sisu/v5/screen_text_color.rb | 19 +--- lib/sisu/v5/share_src.rb | 19 ++-- lib/sisu/v5/share_src_kdissert.rb | 6 +- lib/sisu/v5/shared_markup_alt.rb | 2 +- lib/sisu/v5/shared_sisupod_source.rb | 12 ++- lib/sisu/v5/sisupod_make.rb | 26 +++-- lib/sisu/v5/sitemaps.rb | 4 +- lib/sisu/v5/sst_convert_markup.rb | 27 +++-- lib/sisu/v5/sst_do_inline_footnotes.rb | 23 +++-- lib/sisu/v5/sst_from_xml.rb | 8 +- lib/sisu/v5/sst_identify_markup.rb | 2 +- lib/sisu/v5/sst_to_s_xml_sax.rb | 26 +++-- lib/sisu/v5/sysenv.rb | 99 +++++++++--------- lib/sisu/v5/texinfo.rb | 20 ++-- lib/sisu/v5/texpdf.rb | 67 ++++++++---- lib/sisu/v5/texpdf_format.rb | 8 +- lib/sisu/v5/update.rb | 2 +- lib/sisu/v5/urls.rb | 92 +++++++++-------- lib/sisu/v5/wikispeak.rb | 11 +- lib/sisu/v5/xhtml.rb | 39 ++++--- lib/sisu/v5/xml.rb | 41 +++++--- lib/sisu/v5/xml_dom.rb | 41 +++++--- lib/sisu/v5/xml_fictionbook.rb | 6 +- lib/sisu/v5/xml_format.rb | 2 +- lib/sisu/v5/xml_scaffold.rb | 6 +- lib/sisu/v5/zap.rb | 8 +- 80 files changed, 1127 insertions(+), 652 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 99a49642..d28aeaee 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -30,6 +30,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.21.orig.tar.xz sisu_5.0.21.orig.tar.xz sisu_5.0.21-1.dsc +* options & downstream, more use of opt.act.*.set==:on instead of opt.cmd =~/\S/ + %% 5.0.20.orig.tar.xz (2013-10-17:41/4) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.20 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.20-1 diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index 10aa23fd..be23f6d2 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -66,7 +66,7 @@ module SiSU_CGI_PgSQL class SearchPgSQL < CGI_Common def initialize(opt,webserv) @opt,@webserv=opt,webserv - @cX=SiSU_Screen::Ansi.new(opt.cmd).cX + @cX=SiSU_Screen::Ansi.new(opt.act[:color_state][:set]).cX @env=SiSU_Env::InfoEnv.new('',opt) @sys=SiSU_Env::SystemCall.new @db=SiSU_Env::InfoDb.new @@ -173,13 +173,13 @@ module SiSU_CGI_PgSQL sudo chmod -v 755 /usr/lib/cgi-bin/#{@cgi_file_name} WOK end - SiSU_Screen::Ansi.new(@opt.cmd,a).warn + SiSU_Screen::Ansi.new(opt.act[:color_state][:set],a).warn a=<<-WOK #{@env.webserv_base_cgi(@opt)}/cgi-bin/#{@cgi_file_name} WOK - SiSU_Screen::Ansi.new(@opt.cmd,a).print_blue + SiSU_Screen::Ansi.new(opt.act[:color_state][:set],a).print_blue a="\n\t(to create and populate postgresql database see 'man sisu' and in particular the --pg option)\n\t[the database to be used for this directory (#{@db.psql.db}) will have to be created manually if it does not exist,\n\tusing postgresql tools directly: 'createdb #{@db.psql.db}' for a list of existing databases try 'psql --list']" - SiSU_Screen::Ansi.new(@opt.cmd,a).txt_grey + SiSU_Screen::Ansi.new(opt.act[:color_state][:set],a).txt_grey else puts 'failed in attempt to write #{@cgi_file_name} to present directory, is directory writable?' end end diff --git a/lib/sisu/v5/cgi_sqlite.rb b/lib/sisu/v5/cgi_sqlite.rb index 8b47814c..d2d6eb28 100644 --- a/lib/sisu/v5/cgi_sqlite.rb +++ b/lib/sisu/v5/cgi_sqlite.rb @@ -66,7 +66,7 @@ module SiSU_CGI_SQLite class SearchSQLite < CGI_Common def initialize(opt,webserv) @opt,@webserv=opt,webserv - @cX=SiSU_Screen::Ansi.new(opt.cmd).cX + @cX=SiSU_Screen::Ansi.new(opt.act[:color_state][:set]).cX @env=SiSU_Env::InfoEnv.new('',opt) @image_src="#{@env.url.webserv_cgi(@opt)}/_sisu/image_sys" @name_of={} @@ -146,13 +146,13 @@ module SiSU_CGI_SQLite WOK end b='(to create and populate sisu sqlite database see "man sisu" and in particular the -d flag)' - SiSU_Screen::Ansi.new(@opt.cmd,a,b).warn + SiSU_Screen::Ansi.new(opt.act[:color_state][:set],a,b).warn a=<<-WOK #{@env.webserv_base_cgi(@opt)}/cgi-bin/#{@cgi_file_name} WOK - SiSU_Screen::Ansi.new(@opt.cmd,a).print_blue + SiSU_Screen::Ansi.new(opt.act[:color_state][:set],a).print_blue else puts "failed in attempt to write #{@cgi_file_name} to present directory, is directory writable?" end end diff --git a/lib/sisu/v5/composite.rb b/lib/sisu/v5/composite.rb index 442cfada..822121ae 100644 --- a/lib/sisu/v5/composite.rb +++ b/lib/sisu/v5/composite.rb @@ -163,14 +163,18 @@ module SiSU_Assemble def insertions? data=@fns_array tuned_file,imagedir=[],[] - SiSU_Screen::Ansi.new(@opt.cmd,'Composite Document',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Composite Document',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").grey_title_hi unless @opt.act[:quiet][:set]==:on data.each do |para| if para =~/^<<\s+(\S+?\.ss[it])$/ \ or para =~/^<<\{(\S+?\.ss[it])\}$/ \ or para =~/^(?:<<\s*)\|(\S+?)\|@\|.+?\|(?:req(?:quire)?\b|\s*\})?/ \ or para =~/^r\{(.+?)\}/ #depreciated loadfile=$1.strip - SiSU_Screen::Ansi.new(@opt.cmd,'loading:',loadfile).txt_grey if @opt.cmd =~/[MVv]/ + 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],'loading:',loadfile).txt_grey + end tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[ti]$/ # and NetTest imagedir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.ss[ti]$/.match(loadfile).captures.join + '/_sisu/image' #watch require 'uri' @@ -190,7 +194,7 @@ module SiSU_Assemble file=insertion(loadfile,insert_array) file[:prepared] else - cX=SiSU_Screen::Ansi.new(@opt.cmd).cX + cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX STDERR.puts "\t #{cX.fuchsia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuchsia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}" para end @@ -229,19 +233,23 @@ module SiSU_Assemble def insertions? data=@fns_array tuned_file=[] - SiSU_Screen::Ansi.new(@opt.cmd,'Composite Document',@opt.fno).grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Composite Document',@opt.fno).grey_title_hi unless @opt.act[:quiet][:set]==:on @ssm=[@opt.fns] data.each do |para| if para =~/^<<\s+(\S+?\.ss[it])$/ loadfile=$1.strip - SiSU_Screen::Ansi.new(@opt.cmd,'loading:',loadfile).txt_grey if @opt.cmd =~/[MVv]/ + 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],'loading:',loadfile).txt_grey + end tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[ti]$/ @ssm << loadfile elsif loadfile =~ /\.ss[ti]$/ \ and FileTest.file?(loadfile) @ssm << loadfile else - cX=SiSU_Screen::Ansi.new(@opt.cmd).cX + cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX STDERR.puts "\t #{cX.fuchsia}ERROR#{cX.off} #{cX.brown}#{@opt.fns}#{cX.off} #{cX.fuchsia}requires invalid or non-existent file:#{cX.off} #{cX.brown}#{loadfile}#{cX.off}" para end diff --git a/lib/sisu/v5/concordance.rb b/lib/sisu/v5/concordance.rb index 060409b2..3ad394c7 100644 --- a/lib/sisu/v5/concordance.rb +++ b/lib/sisu/v5/concordance.rb @@ -79,23 +79,27 @@ module SiSU_Concordance begin @env,@md=@particulars.env,@particulars.md @env.url.output_tell - unless @md.opt.cmd =~/q/ - tool=(@md.opt.cmd =~/[MVv]/) \ + unless @md.opt.act[:quiet][:set]==:on + tool=(@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) \ ? "#{@env.program.web_browser} #{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" - @md.opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,"Concordance",tool).green_hi_blue - : SiSU_Screen::Ansi.new(@opt.cmd,'Concordance',tool).green_title_hi + (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) \ + ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Concordance",tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Concordance',tool).green_title_hi end wordmax=@env.concord_max unless @md.wc_words.nil? if @md.wc_words < wordmax SiSU_Concordance::Source::Words.new(@particulars).songsheet else - SiSU_Screen::Ansi.new(@md.opt.cmd,"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.act[:quiet][:set]==:on end else - SiSU_Screen::Ansi.new(@md.opt.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.act[:quiet][:set]==:on SiSU_Concordance::Source::Words.new(@particulars).songsheet end rescue @@ -365,7 +369,10 @@ WOK # special cases endnotes and header levels 1 - 3 end @file_concordance << %{\n} # footer - SiSU_Screen::Ansi.new(@md.opt.cmd,@md.fns,"#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").flow if @md.opt.cmd =~/[MV]/ + if @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@md.fns,"#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").flow + end end end end diff --git a/lib/sisu/v5/conf.rb b/lib/sisu/v5/conf.rb index 8fe2af32..9418ff21 100644 --- a/lib/sisu/v5/conf.rb +++ b/lib/sisu/v5/conf.rb @@ -96,29 +96,29 @@ module SiSU_Initialize @pwd,@home=Dir.pwd,@env.path.home end def make_homepage - SiSU_Screen::Ansi.new(@opt.cmd,'invert','Make homepage','').colorize unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Make homepage','').colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).homepage end def cp_local_images - SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy images','').colorize unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy images','').colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_local_images SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images_local #this should not have been necessary SiSU_Env::CreateSite.new(@opt.cmd).cp_base_images #base images (nav etc.) used by all html end def cp_external_images - SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy external images','').colorize if @opt.cmd =~/V/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy external images','').colorize if @opt.act[:verbose_plus][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_external_images end def cp_webserver_images - SiSU_Screen::Ansi.new(@opt.cmd,'invert','Copy webserver/output file images','').colorize unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Copy webserver/output file images','').colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_webserver_images end def css - SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring CSSs','').colorize unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Configuring CSSs','').colorize unless @opt.act[:quiet][:set]==:on SiSU_Env::CreateSite.new(@opt.cmd).cp_css end def dtd - SiSU_Screen::Ansi.new(@opt.cmd,'invert','Configuring DTDs','').colorize unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','Configuring DTDs','').colorize unless @opt.act[:quiet][:set]==:on @rxng=SiSU_Relaxng::RelaxNG.new @path.each { |d| FileUtils::mkdir_p(d[1]) unless FileTest.directory?(d[1]) } #ugly code, sort later diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index 05996d8b..d89a391a 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -63,20 +63,20 @@ #Ax,Xx,Mx,Rx,Hx,Dx,Px,Ep,Db,Gt,Tex=Array.new(11){{}} YEAR='2013' Sfx={ - txt: '.txt', - html: '.html', - xhtml: '.xhtml', - xml: '.xml', - xml_sax: '.sax.xml', - xml_dom: '.dom.xml', - epub: '.epub', + txt: '.txt', + html: '.html', + xhtml: '.xhtml', + xml: '.xml', + xml_sax: '.sax.xml', + xml_dom: '.dom.xml', + epub: '.epub', epub_xhtml: '.xhtml', - odt: '.odt', - pdf: '.pdf', - manpage: '.1', - info: '.info', - texinfo: '.texinfo', - sql: '.sql.db', + odt: '.odt', + pdf: '.pdf', + manpage: '.1', + info: '.info', + texinfo: '.texinfo', + sql: '.sql.db', } Ax={ tab: "\t", @@ -344,8 +344,8 @@ puts %{-\t#{__FILE__}::#{__LINE__}::#{caller}:\n"#{name}"} p "\t" + txt.obj + " << #{__FILE__} #{__LINE__} >>" p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + dob.inspect) if dob.is==:heading data.each {|o| p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect) if o.is==:heading} -puts "#{__FILE__} #{__LINE__} #{para}" if @opt.cmd =~/M/ -puts "#{__FILE__} #{__LINE__} #{t_o}" if @opt.cmd =~/M/ +puts "#{__FILE__} #{__LINE__} #{para}" if @opt.act[:maintenance][:set]==:on +puts "#{__FILE__} #{__LINE__} #{t_o}" if @opt.act[:maintenance][:set]==:on dr ┌ 9484 dR ┍ 9485 Dr ┎ 9486 DR ┏ 9487 dl ┐ 9488 dL ┑ 9489 Dl ┒ 9490 LD ┓ 9491 ur └ 9492 uR ┕ 9493 Ur ┖ 9494 UR ┗ 9495 ul ┘ 9496 uL ┙ 9497 Ul ┚ 9498 UL ┛ 9499 vr ├ dr ┌ 9484 dR ┍ 9485 Dr ┎ 9486 DR ┏ 9487 dl ┐ 9488 dL ┑ 9489 Dl ┒ 9490 LD ┓ 9491 ur └ 9492 uR ┕ 9493 Ur ┖ 9494 UR ┗ 9495 ul ┘ 9496 uL ┙ 9497 Ul ┚ 9498 UL ┛ 9499 vr ├ └ ┘ diff --git a/lib/sisu/v5/dal.rb b/lib/sisu/v5/dal.rb index 0a2a35b1..0c245599 100644 --- a/lib/sisu/v5/dal.rb +++ b/lib/sisu/v5/dal.rb @@ -268,10 +268,12 @@ module SiSU_DAL protected def create_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',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}") + unless @opt.act[:quiet][:set]==:on + tell=(@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],'Document Abstraction') + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Document Abstraction',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}") tell.blue_title_hi end fn=(@fnx && @fnx =~/\.ss[tmi]$/) \ @@ -284,10 +286,16 @@ module SiSU_DAL @md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract meta=nil dal=SiSU_DAL::Make.new(fn,@md,file_array).song - if @opt.cmd =~/[vM]/ + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) cf=SiSU_Env::CreateFile.new(fn) - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"~meta/#{@opt.fns}.meta").output if @opt.cmd =~/v/i - SiSU_Screen::Ansi.new(@opt.cmd,"dal -> #{cf.meta}").txt_grey if @opt.cmd =~/M/ + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"~meta/#{@opt.fns}.meta").output + elsif @opt.act[:maintenance][:set]==:on + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"dal -> #{cf.meta}").txt_grey + end end dal.each {|s| dal_array << s} dal_array @@ -383,7 +391,7 @@ module SiSU_DAL end end def hard_output - if @md.opt.cmd =~/M/ + if @md.opt.act[:maintenance][:set]==:on filename_meta=@cf.metaverse.file_meta @data.each {|o| filename_meta.puts o.inspect.sub(/:0x[0-9a-f]{8}\s/,': ')} #to make diffing easier filename_txt=@cf.metaverse.file_txt @@ -430,7 +438,7 @@ module SiSU_DAL end def idx_html_hard_output if @md.book_idx \ - and @md.opt.cmd =~/M/ + and @md.opt.act[:maintenance][:set]==:on filename_meta=@cf.file_meta_idx_html if @data.is_a?(Array) @data.each {|s| p s.inspect + "\n" unless s.is_a?(String)} @@ -488,7 +496,8 @@ module SiSU_DAL data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_DAL_BookIndex::BookIndex.new(@md,data,@env).indexing_song if @md.book_idx # dal_idx.rb data=SiSU_DAL_Endnotes::Endnotes.new(@md,data,endnote_array).endnotes # dal_endnotes.rb outputdata=data - if @md.opt.cmd =~/[mM]/ + if (@md.opt.act[:dal][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) SiSU_DAL::Output.new(@fn,@md,outputdata).hard_output SiSU_DAL::Output.new(@fn,@md,outputdata).make_marshal_content SiSU_DAL::Output.new(@fn,@md,metadata).make_marshal_metadata diff --git a/lib/sisu/v5/dal_doc_str.rb b/lib/sisu/v5/dal_doc_str.rb index 87e5c908..4b31c066 100644 --- a/lib/sisu/v5/dal_doc_str.rb +++ b/lib/sisu/v5/dal_doc_str.rb @@ -952,7 +952,7 @@ module SiSU_DAL_DocumentStructureExtract hs=[0,false,false,false] t={ lv: @s[0], status: 'open' } tuned_file << tags(t) - if @md.opt.cmd =~/V/ + if @md.opt.act[:verbose_plus][:set]==:on puts "\nXML sisu structure outline --->\n" puts "<#{@s[0]}>" end @@ -963,7 +963,7 @@ module SiSU_DAL_DocumentStructureExtract when 1 tuned_file << tag_close(o.ln,hs) tuned_file << tag_open(o,@s) - if @md.opt.cmd =~/V/ + if @md.opt.act[:verbose_plus][:set]==:on puts_tag_close(o.ln,hs) puts_tag_open(o,@s) end @@ -971,7 +971,7 @@ module SiSU_DAL_DocumentStructureExtract when 2 tuned_file << tag_close(o.ln,hs) tuned_file << tag_open(o,@s) - if @md.opt.cmd =~/V/ + if @md.opt.act[:verbose_plus][:set]==:on puts_tag_close(o.ln,hs) puts_tag_open(o,@s) end @@ -979,7 +979,7 @@ module SiSU_DAL_DocumentStructureExtract when 3 tuned_file << tag_close(o.ln,hs) tuned_file << tag_open(o,@s) - if @md.opt.cmd =~/V/ + if @md.opt.act[:verbose_plus][:set]==:on puts_tag_close(o.ln,hs) puts_tag_open(o,@s) end @@ -987,7 +987,7 @@ module SiSU_DAL_DocumentStructureExtract when 4 tuned_file << tag_close(o.ln,hs) tuned_file << tag_open(o,@s) - if @md.opt.cmd =~/V/ + if @md.opt.act[:verbose_plus][:set]==:on puts_tag_close(o.ln,hs) puts_tag_open(o,@s) end @@ -995,7 +995,7 @@ module SiSU_DAL_DocumentStructureExtract when 5 tuned_file << tag_close(o.ln,hs) tuned_file << tag_open(o,@s) - if @md.opt.cmd =~/V/ + if @md.opt.act[:verbose_plus][:set]==:on puts_tag_close(o.ln,hs) puts_tag_open(o,@s) end @@ -1003,7 +1003,7 @@ module SiSU_DAL_DocumentStructureExtract when 6 tuned_file << tag_close(o.ln,hs) tuned_file << tag_open(o,@s) - if @md.opt.cmd =~/V/ + if @md.opt.act[:verbose_plus][:set]==:on puts_tag_close(o.ln,hs) puts_tag_open(o,@s) end @@ -1012,7 +1012,7 @@ module SiSU_DAL_DocumentStructureExtract end tuned_file << o end - puts_tag_close(0,hs) if @md.opt.cmd =~/V/ + puts_tag_close(0,hs) if @md.opt.act[:verbose_plus][:set]==:on tuned_file << tag_close(0,hs) tuned_file=tuned_file.flatten end diff --git a/lib/sisu/v5/dal_idx.rb b/lib/sisu/v5/dal_idx.rb index 86ef06f8..be8a0211 100644 --- a/lib/sisu/v5/dal_idx.rb +++ b/lib/sisu/v5/dal_idx.rb @@ -190,7 +190,7 @@ module SiSU_DAL_BookIndex @t=idx[:sst_rel].index(idx[:sst_rel].last) @q=idx[:html].index(idx[:html].last) @r=idx[:xhtml].index(idx[:xhtml].last) - print "\n" + x + ', ' if @md.opt.cmd =~/V/ + print "\n" + x + ', ' if @md.opt.act[:verbose_plus][:set]==:on elsif x.is_a?(Array) p 'array error? -->' print x @@ -202,13 +202,13 @@ module SiSU_DAL_BookIndex 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[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:range]}, } - print a[:range] + ', ' if @md.opt.cmd =~/V/ + 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][@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[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:ocn]}, } - print a[:ocn] + ', ' if @md.opt.cmd =~/V/ + print a[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on else p 'error' end end @@ -223,20 +223,20 @@ module SiSU_DAL_BookIndex idx[:html][@q]=idx[:html][@q] + %{\n

#{k}, } c=clean_xml(k.dup) idx[:xhtml][@r]=idx[:xhtml][@r] + %{\n

#{c}, } - print "\n\t" + k + ', ' if @md.opt.cmd =~/V/ + 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][@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[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:range]}, } - print z[:range] + ', ' if @md.opt.cmd =~/V/ + 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][@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[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:ocn]}, } - print z[:ocn] + ', ' if @md.opt.cmd =~/V/ + print z[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on else p 'error' end end @@ -249,7 +249,7 @@ module SiSU_DAL_BookIndex end end end - print "\n" if @md.opt.cmd =~/V/ + print "\n" if @md.opt.act[:verbose_plus][:set]==:on idx end def screen_print(the_idx) diff --git a/lib/sisu/v5/dal_images.rb b/lib/sisu/v5/dal_images.rb index 1141447d..33a5e627 100644 --- a/lib/sisu/v5/dal_images.rb +++ b/lib/sisu/v5/dal_images.rb @@ -78,8 +78,10 @@ module SiSU_DAL_Images @rmgk=false end else - if @md.opt.cmd =~/[vVM]/ - SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* use of RMagick is not enabled in sisurc.yml').warn + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* use of RMagick is not enabled in sisurc.yml').warn end end data.each do |dob| @@ -104,8 +106,10 @@ module SiSU_DAL_Images img=Magick::ImageList.new("#{image_path}/#{image}") img_col,img_row=img.columns,img.rows else - if @md.opt.cmd =~/[vVM]/ - SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* RMagick not present, will attempt to use imagemagick (identify) directly').warn + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* RMagick not present, will attempt to use imagemagick (identify) directly').warn end imgk=SiSU_Env::SystemCall.new.imagemagick gmgk=SiSU_Env::SystemCall.new.graphicksmagick @@ -142,7 +146,7 @@ module SiSU_DAL_Images end else images=dob.obj.scan(m) do |image| - SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image).warn #unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image).warn unless @md.opt.act[:quiet][:set]==:on end end end diff --git a/lib/sisu/v5/dal_numbering.rb b/lib/sisu/v5/dal_numbering.rb index 1b835d37..96f4134b 100644 --- a/lib/sisu/v5/dal_numbering.rb +++ b/lib/sisu/v5/dal_numbering.rb @@ -288,7 +288,9 @@ module SiSU_DAL_Numbering tags={} art_filename_auto=1 @counter=1 - if not @md.seg_autoname_safe and @md.opt.cmd =~/[MV]/ + if not @md.seg_autoname_safe \ + and (@md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) puts 'manual segment names, numbers used as names, risk warning (segmented html)' end ocn_html_seg=[] @@ -311,7 +313,9 @@ module SiSU_DAL_Numbering dob.name=possible_seg_name dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ @md.seg_names << possible_seg_name - else puts 'warn, there may be a conflicting numbering scheme' if @md.opt.cmd =~/[VM]/ + elsif (@md.opt.act[:verbose_plus][:set]==:on \ + or @md.opt.act[:maintenance][:set]==:on) + puts 'warn, there may be a conflicting numbering scheme' end end if dob.ln==4 \ @@ -407,7 +411,10 @@ module SiSU_DAL_Numbering end def set_heading_top(data) #% make sure no false positives unless @md.set_heading_top - puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/ + if (@md.opt.act[:verbose_plus][:set]==:on \ + or @md.opt.act[:maintenance][:set]==:on) + puts "\tdocument contains no top level heading, (will have to manufacture one)" + end @tuned_file=[] data.each do |t_o| unless @md.set_heading_top @@ -431,7 +438,10 @@ module SiSU_DAL_Numbering end def set_heading_seg(data) #% make sure no false positives unless @md.set_heading_seg - puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/ + if (@md.opt.act[:verbose_plus][:set]==:on \ + or @md.opt.act[:maintenance][:set]==:on) + puts "\tdocument contains no segment level, (will have to manufacture one)" + end @tuned_file=[] data.each do |dob| unless @md.set_heading_seg @@ -452,7 +462,10 @@ module SiSU_DAL_Numbering end def set_header_title(data) #% make sure no false positives unless @md.set_header_title - puts "\t no document title provided, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/ + if (@md.opt.act[:verbose_plus][:set]==:on \ + or @md.opt.act[:maintenance][:set]==:on) + puts "\t no document title provided, (will have to manufacture one)" + end @tuned_file=[] data.each do |t_o| unless @md.set_header_title diff --git a/lib/sisu/v5/db_create.rb b/lib/sisu/v5/db_create.rb index e2d1f916..15cf8586 100644 --- a/lib/sisu/v5/db_create.rb +++ b/lib/sisu/v5/db_create.rb @@ -67,7 +67,7 @@ module SiSU_DbCreate @@dl=nil def initialize(opt,conn,file,sql_type='pg') @opt,@conn,@file,@sql_type=opt,conn,file,sql_type - @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX + @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX @comment=(@sql_type=='pg') \ ? (SiSU_DbCreate::Comment.new(@conn,@sql_type)) : nil @@ -84,9 +84,13 @@ module SiSU_DbCreate def create_db @env=SiSU_Env::InfoEnv.new(@opt.fns) tell=(@sql_type=='sqlite') \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Create SQLite db tables in:',%{"#{@file}"}) - : SiSU_Screen::Ansi.new(@opt.cmd,'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) - tell.dark_grey_title_hi if @opt.cmd =~/[vVM]/ + ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create SQLite db tables in:',%{"#{@file}"}) + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + tell.dark_grey_title_hi + end SiSU_Env::SystemCall.new.create_pg_db(@env.path.stub_pwd) if @sql_type=='pg' #watch use of path.stub_pwd instead of stub end def output_dir? @@ -97,12 +101,15 @@ module SiSU_DbCreate end def create_table def metadata_and_text - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ currently using sisu dbi module to be populated from document files create tables metadata_and_text data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_metadata_and_text=%{ CREATE TABLE metadata_and_text ( tid BIGINT PRIMARY KEY, @@ -207,11 +214,14 @@ module SiSU_DbCreate @comment.psql.metadata_and_text if @comment end def doc_objects # create doc_objects base - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ to be populated from documents files create tables doc_objects data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_doc_objects=%{ CREATE TABLE doc_objects ( lid BIGINT PRIMARY KEY, @@ -250,11 +260,14 @@ module SiSU_DbCreate @comment.psql.doc_objects if @comment end def endnotes - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ to be populated from document files create tables endnotes data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_endnotes=%{ CREATE TABLE endnotes ( nid BIGINT PRIMARY KEY, @@ -273,11 +286,14 @@ module SiSU_DbCreate @comment.psql.endnotes if @comment end def endnotes_asterisk - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ to be populated from document files create tables endnotes_asterisk data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_endnotes_asterisk=%{ CREATE TABLE endnotes_asterisk ( nid BIGINT PRIMARY KEY, @@ -296,11 +312,14 @@ module SiSU_DbCreate @comment.psql.endnotes_asterisk if @comment end def endnotes_plus - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ to be populated from document files create tables endnotes_plus data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_endnotes_plus=%{ CREATE TABLE endnotes_plus ( nid BIGINT PRIMARY KEY, @@ -319,12 +338,15 @@ module SiSU_DbCreate @comment.psql.endnotes_plus if @comment end def urls # create doc_objects file links mapping - print %{ + if (@opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on) + print %{ currently using sisu dbi module to be populated from doc_objects files create tables urls data import through ruby transfer - } if @opt.cmd =~/[VM]/ + } + end create_urls=%{ CREATE TABLE urls ( metadata_tid BIGINT REFERENCES metadata_and_text, diff --git a/lib/sisu/v5/db_drop.rb b/lib/sisu/v5/db_drop.rb index 252a311b..33029501 100644 --- a/lib/sisu/v5/db_drop.rb +++ b/lib/sisu/v5/db_drop.rb @@ -149,7 +149,7 @@ module SiSU_DbDrop end end def base #% drop base indexes - print "\n drop documents common indexes\n" unless @opt.cmd =~/q/ + print "\n drop documents common indexes\n" unless @opt.act[:quiet][:set]==:on sql_arr=[ %{DROP INDEX idx_title;}, %{DROP INDEX idx_author;}, @@ -176,7 +176,7 @@ module SiSU_DbDrop conn_execute_array(sql_arr) end def text #% drop TEXT indexes, sqlite - print "\n drop documents TEXT indexes\n" unless @opt.cmd =~/q/ + print "\n drop documents TEXT indexes\n" unless @opt.act[:quiet][:set]==:on sql_arr=[ %{DROP INDEX idx_clean;}, %{DROP INDEX idx_endnote}, diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb index bcb22de8..6edb0f99 100644 --- a/lib/sisu/v5/db_import.rb +++ b/lib/sisu/v5/db_import.rb @@ -74,7 +74,7 @@ module SiSU_DbImport attr_accessor :tp def initialize(opt,conn,file_maint,sql_type='pg') @opt,@conn,@file_maint,@sql_type=opt,conn,file_maint,sql_type - @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX + @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX @env=SiSU_Env::InfoEnv.new(@opt.fns) @dal="#{@env.processing_path.dal}" @fnb=if @opt.fns.empty? \ @@ -102,7 +102,7 @@ module SiSU_DbImport ? @conn.execute( sql ).join.to_i : @conn.execute( sql ) { |x| x.fetch_all.flatten[0] } rescue - puts "#{__FILE__}:#{__LINE__}" if @opt.cmd =~/M/ + puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on end @col[:lid]=0 if @col[:lid].nil? or @col[:lid].to_s.empty? sql='SELECT MAX(nid) FROM endnotes' @@ -112,7 +112,7 @@ module SiSU_DbImport : @id_n=@conn.execute( sql ) { |x| x.fetch_all.flatten[0] } @id_n ||=0 rescue - puts "#{__FILE__}:#{__LINE__}" if @opt.cmd =~/M/ + puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on end @id_n =0 if @col[:lid].nil? or @col[:lid].to_s.empty? @col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=0 @@ -123,8 +123,12 @@ module SiSU_DbImport def marshal_load require_relative 'dal' # dal.rb @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here - SiSU_Screen::Ansi.new(@opt.cmd,"#{@db.psql.db}::#{@opt.fns}").puts_blue if @opt.cmd =~/vVM/ - SiSU_Screen::Ansi.new(@opt.cmd,'Marshal Load',@fnc).puts_grey if @opt.cmd =~/v/ + 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],"#{@db.psql.db}::#{@opt.fns}").puts_blue + end + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Marshal Load',@fnc).puts_grey if @opt.act[:verbose][:set]==:on #% select_first_match=%{ SELECT metadata_and_text.tid @@ -141,7 +145,8 @@ module SiSU_DbImport t_d << db_import_documents(@dal_array) t_d << db_import_urls(@dal_array,@fnc) #import OID on/off t_d=t_d.flatten - if @opt.cmd =~/[MV]/ + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) puts @conn.class if defined? @conn.class puts @conn.driver_name if defined? @conn.driver_name puts @conn.driver if defined? @conn.driver @@ -178,7 +183,7 @@ module SiSU_DbImport sql=File.new(sqlfn,'w') t_d.each {|i| sql.puts i} p sqlfn - if @opt.cmd =~/M/ + if @opt.act[:maintenance][:set]==:on puts sql p @conn.methods.sort puts "#{__FILE__}:#{__LINE__}" @@ -191,7 +196,7 @@ module SiSU_DbImport sql=File.new(sqlfn,'w') t_d.each {|i| sql.puts i} p sqlfn - if @opt.cmd =~/M/ + if @opt.act[:maintenance][:set]==:on puts sql p @conn.methods.sort puts "#{__FILE__}:#{__LINE__}" @@ -230,7 +235,11 @@ module SiSU_DbImport book_idx_str end def db_import_metadata #% import documents - populate database - print %{ #{@cX.grey}import documents dbi_unit #{@cX.off} } if @opt.cmd =~/vVM/ + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + print %{ #{@cX.grey}import documents dbi_unit #{@cX.off} } + end @tp={} @md=SiSU_Param::Parameters.new(@opt).get #% sisutxt & fulltxt @@ -259,10 +268,14 @@ module SiSU_DbImport end @@id_t=id_t if id_t rescue - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "#{__FILE__} #{__LINE__}" if @opt.act[:maintenance][:set]==:on end @@id_t+=1 #bug related, needs to be performed once at start of file, but consider moving, as, placed here it means program will fail if document header lacks @title: - puts %{\n#{@cX.grey}Processing file number#{@cX.off}: #{@cX.green}#{@@id_t}#{@@cX.off}} if @opt.cmd =~/vVM/ + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + puts %{\n#{@cX.grey}Processing file number#{@cX.off}: #{@cX.green}#{@@id_t}#{@@cX.off}} + end end ################ CLEAR ############## SiSU_DbDBI::Test.new(self,@opt).verify #% import title names, filenames (tuple) diff --git a/lib/sisu/v5/db_indexes.rb b/lib/sisu/v5/db_indexes.rb index 265d5169..b3e2f45f 100644 --- a/lib/sisu/v5/db_indexes.rb +++ b/lib/sisu/v5/db_indexes.rb @@ -74,7 +74,10 @@ module SiSU_DbIndex end end def base - print "\n create documents common indexes\n" if @opt.cmd =~/[VM]/ + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + print "\n create documents common indexes\n" + end sql_arr=[ %{CREATE INDEX idx_ocn ON doc_objects(ocn);}, %{CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);}, @@ -102,7 +105,10 @@ module SiSU_DbIndex conn_execute_array(sql_arr) end def text - print "\n create documents TEXT indexes\n" if @opt.cmd =~/[VM]/ + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + print "\n create documents TEXT indexes\n" + end sql_arr=[ %{CREATE INDEX idx_clean ON doc_objects(clean);}, %{CREATE INDEX idx_endnote ON endnotes(clean);} diff --git a/lib/sisu/v5/db_load_tuple.rb b/lib/sisu/v5/db_load_tuple.rb index bdaf285a..10282bdd 100644 --- a/lib/sisu/v5/db_load_tuple.rb +++ b/lib/sisu/v5/db_load_tuple.rb @@ -78,7 +78,7 @@ module SiSU_DbTuple @col[:lev]=0 end @col[:ocn]=0 unless @col[:ocn].inspect=~/\d+/ - @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX + @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX end def tuple #% import line sql_entry=if @col[:en_a] @@ -88,19 +88,19 @@ module SiSU_DbTuple "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, t_of, t_is, node, parent, digest_clean, digest_all) " + "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" end - if @opt.cmd =~/M/ - if @opt.cmd =~/V/ + if @opt.act[:verbose_plus][:set]==:on + if @opt.act[:maintenance][:set]==:on puts @file_maint.inspect puts sql_entry end @file_maint.puts sql_entry else - if @opt.cmd =~/V/ + if @opt.act[:verbose_plus][:set]==:on puts sql_entry @file_maint.puts sql_entry end end - if @opt.cmd =~/v/ + if @opt.act[:verbose][:set]==:on if @col[:lev].inspect =~/[12356789]/ lev=case @col[:lev].inspect when /1/; ':A' @@ -283,11 +283,13 @@ tid) #{@tp.column.links.tuple[1]} #{@id} );" - if @md.opt.cmd =~/M/ + if @md.opt.act[:maintenance][:set]==:on puts "maintenance mode on: creating sql transaction file (for last transaction set (document) only):\n\t#{@file_maint.inspect}" @file_maint.puts sql_entry else - @file_maint.puts sql_entry if @md.opt.cmd =~/V/ + if @md.opt.act[:verbose_plus][:set]==:on + @file_maint.puts sql_entry + end end sql_entry end @@ -299,10 +301,12 @@ tid) def tuple sql_entry="INSERT INTO urls (#{@f[:txt]} #{@f[:html_toc]} #{@f[:html_doc]} #{@f[:xhtml]} #{@f[:xml_sax]} #{@f[:xml_dom]} #{@f[:odf]} #{@f[:pdf_p]} #{@f[:pdf_l]} #{@f[:concordance]} #{@f[:latex_p]} #{@f[:latex_l]} #{@f[:manifest]} #{@f[:digest]} #{@f[:markup]} #{@f[:sisupod]} metadata_tid) " + "VALUES (#{@u[:txt]} #{@u[:html_toc]} #{@u[:html_doc]} #{@u[:xhtml]} #{@u[:xml_sax]} #{@u[:xml_dom]} #{@u[:odf]} #{@u[:pdf_p]} #{@u[:pdf_l]} #{@u[:concordance]} #{@u[:latex_p]} #{@u[:latex_l]} #{@u[:manifest]} #{@u[:digest]} #{@u[:markup]} #{@u[:sisupod]} #{@id});" - if @opt.cmd =~/M/ + if @opt.act[:maintenance][:set]==:on @file_maint.puts sql_entry else - @file_maint.puts sql_entry if @opt.cmd =~/V/ + if @opt.act[:verbose_plus][:set]==:on + @file_maint.puts sql_entry + end end sql_entry end @@ -314,10 +318,12 @@ tid) def tuple sql_entry="INSERT INTO #{@en[:type]} (nid, document_lid, nr, clean, body, ocn, ocnd, ocns, metadata_tid, digest_clean) " + "VALUES ('#{@en[:id]}', '#{@en[:lid]}', '#{@en[:nr]}', '#{@en[:txt]}', '#{@en[:body]}', '#{@en[:ocn]}', '#{@en[:ocnd]}', '#{@en[:ocns]}', '#{@en[:id_t]}', '#{@en[:hash]}');" - if @opt.cmd =~/M/ + if @opt.act[:maintenance][:set]==:on @file_maint.puts sql_entry else - @file_maint.puts sql_entry if @opt.cmd =~/V/ + if @opt.act[:verbose_plus][:set]==:on + @file_maint.puts sql_entry + end end sql_entry end diff --git a/lib/sisu/v5/db_remove.rb b/lib/sisu/v5/db_remove.rb index 2e65d51a..71be0ebc 100644 --- a/lib/sisu/v5/db_remove.rb +++ b/lib/sisu/v5/db_remove.rb @@ -112,11 +112,15 @@ module SiSU_DbRemove @conn.execute(s) end end - if @opt.cmd =~/M/ - @file.puts sql_entry if @opt.cmd =~/M/ + if @opt.act[:maintenance][:set]==:on + @file.puts sql_entry end else - SiSU_Screen::Ansi.new(@opt.cmd,"no such file in database #{@db.psql.db}::#{@opt.fns}").puts_grey if @opt.cmd =~/vVM/ + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.cmd,"no such file in database #{@db.psql.db}::#{@opt.fns}").puts_grey + end end end end diff --git a/lib/sisu/v5/db_select.rb b/lib/sisu/v5/db_select.rb index 879862b1..38251554 100644 --- a/lib/sisu/v5/db_select.rb +++ b/lib/sisu/v5/db_select.rb @@ -94,7 +94,7 @@ module SiSU_DbSelect file=if @opt.inspect =~/M/ if @opt.fns and not @opt.fns.empty? @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns - puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.cmd =~/M/ + puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.act[:maintenance][:set]==:on @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+') @@ -172,21 +172,21 @@ module SiSU_DbSelect db_exist? @sdb_import.marshal_load tell=case @sql_type - when /sqlite/; SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{@db.sqlite.db} database?") - when /pg/; SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?") + when /sqlite/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") + when /pg/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") else '???' end - tell.puts_grey if @opt.cmd =~/v/ + tell.puts_grey if @opt.act[:verbose][:set]==:on when /^--update$/ db_exist? @sdb_remove_doc.remove @sdb_import.marshal_load tell=case @sql_type - when /sqlite/; SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{@db.sqlite.db} database?") - when /pg/; SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?") + when /sqlite/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") + when /pg/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") else '???' end - tell.puts_grey if @opt.cmd =~/v/ + tell.puts_grey if @opt.act[:verbose][:set]==:on when /^--remove$/ db_exist? @sdb_remove_doc.remove @@ -206,14 +206,14 @@ module SiSU_DbSelect when /^--(?:v\d+|dev)$/ else end - if @opt.cmd =~/M/ \ + if @opt.act[:maintenance][:set]==:on \ and @opt.cmd =~/d/ puts @job end end if @opt.act[:psql][:set]==:on \ and @opt.mod.inspect !~/--(?:createdb|init(?:ialize)?|create(?:all)?|createtables?|recreate|cr(eate)?lex|cr(eate)?metadata|import|update|remove|index|droptable(s)?|dropindex(es)?|dropall|drop)/ - SiSU_Screen::Ansi.new(@opt.cmd,"--pg requires further instruction").warn unless @opt.cmd =~/[q]/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"--pg requires further instruction").warn unless @opt.act[:quiet][:set]==:on end begin rescue; @sdb.output_dir? diff --git a/lib/sisu/v5/db_sqltxt.rb b/lib/sisu/v5/db_sqltxt.rb index eb52f300..d678ef22 100644 --- a/lib/sisu/v5/db_sqltxt.rb +++ b/lib/sisu/v5/db_sqltxt.rb @@ -83,14 +83,14 @@ module SiSU_DbText and not @md.creator.author.empty? s=s.gsub(/@author/,@md.creator.author) else - SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:',@md.fnb).warn unless @md.opt.cmd.inspect =~/q/ + SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:',@md.fnb).warn unless @md.opt.act[:quiet][:set]==:on end if defined? @md.title \ and defined? @md.title.full \ and not @md.title.full.empty? s=s.gsub(/@title/,@md.title.full) else - SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb).warn unless @md.opt.cmd.inspect =~/q/ + SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb).warn unless @md.opt.act[:quiet][:set]==:on end end s=s.gsub(/^(?:_[1-9]\*?|_\*)\s+/m,''). diff --git a/lib/sisu/v5/db_tests.rb b/lib/sisu/v5/db_tests.rb index 5cc7c982..2e93ba11 100644 --- a/lib/sisu/v5/db_tests.rb +++ b/lib/sisu/v5/db_tests.rb @@ -64,14 +64,14 @@ module SiSU_DbTests class Test def initialize(info,opt) @ck,@opt=info,opt - unless @opt.cmd =~/q/ + unless @opt.act[:quiet][:set]==:on puts @ck.tp[:fns] if @ck.tp[:fns] and not @ck.tp[:fns].empty? puts @ck.tp[:title] if @ck.tp[:title] and not @ck.tp[:title].empty? puts @ck.tp[:creator] if @ck.tp[:creator] and not @ck.tp[:creator].empty? end end def verify - unless @opt.cmd =~/q/ + unless @opt.act[:quiet][:set]==:on puts @ck.tp[:fns].length.to_s + ' checklength ' + @ck.tp[:fns] if @ck.tp[:fns] and @ck.tp[:fns].length >@ck.lt_filename puts @ck.tp[:title].length.to_s + ' checklength ' + @ck.tp[:title] if @ck.tp[:title] and @ck.tp[:title].length >@ck.lt_title puts @ck.tp[:subtitle].length.to_s + ' checklength ' + @ck.tp[:subtitle] if @ck.tp[:subtitle] and @ck.tp[:subtitle].length >@ck.lt_subtitle diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb index cc2b614e..e59a09b7 100644 --- a/lib/sisu/v5/dbi.rb +++ b/lib/sisu/v5/dbi.rb @@ -77,22 +77,22 @@ module SiSU_DBI or @opt.mod.inspect =~/--(pg(?:sql)?|(?:sq)?lite)/ @sql_type=if @opt.cmd=~/D/ \ or @opt.mod.inspect =~/--pg(?:sql)?/ - maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on 'pg' elsif @opt.cmd =~/d/ \ and @opt.mod.inspect =~/--(?:db[=-])?pg(?:sql)?/ - maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on 'pg' elsif @opt.cmd=~/d/ \ or @opt.mod.inspect =~/--(?:sq)?lite/ - maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on 'sqlite' elsif @opt.cmd =~/d/ \ and @opt.mod.inspect =~/--(?:db[=-])?(?:sq)?lite/ - maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on 'sqlite' else - maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on 'sqlite' end end @@ -107,7 +107,7 @@ module SiSU_DBI @conn=@db.psql.conn_dbi rescue if @opt.mod.inspect=~/--(createall|create)/ - cX=SiSU_Screen::Ansi.new(@opt.cmd).cX + cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX puts <<-WOK manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet exist #{cX.yellow}createdb #{@db.db}#{cX.off} @@ -129,7 +129,7 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet when /pg/; read_psql when /sqlite/; read_sqlite end - SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}",@opt.fno).dbi_title unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"DBI (#{@sql_type}) #{@opt.mod}",@opt.fno).dbi_title unless @opt.act[:quiet][:set]==:on begin SiSU_DbDBI::Case.new(@opt,@conn,@sql_type).cases rescue diff --git a/lib/sisu/v5/dbi_discrete.rb b/lib/sisu/v5/dbi_discrete.rb index fe921c85..957009b1 100644 --- a/lib/sisu/v5/dbi_discrete.rb +++ b/lib/sisu/v5/dbi_discrete.rb @@ -79,7 +79,7 @@ module SiSU_DBI_Discrete #% database building if @opt.cmd =~/[d]/ \ or @opt.mod.inspect =~/--((?:sq)?lite)/ @sql_type='sqlite' - maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on end @output_path=@md.file.output_path.sqlite_discrete.dir @filename=@md.file.base_filename.sqlite_discrete @@ -121,7 +121,7 @@ module SiSU_DBI_Discrete #% database building sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@file,'sqlite') sdb.output_dir? begin - SiSU_Screen::Ansi.new(@opt.cmd,'SQLite',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'SQLite',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.act[:quiet][:set]==:on sdb.create_db sdb.create_table.metadata_and_text sdb.create_table.doc_objects @@ -133,8 +133,8 @@ module SiSU_DBI_Discrete #% database building db_exist?(db,conn) sdb_import=SiSU_DbDBI::Import.new(@opt,conn,@file_maint,'sqlite') sdb_import.marshal_load - tell=SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{db.sqlite.db} database?") - tell.puts_grey if @opt.cmd =~/v/ + tell=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{db.sqlite.db} database?") + tell.puts_grey if @opt.act[:verbose][:set]==:on rescue SiSU_Errors::Rescued.new($!,$@,'-d').location do __LINE__.to_s + ':' + __FILE__ @@ -151,7 +151,7 @@ module SiSU_DBI_Discrete #% database building end def connect begin - SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.act[:quiet][:set]==:on @db.sqlite_discrete.conn_sqlite3 rescue SiSU_Errors::Rescued.new($!,$@,@cf,@opt.fns).location do @@ -166,7 +166,7 @@ module SiSU_DBI_Discrete #% database building file=if @opt.inspect =~/M/ if @opt.fns and not @opt.fns.empty? @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns - puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.cmd =~/M/ + puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.act[:maintenance][:set]==:on @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+') diff --git a/lib/sisu/v5/digests.rb b/lib/sisu/v5/digests.rb index ea2e81cd..e142ff11 100644 --- a/lib/sisu/v5/digests.rb +++ b/lib/sisu/v5/digests.rb @@ -76,14 +76,21 @@ module SiSU_DigestView def read begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array - unless @opt.cmd =~/q/ - tool=(@opt.cmd =~/[MVv]/) \ + unless @opt.act[:quiet][:set]==:on + tool=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ ? "#{@env.program.text_editor} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" - @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_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]/ + (@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],"Document #{@dg} Digests",tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Document #{@dg} Digests",tool).green_title_hi + if @opt.act[:verbose_plus][:set]==:on \ + or @opt.act[:maintenance][:set]==:on + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}").flow + end end SiSU_DigestView::Source::Scroll.new(@particulars).songsheet rescue @@ -118,23 +125,23 @@ module SiSU_DigestView output end def description(f,e='') - puts f + e.to_s if @md.opt.cmd =~/V/ + puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on @@description << f << e end def digests(f,e='') - puts f if @md.opt.cmd =~/V/ + puts f if @md.opt.act[:verbose_plus][:set]==:on @@ds[:digests] << f + "\n" end def dal_structure_tree(f,e='') - puts f + e.to_s if @md.opt.cmd =~/V/ + puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on @@ds[:tree] << f << e end def dal_structure_summary(f,e='') - puts f + e.to_s if @md.opt.cmd =~/V/ + puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on @@ds[:summary] << f << e end def rcinfo(f,e='') - puts f + e.to_s if @md.opt.cmd =~/V/ + puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on @@sc_info << f << e end def output @@ -201,7 +208,7 @@ module SiSU_DigestView elsif FileTest.file?("#{@env.path.image_source_include}/#{i}") @env.path.image_source_include else - SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on nil end @img << /\S+\.(png|jpg|gif)/.match(i)[1] diff --git a/lib/sisu/v5/embedded.rb b/lib/sisu/v5/embedded.rb index 5ce0bf04..89ba1d41 100644 --- a/lib/sisu/v5/embedded.rb +++ b/lib/sisu/v5/embedded.rb @@ -93,7 +93,10 @@ module SiSU_Embedded ldest=@env.path.output img_dir="#{@env.path.output}/_sisu/image" @rhost.each do |remote_conn| - if @md.opt.cmd.inspect =~/[vVMR]/ \ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on \ + || @md.opt.act[:rsync][:set]==:on) \ and FileTest.directory?(src) FileUtils::mkdir_p(img_dir) unless FileTest.directory?(img_dir) src_ec=@f.place_file.images.rel + '/' + @md.ec[:image].join(" #{@f.output_path.images.rel}/") @@ -112,12 +115,15 @@ module SiSU_Embedded ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio" @rhost.each do |remote_conn| rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/audio" - if @md.opt.cmd.inspect =~/[vVMR]/ \ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on \ + || @md.opt.act[:rsync][:set]==:on) \ and FileTest.directory?(src) FileUtils::mkdir_p(ldest) unless FileTest.directory?(ldest) src_ec="#{src}/" + @md.ec[:audio].join(" #{src}/") SiSU_Env::SystemCall.new(src_ec,"#{ldest}/.",'q').rsync - if @md.opt.cmd.inspect =~/R/ #rsync to remote audio directory + if @md.opt.act[:rsync][:set]==:on #rsync to remote audio directory SiSU_Env::SystemCall.new(src_ec,"#{rdest}/.",'q').rsync end end @@ -129,12 +135,15 @@ module SiSU_Embedded ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video" @rhost.each do |remote_conn| rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/video" - if @md.opt.cmd.inspect =~/[vVMR]/ \ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on \ + || @md.opt.act[:rsync][:set]==:on) \ and FileTest.directory?(src) FileUtils::mkdir_p(ldest) unless FileTest.directory?(ldest) src_ec="#{src}/" + @md.ec[:multimedia].join(" #{src}/") SiSU_Env::SystemCall.new(src_ec,"#{ldest}/.",'q').rsync - if @md.opt.cmd.inspect =~/R/ #rsync to remote video directory + if @md.opt.act[:rsync][:set]==:on #rsync to remote video directory SiSU_Env::SystemCall.new(src_ec,"#{rdest}/.",'q').rsync end end diff --git a/lib/sisu/v5/epub.rb b/lib/sisu/v5/epub.rb index 26f1dc0d..37ab535b 100644 --- a/lib/sisu/v5/epub.rb +++ b/lib/sisu/v5/epub.rb @@ -86,14 +86,21 @@ module SiSU_EPUB @md=@particulars.md @fnb=@md.fnb @env=@particulars.env - unless @opt.cmd =~/q/ - tool=(@opt.cmd =~/[MVvz]/) \ + unless @opt.act[:quiet][:set]==:on + tool=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ ? "#{@env.program.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" - @opt.cmd=~/[MVvz]/ \ - ? 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]/ + (@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],'EPUB',tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'EPUB',tool).green_title_hi + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}").flow + end end @env.processing_path.epub_bld #(@md) @env.processing_path.epub_cp_images(@md) @@ -111,7 +118,8 @@ module SiSU_EPUB __LINE__.to_s + ':' + __FILE__ end ensure - unless @opt.cmd =~/[MV]/ #check maintenance flag + unless (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) texfiles=Dir["#{@env.processing_path.tune}/#{@opt.fns}*"] texfiles.each do |f| if FileTest.file?(f) @@ -139,7 +147,7 @@ module SiSU_EPUB SiSU_Env::FileOp.new(@md).mkdir.output.epub end def tuned_file_instructions - @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) + @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) directories dal_array=@particulars.dal_array # dal file drawn here @tuned_file_array=SiSU_EPUB_Tune::Tune.new(dal_array,@md).songsheet @@ -186,11 +194,15 @@ module SiSU_EPUB @md,@data=md,data @vz=SiSU_Viz::Defaults.new @epub=SiSU_EPUB_Format::HeadInformation.new(@md) - @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md + @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md @make=SiSU_Env::ProcessingSettings.new(@md) end def songsheet #extracts toc for scroll & seg - SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Toc').txt_grey + end toc=nil @@firstseg=nil @@toc={ seg: [], seg_mini: [], scr: [], ncx: [], opf: [] } @@ -519,7 +531,11 @@ module SiSU_EPUB def in_common toc_shared=[] segtoc=[] - SiSU_Screen::Ansi.new(@md.opt.cmd,'Scroll & Segtoc').txt_grey if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Scroll & Segtoc').txt_grey + end format_head_toc=SiSU_EPUB_Format::HeadToc.new(@md) dochead=format_head_toc.head dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge @@ -687,7 +703,7 @@ module SiSU_EPUB ") FileUtils::mv(@epub_doc, @md.file.place_file.epub.dir) Dir.chdir(pwd) - unless @md.opt.cmd.inspect =~/M/ + unless @md.opt.act[:maintenance][:set]==:on FileUtils::rm_r(@md.env.processing_path.epub) end end diff --git a/lib/sisu/v5/epub_concordance.rb b/lib/sisu/v5/epub_concordance.rb index 976ca619..628435f2 100644 --- a/lib/sisu/v5/epub_concordance.rb +++ b/lib/sisu/v5/epub_concordance.rb @@ -82,10 +82,10 @@ module SiSU_EPUB_Concordance if @md.wc_words < wordmax SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet else - SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* concordance skipped, large document has over #{wordmax} words (#{@md.wc_words})").warn unless @md.opt.act[:quiet][:set]==:on end else - SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.act[:quiet][:set]==:on SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet end rescue diff --git a/lib/sisu/v5/epub_format.rb b/lib/sisu/v5/epub_format.rb index 513e1dd2..1c57cd20 100644 --- a/lib/sisu/v5/epub_format.rb +++ b/lib/sisu/v5/epub_format.rb @@ -1878,7 +1878,7 @@ output_epub_cont_seg.close @ocn=((defined? t_o.ocn) ? t_o.ocn.to_s : nil) @headname=((t_o.is==:heading and defined? t_o.name) ? t_o.name : nil) else - if @md.opt.cmd =~/M/ + if @md.opt.act[:maintenance][:set]==:on p __FILE__ << ':' << __LINE__.to_s p t_o.class p caller diff --git a/lib/sisu/v5/epub_segments.rb b/lib/sisu/v5/epub_segments.rb index 9f483610..16e26855 100644 --- a/lib/sisu/v5/epub_segments.rb +++ b/lib/sisu/v5/epub_segments.rb @@ -173,7 +173,11 @@ WOK @@seg_name_xhtml=@@seg_name @@seg_total=@@seg_name.length testforartnum=@@seg_name_xhtml - SiSU_Screen::Ansi.new(@md.opt.cmd,@@seg_name.length) if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@@seg_name.length) + end SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags data.each do |dob| #if defined? dob.obj \ diff --git a/lib/sisu/v5/epub_tune.rb b/lib/sisu/v5/epub_tune.rb index c017c2df..5ec5fa56 100644 --- a/lib/sisu/v5/epub_tune.rb +++ b/lib/sisu/v5/epub_tune.rb @@ -80,7 +80,7 @@ module SiSU_EPUB_Tune def initialize(data,md) @data,@md=data,md @file=SiSU_Env::FileOp.new(@md) - @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX + @cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX end def hard_output @filename_tune=@file.write_file_processing.html_tune @@ -121,13 +121,17 @@ module SiSU_EPUB_Tune end def songsheet begin - @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX - SiSU_Screen::Ansi.new(@md.opt.cmd,'Tune').txt_grey if @md.opt.cmd =~/[MVv]/ + @cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Tune').txt_grey + end data=SiSU_EPUB_Tune::Tune.new(@data,@md).amp_angle_brackets data=SiSU_EPUB_Tune::Tune.new(data,@md).endnotes_html data=SiSU_EPUB_Tune::Tune.new(data,@md).url_markup data=SiSU_EPUB_Tune::Tune.new(data,@md).markup - if @md.opt.cmd =~/M/ #Hard Output Tune Optional on/off here + if @md.opt.act[:maintenance][:set]==:on #Hard Output Tune Optional on/off here data=SiSU_EPUB_Tune::Output.new(data,@md).hard_output SiSU_EPUB_Tune::Output.new(data,@md).marshal end diff --git a/lib/sisu/v5/git.rb b/lib/sisu/v5/git.rb index 73cce507..92322b7c 100644 --- a/lib/sisu/v5/git.rb +++ b/lib/sisu/v5/git.rb @@ -81,12 +81,6 @@ module SiSU_Git fnt=@opt.fns[m,2] end git_path_fnb=@env.processing_path.git + '/' + fnb - #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_title_hi - # SiSU_Screen::Ansi.new(@opt.cmd,"Git path","#{@opt.fns} -> #{@git_path[:fnb]}").warn if @opt.cmd =~/[MVv]/ - #end lng=(@md.opt.lng) ? (@md.opt.lng) : (@md.i18n[0]) @git_path={ fnb: git_path_fnb, @@ -113,11 +107,17 @@ module SiSU_Git #if program_found? # git_commit #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_title_hi - SiSU_Screen::Ansi.new(@opt.cmd,"Git path","#{@opt.fns} -> #{@git_path[:fnb]}").warn if @opt.cmd =~/[MVv]/ + unless @opt.act[:quiet][: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],'Git path',@git_path[:fnb]).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Git path',@git_path[:fnb]).green_title_hi + 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],"Git path","#{@opt.fns} -> #{@git_path[:fnb]}").warn + end end end def program_found? @@ -190,7 +190,7 @@ module SiSU_Git def locate_parse_file composite_src=@opt.fns=~/\.ssm$/ ? true : false if composite_src \ - and @opt.cmd.inspect !~/m/ + and not @opt.act[:dal][:set]==:on ##SiSU_Assemble::Composite.new(@opt).read #SiSU_DAL::Source.new(@opt).read # -m "#{@env.processing_path.composite_file}/#{@opt.fnb}.ssm.sst" diff --git a/lib/sisu/v5/harvest.rb b/lib/sisu/v5/harvest.rb index ffcb6aa3..8ff7cc31 100644 --- a/lib/sisu/v5/harvest.rb +++ b/lib/sisu/v5/harvest.rb @@ -100,10 +100,10 @@ WOK def cases(opt,env) case opt.mod.inspect when/--harvest/i - css(opt) if opt.cmd.inspect =~/M/ + css(opt) if @opt.act[:maintenance][:set]==:on SiSU_HarvestAuthors::Songsheet.new(opt,env).songsheet SiSU_HarvestTopics::Songsheet.new(opt,env).songsheet - if opt.cmd.inspect =~/R/ + if @opt.act[:rsync][:set]==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(opt).rsync_harvest end diff --git a/lib/sisu/v5/harvest_authors.rb b/lib/sisu/v5/harvest_authors.rb index c78971e4..a442df0c 100644 --- a/lib/sisu/v5/harvest_authors.rb +++ b/lib/sisu/v5/harvest_authors.rb @@ -197,8 +197,11 @@ module SiSU_HarvestAuthors file="#{harvest_pth}/authors.#{lng}.html" end FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth) - fileinfo=(@opt.cmd =~/[vVM]/) ? ("file://#{file}") : '' - SiSU_Screen::Ansi.new(@opt.cmd,"harvest authors (#{@opt.files.length} files)",fileinfo).dark_grey_title_hi unless @opt.cmd =~/q/ + fileinfo=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + ? ("file://#{file}") : '' + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"harvest authors (#{@opt.files.length} files)",fileinfo).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on @output[lng][:html]=File.new(file,'w') end end @@ -293,7 +296,7 @@ WOK end def html_head @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << html_head_adjust(lng,'maintenance') if @opt.cmd.inspect =~/M/ + @output[lng][:html_mnt] << html_head_adjust(lng,'maintenance') if @opt.act[:maintenance][:set]==:on @output[lng][:html] << html_head_adjust(lng) end end @@ -307,7 +310,7 @@ WOK end a=a.join @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << a if @opt.cmd.inspect =~/M/ + @output[lng][:html_mnt] << a if @opt.act[:maintenance][:set]==:on @output[lng][:html] << a end end diff --git a/lib/sisu/v5/harvest_topics.rb b/lib/sisu/v5/harvest_topics.rb index eef5a2e2..bb2d7959 100644 --- a/lib/sisu/v5/harvest_topics.rb +++ b/lib/sisu/v5/harvest_topics.rb @@ -150,7 +150,10 @@ module SiSU_HarvestTopics else { filename: filename, file: file, rough_idx: @idx_list, title: @fulltitle, author: creator, page: page, lang: lang } end else - p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" if @opt.cmd.inspect =~/[VM]/ + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" + end end idx_array[lang]=idx_array[lang].flatten idx_array @@ -472,10 +475,14 @@ module SiSU_HarvestTopics file="#{harvest_pth}/topics.#{lng}.html" end FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth) - fileinfo=(@opt.cmd =~/[vVM]/) ? ("file://#{file}") : '' - SiSU_Screen::Ansi.new(@opt.cmd,"harvest topics(#{@opt.files.length} files)",fileinfo).dark_grey_title_hi unless @opt.cmd =~/q/ + fileinfo=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + ? ("file://#{file}") + : '' + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"harvest topics(#{@opt.files.length} files)",fileinfo).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on @output[lng][:html]=File.new(file,'w') - if @opt.cmd.inspect =~/[M]/ + if @opt.act[:maintenance][:set]==:on @output[lng][:html_mnt]=File.new("#{@env.path.pwd}/topics.html",'w') end end @@ -651,7 +658,7 @@ WOK end def html_head @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << html_head_adjust(lng,'maintenance') if @opt.cmd.inspect =~/M/ + @output[lng][:html_mnt] << html_head_adjust(lng,'maintenance') if @opt.act[:maintenance][:set]==:on @output[lng][:html] << html_head_adjust(lng) end end @@ -665,7 +672,7 @@ WOK end a=a.join @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << a if @opt.cmd.inspect =~/M/ + @output[lng][:html_mnt] << a if @opt.act[:maintenance][:set]==:on @output[lng][:html] << a end end diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index f0b22285..f1abe6c0 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -95,14 +95,21 @@ module SiSU_HTML primary_output_file=(@opt.act[:html_seg][:set]==:on) \ ? (@md.file.output_path.html_seg.dir + '/' + @md.file.base_filename.html_segtoc) : (@md.file.output_path.html_scroll.dir + '/' + @md.file.base_filename.html_scroll) - unless @opt.cmd =~/q/ - tool=(@opt.cmd =~/[MVvz]/) \ + unless @opt.act[:quiet][:set]==:on + tool=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ ? ("#{@env.program.web_browser} file://#{primary_output_file}") : ("[#{@opt.f_pth[:lng_is]}] #{@opt.fno}") - @opt.cmd=~/[MVvz]/ \ - ? 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://#{primary_output_file}").flow if @opt.cmd =~/[MV]/ + (@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],'HTML',tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'HTML',tool).green_title_hi + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{primary_output_file}").flow + end end data=nil tuned_file_array=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions @@ -128,7 +135,8 @@ module SiSU_HTML __LINE__.to_s + ':' + __FILE__ end ensure - unless @opt.cmd =~/[MV]/ #check maintenance flag + unless (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) texfiles=Dir["#{@env.processing_path.tune}/#{@opt.fns}*"] texfiles.each do |f| if FileTest.file?(f) @@ -153,7 +161,7 @@ module SiSU_HTML @env,@css=particulars.env,SiSU_Style::CSS.new end def tuned_file_instructions - @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) + @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) dal_array=@particulars.dal_array # dal file drawn here tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet tuned_file_array @@ -232,10 +240,14 @@ module SiSU_HTML def initialize(md=nil,data='') @data,@md=data,md @vz=SiSU_Viz::Defaults.new - @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md + @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md end def songsheet #extracts toc for scroll & seg - SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Toc').txt_grey + end toc=nil @@firstseg=nil @@toc={ seg: [], seg_mini: [], scr: [] } @@ -543,7 +555,11 @@ WOK def in_common toc_shared=[] @segtoc=[] - SiSU_Screen::Ansi.new(@md.opt.cmd,'Scroll & Segtoc').txt_grey if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Scroll & Segtoc').txt_grey + end format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) dochead=format_head_toc.head dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index aee090cd..c087f1ec 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -911,7 +911,7 @@ WOK @ocn=((defined? t_o.ocn) ? t_o.ocn.to_s : nil) @headname=((t_o.is==:heading and defined? t_o.name) ? t_o.name : nil) else - if @md.opt.cmd =~/M/ + if @md.opt.act[:maintenance][:set]==:on p t_o.class p caller end diff --git a/lib/sisu/v5/html_minitoc.rb b/lib/sisu/v5/html_minitoc.rb index c59537d9..71128c2f 100644 --- a/lib/sisu/v5/html_minitoc.rb +++ b/lib/sisu/v5/html_minitoc.rb @@ -70,10 +70,14 @@ def initialize(md,data) @md,@data=md,data @pat_strip_heading_name=/(.+?)<\/a>/ - @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md + @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md end def songsheet - SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Toc').txt_grey + end toc=nil @toc=[] @data.each do |txt| diff --git a/lib/sisu/v5/html_promo.rb b/lib/sisu/v5/html_promo.rb index cd57e5fd..8b26a689 100644 --- a/lib/sisu/v5/html_promo.rb +++ b/lib/sisu/v5/html_promo.rb @@ -416,7 +416,7 @@ WOK end end else - SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* category not found: #{category}").warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* category not found: #{category}").warn unless @md.opt.act[:quiet][:set]==:on end adverts.join end diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb index 8d7ec675..79dda0e2 100644 --- a/lib/sisu/v5/html_segments.rb +++ b/lib/sisu/v5/html_segments.rb @@ -206,7 +206,11 @@ module SiSU_HTML_Seg @@seg_name_html=@@seg_name @@seg_total=@@seg_name.length testforartnum=@@seg_name_html - SiSU_Screen::Ansi.new(@md.opt.cmd,@@seg_name.length).segmented if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@@seg_name.length).segmented + end map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags data.each do |dob| if defined? dob.obj \ diff --git a/lib/sisu/v5/html_tune.rb b/lib/sisu/v5/html_tune.rb index ceadcf50..8ed292c7 100644 --- a/lib/sisu/v5/html_tune.rb +++ b/lib/sisu/v5/html_tune.rb @@ -80,7 +80,7 @@ module SiSU_HTML_Tune def initialize(data,md) @data,@md=data,md @file=SiSU_Env::InfoFile.new(@md.fns) - @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX + @cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX end def hard_output @filename_tune=@file.write_file_processing.html_tune @@ -124,11 +124,15 @@ module SiSU_HTML_Tune end def songsheet begin - @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX - SiSU_Screen::Ansi.new(@md.opt.cmd,'Tune').txt_grey if @md.opt.cmd =~/[MVv]/ + @cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Tune').txt_grey + end songsheet_array(@data) #data=songsheet_array(@data) - if @md.opt.cmd =~/M/ #Hard Output Tune Optional on/off here + if @md.opt.act[:maintenance][:set]==:on #Hard Output Tune Optional on/off here SiSU_HTML_Tune::Output.new(@data,@md).hard_output SiSU_HTML_Tune::Output.new(@data,@md).marshal end diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index fcbaa67a..6893e2ad 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -154,7 +154,7 @@ module SiSU end end if files_translated_idx.flatten.length > 1 - SiSU_Screen::Ansi.new(@opt.cmd,'Manifest re-run on (currently generated) translated files',"").grey_title_hi unless @opt.act[:quiet][:set] ==:on + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manifest re-run on (currently generated) translated files',"").grey_title_hi unless @opt.act[:quiet][:set] ==:on files_translated_idx.flatten.each do |i| @opt.fns=@opt.files[i] @opt.f_pth=@opt.f_pths[i] @@ -291,74 +291,74 @@ module SiSU end end if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q - require_relative 'qrcode' # -Q qrcode.rb + require_relative 'qrcode' # qrcode.rb SiSU_QRcode::Source.new(@opt).read end if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree - require_relative 'digests' # -N digests.rb + require_relative 'digests' # digests.rb SiSU_DigestView::Source.new(@opt).read end if @opt.act[:txt][:set]==:on #% --txt, -t -a - require_relative 'plaintext' # -t -a plaintext.rb + require_relative 'plaintext' # plaintext.rb SiSU_Plaintext::Source.new(@opt).read end - if @opt.act[:html][:set]==:on #% --html, -h - require_relative 'html' # -h -H html.rb + if @opt.act[:html][:set]==:on #% --html, -h -H + require_relative 'html' # html.rb SiSU_HTML::Source.new(@opt).read else - if @opt.act[:html_seg][:set]==:on #% --html-seg - require_relative 'html' # -h -H html.rb + if @opt.act[:html_seg][:set]==:on #% --html-seg (-h -H) + require_relative 'html' # html.rb SiSU_HTML::Source.new(@opt).read end - if @opt.act[:html_scroll][:set]==:on #% --html-scroll - require_relative 'html' # -h -H html.rb + if @opt.act[:html_scroll][:set]==:on #% --html-scroll (-h -H) + require_relative 'html' # html.rb SiSU_HTML::Source.new(@opt).read end end if @opt.act[:concordance][:set]==:on #% --concordance, -w - require_relative 'concordance' # -w concordance.rb + require_relative 'concordance' # concordance.rb SiSU_Concordance::Source.new(@opt).read end if @opt.act[:epub][:set]==:on #% --epub, -e - require_relative 'epub' # -e epub.rb + require_relative 'epub' # epub.rb SiSU_EPUB::Source.new(@opt).read end if @opt.act[:odt][:set]==:on #% --odt, -o opendocument - require_relative 'odf' # -o odf.rb + require_relative 'odf' # odf.rb SiSU_ODF::Source.new(@opt).read end if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml - require_relative 'xhtml' # -b xhtml.rb + require_relative 'xhtml' # xhtml.rb SiSU_XHTML::Source.new(@opt).read end if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type - require_relative 'xml' # -x xml.rb + require_relative 'xml' # xml.rb SiSU_XML_SAX::Source.new(@opt).read end if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type - require_relative 'xml_dom' # -X xml_dom.rb + require_relative 'xml_dom' # xml_dom.rb SiSU_XML_DOM::Source.new(@opt).read end if @opt.act[:pdf][:set]==:on \ or @opt.act[:pdf_p][:set]==:on \ or @opt.act[:pdf_l][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf - require_relative 'texpdf' # -p texpdf.rb + require_relative 'texpdf' # texpdf.rb SiSU_TeX::Source.new(@opt).read end if @opt.act[:manpage][:set]==:on #% --manpage, -i - require_relative 'manpage' # -i manpage.rb + require_relative 'manpage' # manpage.rb SiSU_Manpage::Source.new(@opt).read end if @opt.act[:texinfo][:set]==:on #% --texinfo, -I - require_relative 'texinfo' # -I texinfo.rb + require_relative 'texinfo' # texinfo.rb SiSU_TexInfo::Source.new(@opt).read end if @opt.act[:sqlite_discrete][:set]==:on #% --sqlite, -d DB sqlite - require_relative 'dbi_discrete' # -d dbi_discrete.rb + require_relative 'dbi_discrete' # dbi_discrete.rb SiSU_DBI_Discrete::SQL.new(@opt).build end if @opt.act[:manifest][:set]==:on #% --manifest, -y - require_relative 'manifest' # -y manifest.rb + require_relative 'manifest' # manifest.rb ((@opt.act[:sisupod][:set]==:on \ || @opt.act[:share_source][:set]==:on) \ && @opt.files.length < 2 ) \ @@ -388,7 +388,6 @@ module SiSU SiSU_Source::SiSUpodSource.new(@opt).read end if @opt.act[:share_source][:set]==:on -#REDO require_relative 'share_src' # -s share_src.rb begin ensure @@ -431,7 +430,7 @@ module SiSU end ensure path_pod=@env.processing_path.processing_sisupod(@opt).paths - unless @opt.cmd =~/M/ + unless @opt.act[:maintenance][:set]==:on FileUtils::rm_rf("#{path_pod[:sisupod]}/*") if FileTest.directory?(path_pod[:sisupod]) end end @@ -512,13 +511,13 @@ module SiSU end end def do_initialization - @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX + @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX SiSU_Env::InfoProcessingFlag.new - if @opt.act[:version_info][:set]==:on #% version information + if @opt.act[:version_info][:set]==:on #% version information SiSU_Env::InfoAbout.new(@opt).sisu_version end if @opt.act[:dal][:set]==:on \ - or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C + or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C path={} path[:css]=@@env.path.output + '/_sisu/css' path[:xml]=@@env.path.output + '/_sisu/xml' @@ -563,10 +562,10 @@ module SiSU end end end - if @opt.act[:sample_search_form][:set]==:on #% --sample-search-form, -F cgi sample search form + if @opt.act[:sample_search_form][:set]==:on #% --sample-search-form, -F cgi sample search form SiSU::Operations.new(@opt).cgi end - if @opt.act[:webrick][:set]==:on #% --webrick, -W webrick + if @opt.act[:webrick][:set]==:on #% --webrick, -W webrick SiSU::Operations.new(@opt).webrick end if @opt.act[:dal][:set]==:on @@ -668,7 +667,7 @@ module SiSU SiSU_DBI::SQL.new(@opt).connect end elsif action_on_file_ == :true \ - or ( + or ( #% ---> @opt.cmd =~/^-/ \ and @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ @@ -678,8 +677,18 @@ module SiSU if action_on_file_ == :true \ and @opt.files.length > 0 do_loops - @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil if @opt.cmd =~/[vVM]/ - @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty? + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil + end + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on \ + || @opt.act[:urls_selected][:set]==:on \ + || @opt.act[:urls_all][:set]==:on) + @tell.call.print_brown unless @opt.files.join.empty? + end if defined? @@env.processing_path.processing \ and @@env.user \ and FileTest.directory?(@@env.processing_path.processing) \ @@ -691,7 +700,10 @@ module SiSU elsif action_on_file_ == :true \ and @opt.files.length == 0 STDERR.puts %{requested action requires valid sisu markup file [filename (.sst .ssm)] or wildcard (that includes a valid filename)} - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:fuchsia) if @opt.cmd =~/[MV]/ + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:fuchsia) + end end elsif @opt.mod.inspect =~/--query/ require_relative 'sst_identify_markup' # sst_identify_markup.rb @@ -727,7 +739,7 @@ module SiSU if @opt.fns =~/\.ssm\.sst$/ \ and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files @msg,@msgs='temporary file removed',nil - @tell.call.warn unless @opt.cmd =~/V/ + @tell.call.warn unless @opt.act[:quiet][:set]==:on File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER end else #SiSU::Operations.new(fns,'html').not_found diff --git a/lib/sisu/v5/manifest.rb b/lib/sisu/v5/manifest.rb index a8e6bb25..071959c7 100644 --- a/lib/sisu/v5/manifest.rb +++ b/lib/sisu/v5/manifest.rb @@ -86,12 +86,17 @@ module SiSU_Manifest xbrowser=@env.program.web_browser browser=@env.program.console_web_browser # webserv_url=@env.path.url.output_tell #fix in sysenv - unless @opt.cmd =~/q/ + unless @opt.act[:quiet][:set]==:on 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',"[#{@opt.f_pth[:lng_is]}]", "#{url_html}").grey_title_grey_blue - SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i + (@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],'Manifest',"#{xbrowser} #{url_html}").green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manifest',"[#{@opt.f_pth[:lng_is]}]", "#{url_html}").grey_title_grey_blue + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"#{browser} #{url_html}").grey_tab + end end data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions SiSU_Manifest::Source::Output.new(@md).check_output(data) @@ -162,7 +167,11 @@ module SiSU_Manifest dgst=(@dg =~/^sha(?:2|256)$/) \ ? sys.sha256("#{pth}/#{file}") : sys.md5("#{pth}/#{file}") - SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"#{dgst[1]} #{file}").warn + end size=(File.size("#{pth}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" diff --git a/lib/sisu/v5/manpage.rb b/lib/sisu/v5/manpage.rb index dc0d6203..3e430b55 100644 --- a/lib/sisu/v5/manpage.rb +++ b/lib/sisu/v5/manpage.rb @@ -85,14 +85,21 @@ module SiSU_Manpage begin @md=SiSU_Param::Parameters.new(@opt).get @env=SiSU_Env::InfoEnv.new(@opt.fns) - tool=(@opt.cmd =~/[MVv]/) \ + tool=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ ? "#{@env.program.text_editor} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" - @opt.cmd=~/[MVvz]/ \ + (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ && @opt.cmd !~/q/ \ - ? 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]/ + ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manpage',tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manpage',tool).green_title_hi + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").flow + end @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here SiSU_Manpage::Source::Scroll.new(@md,@dal_array).songsheet rescue diff --git a/lib/sisu/v5/odf.rb b/lib/sisu/v5/odf.rb index f52d98e1..ae9a09ec 100644 --- a/lib/sisu/v5/odf.rb +++ b/lib/sisu/v5/odf.rb @@ -82,14 +82,21 @@ module SiSU_ODF def read begin @md,@env,@dal_array=@particulars.md,@particulars.env,@particulars.dal_array - unless @opt.cmd =~/q/ - tool=(@opt.cmd =~/[MVv]/) \ + unless @opt.act[:quiet][:set]==:on + tool=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ ? "#{@env.program.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" - @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_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]/ + (@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],'Opendocument (ODF:ODT)',tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Opendocument (ODF:ODT)',tool).green_title_hi + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").flow + end end SiSU_ODF::Source::Scroll.new(@particulars).songsheet rescue @@ -112,7 +119,8 @@ module SiSU_ODF @vz=SiSU_Viz::Defaults.new @tab="\t" @brace_url=SiSU_Viz::Defaults.new.url_decoration - @br=(@md.opt.cmd =~/M/) ? '' : '' + @br=(@md.opt.act[:maintenance][:set]==:on) \ + ? '' : '' #@br=(@md.opt.cmd =~/M/) ? "\n" : '' end def songsheet @@ -121,7 +129,8 @@ module SiSU_ODF @data=markup(@dal_array) publish ensure - unless @md.opt.cmd =~/[MV]/ #check maintenance flag + unless (@md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) if @env.processing_path.odt =~/od[ft]/ #p "rm -r #{@env.processing_path.odt}" if @md.opt.cmd =~/v/ FileUtils::rm_r(@env.processing_path.odf_pth) @@ -215,7 +224,7 @@ module SiSU_ODF if FileTest.file?("#{img_src}/#{i}") img_src else - SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_include_local},#{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_include_local},#{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on nil end elsif @md.fns =~/\.ss[tm]$/ \ @@ -228,7 +237,7 @@ module SiSU_ODF and FileTest.file?("#{@env.path.image_source_include_remote}/#{i}") @env.path.image_source_include_remote else - SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_include_local},#{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:",%{"#{i}" missing},"search locations: #{@env.path.image_source_include_local},#{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on nil end end @@ -712,7 +721,7 @@ module SiSU_ODF WOK x=x.strip - x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/ + x=x.gsub(/\n+/m,'') unless @md.opt.act[:maintenance][:set]==:on x else '' end @@ -730,7 +739,7 @@ WOK WOK x=x.strip - x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/ + x=x.gsub(/\n+/m,'') unless @md.opt.act[:maintenance][:set]==:on @@odf[:head] << x end def publish diff --git a/lib/sisu/v5/odf_format.rb b/lib/sisu/v5/odf_format.rb index 018fba83..d3630df9 100644 --- a/lib/sisu/v5/odf_format.rb +++ b/lib/sisu/v5/odf_format.rb @@ -282,7 +282,7 @@ module SiSU_ODF_Format WOK x=x.strip - x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/ + x=x.gsub(/\n+/m,'') unless @md.opt.act[:maintenance][:set]==:on x end def meta_inf_manifest_xml(md) @@ -312,7 +312,7 @@ WOK WOK x=x.strip - x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/ + x=x.gsub(/\n+/m,'') unless @md.opt.act[:maintenance][:set]==:on x end def meta_xml @@ -328,7 +328,7 @@ WOK WOK x=x.strip - x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/ + x=x.gsub(/\n+/m,'') unless @md.opt.act[:maintenance][:set]==:on x end def settings_xml @@ -431,7 +431,7 @@ WOK WOK x=x.strip - x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/ + x=x.gsub(/\n+/m,'') unless @md.opt.act[:maintenance][:set]==:on x end def styles_xml @@ -632,7 +632,7 @@ WOK WOK x=x.strip - x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/ + x=x.gsub(/\n+/m,'') unless @md.opt.act[:maintenance][:set]==:on x end def mimetype diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index 422762d1..6f23d5a1 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -630,38 +630,6 @@ module SiSU_Commandline else { bool: false, set: :na, inst: nil } end - act[:verbose]=(cmd =~/v/ \ - || mod.inspect =~/"--verbose"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:version_info]=(cmd =~/[vVM]/ \ - || mod.inspect =~/"--verbose"|"--maintenance"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:quiet]=(cmd =~/q/ \ - || mod.inspect =~/"--quiet"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ - { bool: true, set: :on } - elsif (cmd =~/k/ \ - || mod.inspect =~/"--color-off"/) - { bool: false, set: :off } - else { bool: true, set: :na } #fix default color - end -# act[:color_toggle]=if cmd =~/c/ \ -# or mod.inspect =~/"--color-toggle"/ -# true -# else false -# end - act[:maintenance]=(cmd =~/M/ \ - || mod.inspect =~/"--maintenance|--keep-processing-files"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:profile]=(cmd =~/E/ \ - || mod.inspect =~/"--profile"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } act[:switch]=if mod.inspect =~/"--switch-off=/ off_list=mod.join(';').gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1') off_list=off_list.scan(/[^,;\s]+/) @@ -806,10 +774,6 @@ module SiSU_Commandline { bool: false, set: :off } else { bool: true, set: :na } end - act[:dal]=(cmd =~/m/ \ - || mod.inspect =~/"--dal"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } act[:html]=if (cmd =~/h/ \ || mod.inspect =~/"--html"/) act[:html_scroll]={ bool: true, set: :on } @@ -978,7 +942,7 @@ module SiSU_Commandline ? { bool: true, set: :on } : { bool: false, set: :na } act[:rsync]=(cmd =~/R/ \ - || mod.inspect =~/"--rsync"/) \ + || mod.inspect =~/"--rsync"|"--remote"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } act[:zap]=(cmd =~/Z/ \ @@ -1004,6 +968,141 @@ module SiSU_Commandline act[:help]=(mod.inspect =~/"--help/) \ ? { bool: true, set: :on } : { bool: false, set: :na } + act[:dal]=if (cmd =~/m/ \ + || mod.inspect =~/"--dal"/) + { bool: true, set: :on } + elsif (act[:txt][:set]==:on \ + || act[:xhtml][:set]==:on \ + || act[:epub][:set]==:on \ + || act[:html][:set]==:on \ + || act[:html_seg][:set]==:on \ + || act[:html_scroll][:set]==:on \ + || act[:texinfo][:set]==:on \ + || act[:manpage][:set]==:on \ + || act[:hash_digests][:set]==:on \ + || act[:odt][:set]==:on \ + || act[:pdf][:set]==:on \ + || act[:pdf_p][:set]==:on \ + || act[:pdf_l][:set]==:on \ + || act[:qrcode][:set]==:on \ + || act[:share_source][:set]==:on \ + || act[:sisupod][:set]==:on \ + || act[:concordance][:set]==:on \ + || act[:xml_dom][:set]==:on \ + || act[:xml_sax][:set]==:on ) + { bool: true, set: :on } + #if cmd !~/[mn]/ + # extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \ + # and cmd !~/[mn]/ + # 'm' #% add dal + #elsif (act[:txt][:set]==:on \ + # { bool: true, set: :on } + # elsif ((cmd =~/[Dd]/ \ + # or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \ + # and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \ + # and cmd !~/[mn]/ + # 'm' #% add dal + else + { bool: false, set: :na } + end + act[:manifest]=if mod.inspect =~/"--inc-manifest"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \ + || act[:switch][:off].inspect =~/"manifest"/ + { bool: false, set: :off } + elsif (cmd =~/y/ \ + || mod.inspect =~/"--manifest"/) + { bool: true, set: :on } + elsif (act[:txt][:set]==:on \ + || act[:xhtml][:set]==:on \ + || act[:epub][:set]==:on \ + || act[:html][:set]==:on \ + || act[:html_seg][:set]==:on \ + || act[:html_scroll][:set]==:on \ + || act[:texinfo][:set]==:on \ + || act[:manpage][:set]==:on \ + || act[:hash_digests][:set]==:on \ + || act[:odt][:set]==:on \ + || act[:pdf][:set]==:on \ + || act[:pdf_p][:set]==:on \ + || act[:pdf_l][:set]==:on \ + || act[:qrcode][:set]==:on \ + || act[:share_source][:set]==:on \ + || act[:sisupod][:set]==:on \ + || act[:concordance][:set]==:on \ + || act[:xml_dom][:set]==:on \ + || act[:xml_sax][:set]==:on ) + { bool: true, set: :on } + ## if cmd !~/y/ + ## extra+=if cmd =~/[abeHhIiNopQSstwXxz]/ \ + ## and cmd !~/y/ + ## 'ym' #% add manifest + #elsif (act[:txt][:set]==:on \ + # { bool: true, set: :on } + # elsif (cmd =~/[Dd]/ \ + # or mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \ + # and files[0] !~/^remove$/ \ + # and cmd !~/y/ + # 'ym' #% add manifest + else { bool: true, set: :na } + end + act[:console_messages] = '' + act[:verbose]=if (cmd =~/v/ \ + || mod.inspect =~/"--verbose"/) + act[:console_messages] << ' --verbose ' + { bool: true, set: :on } + else + { bool: false, set: :na } + end + act[:verbose_plus]=if (cmd =~/V/ \ + || mod.inspect =~/"--very-verbose"/) + act[:console_messages] << ' --very-verbose ' + { bool: true, set: :on } + else + { bool: false, set: :na } + end + act[:version_info]=if (cmd =~/[vVM]/ \ + || mod.inspect =~/"--verbose"|"--maintenance"/) + act[:console_messages] << ' --maintenance ' + { bool: true, set: :on } + else + { bool: false, set: :na } + end + act[:quiet]=if (cmd =~/q/ \ + || mod.inspect =~/"--quiet"/) + act[:console_messages] << ' --quiet ' + { bool: true, set: :on } + else + { bool: false, set: :na } + end + act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ + act[:console_messages] << ' --color-on ' + { bool: true, set: :on } + elsif (cmd =~/k/ \ + || mod.inspect =~/"--color-off"/) + act[:console_messages] << ' --color-off ' + { bool: false, set: :off } + else { bool: true, set: :na } #fix default color + end +# act[:color_toggle]=if cmd =~/c/ \ +# or mod.inspect =~/"--color-toggle"/ +# true +# else false +# end + act[:maintenance]=if (cmd =~/M/ \ + || mod.inspect =~/"--maintenance|--keep-processing-files"/) + act[:console_messages] << ' --maintenance ' + { bool: true, set: :on } + else + { bool: false, set: :na } + end + act[:profile]=if (cmd =~/E/ \ + || mod.inspect =~/"--profile"/) + act[:console_messages] << ' --color-off ' + { bool: true, set: :on } + else + { bool: false, set: :na } + end @act=act end end @@ -1072,6 +1171,6 @@ module SiSU_Commandline end end __END__ -note usually named @opt is carried in Param usually as @md @opt is a subset of -@md where @md is passed, contents of @opt are available as @md.opt passing @opt -as well is duplication check for fns & fnb +note usually named @opt is carried in Param (usually as @md.opt), @opt is a +subset of @md where @md is passed, contents of @opt are available as @md.opt +passing @opt as well is duplication check for fns & fnb diff --git a/lib/sisu/v5/param.rb b/lib/sisu/v5/param.rb index 0720f943..e8144a5e 100644 --- a/lib/sisu/v5/param.rb +++ b/lib/sisu/v5/param.rb @@ -78,7 +78,7 @@ module SiSU_Param @@md=@@fns=@@pth=nil def initialize(opt) @opt=opt - @cX||=SiSU_Screen::Ansi.new(opt.cmd) + @cX||=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]) @cmd,@mod=opt.cmd,opt.mod @fns=if @opt.cmd =~/P/ #revisit CHECK opt.fns @@ -105,7 +105,7 @@ module SiSU_Param @@md=nil end if @@md.nil? \ - or @opt.cmd =~/M/ #not particularly helpful, as current cycle is through output types, with files changing, only helpful if deal with a file all output types before going to next file + or @opt.act[:maintenance][:set]==:on #not particularly helpful, as current cycle is through output types, with files changing, only helpful if deal with a file all output types before going to next file if File.exist?(@pstorefile) param_msg='Parameters from pstore' store=PStore.new(@pstorefile) @@ -120,7 +120,11 @@ module SiSU_Param @md end if defined? @md.title.main # on removal check problems with -U - SiSU_Screen::Ansi.new(@opt.cmd,param_msg,@md.title.main).txt_grey if @opt.cmd =~/[MVv]/ + 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],param_msg,@md.title.main).txt_grey + end end @@md=@md else @@md @@ -178,7 +182,7 @@ module SiSU_Param STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" s else - SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.act[:quiet][:set]==:on nil end end @@ -499,7 +503,7 @@ module SiSU_Param elsif @h['main'] @h['main'] else - SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.act[:quiet][:set]==:on '' end l,n=Db[:col_info_note],'rights.copyright.text' @@ -598,7 +602,7 @@ module SiSU_Param s +='\\\\ License: ' + copyright.license end if s.empty? - SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.act[:quiet][:set]==:on else l,n=Db[:col_info_note],'rights.all' validate_length(s,l,n) @@ -894,7 +898,10 @@ module SiSU_Param @prog=SiSU_Env::InfoSettings.new @sys=SiSU_Env::SystemCall.new @env=SiSU_Env::InfoEnv.new(@fns) #watch - puts 'system locale: ' + @sys.locale if @opt.cmd =~/[MV]/ + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + puts 'system locale: ' + @sys.locale + end if @prog.wc \ and @sys.wc wc=%x{wc #{fns}} @@ -1104,7 +1111,7 @@ module SiSU_Param ? " #{@creator.author}" : '' title=%{"#{@title.full.gsub(/(

|

|
|
)/,'')}",} - SiSU_Screen::Ansi.new(@opt.cmd,'Parameters',%{#{title}#{creator}}).txt_grey if @opt.cmd =~/v/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Parameters',%{#{title}#{creator}}).txt_grey if @opt.act[:verbose][:set]==:on end if not @book_idx \ and para =~/^=\{(.+?)\}\s*$/ @@ -1163,8 +1170,9 @@ module SiSU_Param end end #% here endeth the document loop unless @make - if @opt.cmd =~/[VM]/ - SiSU_Screen::Ansi.new(@opt.cmd,'@make:','header absent').warn + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'@make:','header absent').warn end @make=SiSU_Param::Parameters::MdMake.new('@make: ',@opt,@env).make end @@ -1295,13 +1303,13 @@ module SiSU_Param if @en[:note] > 0 \ and @en[:sum] > 0 if @en[:sum] > 0 - else SiSU_Screen::Ansi.new(@opt.cmd,'*WARN* both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn if @opt.cmd !~/q/ + else SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'*WARN* both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn unless @opt.act[:unless][:set]==:on end end if @en[:mark] != @en[:note] \ and @en[:note] > 0 @en[:mismatch]=@en[:note] - @en[:mark] - SiSU_Screen::Ansi.new(@opt.cmd,'*WARN* endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn if @opt.cmd !~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'*WARN* endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn unless @opt.act[:quiet][:set]==:on footnote_conversion_errors=File.new("#{Dir.pwd}/footnote_conversion_errors.txt",'a') footnote_conversion_errors << "#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})\n" end @@ -1312,7 +1320,7 @@ module SiSU_Param and @opt.inspect =~/P/ #@title=Md.new('Text Insert',@opt,@env).title else - SiSU_Screen::Ansi.new(@opt.cmd,'WARNING: Document Title missing','please provide @title:').warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING: Document Title missing','please provide @title:').warn unless @opt.act[:unless][:set]==:on end end if @author !~/[\S]/ @@ -1320,7 +1328,7 @@ module SiSU_Param and @opt.inspect =~/P/ #@creator=SiSU_Param::Md.new('Text Insert',@opt,@env).creator else - SiSU_Screen::Ansi.new(@opt.cmd,'WARNING: Document Author missing','please provide @creator: :author:').warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING: Document Author missing','please provide @creator: :author:').warn unless @opt.act[:unless][:set]==:on end end @struct={} @@ -1400,7 +1408,10 @@ module SiSU_Param begin pstorefile="#{@env.processing_path.dal}/#{@md.fns}.pstore" File.unlink(pstorefile) if FileTest.file?(pstorefile) - SiSU_Screen::Ansi.new(@md.opt.cmd,"PStore -> #{pstorefile}").txt_grey if @md.opt.cmd =~/[MV]/ + if (@md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"PStore -> #{pstorefile}").txt_grey + end store=PStore.new(pstorefile) store.transaction do store['md']=@md diff --git a/lib/sisu/v5/param_make.rb b/lib/sisu/v5/param_make.rb index ec538ccb..2382532a 100644 --- a/lib/sisu/v5/param_make.rb +++ b/lib/sisu/v5/param_make.rb @@ -76,7 +76,7 @@ module SiSU_Param_Make STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" s else - SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.act[:quiet][:set]==:on nil end end diff --git a/lib/sisu/v5/plaintext.rb b/lib/sisu/v5/plaintext.rb index 443b274b..f7c40d7a 100644 --- a/lib/sisu/v5/plaintext.rb +++ b/lib/sisu/v5/plaintext.rb @@ -65,7 +65,7 @@ module SiSU_Plaintext require_relative 'sysenv' # sysenv.rb include SiSU_Env require_relative 'plaintext_format' # plaintext_format.rb - include SiSU_PlaintextFormat + include SiSU_Plaintext_Format require_relative 'shared_metadata' # shared_metadata.rb require_relative 'shared_txt' # shared_txt.rb include SiSU_Param @@ -83,14 +83,21 @@ module SiSU_Plaintext begin md=SiSU_Param::Parameters.new(@opt).get env=SiSU_Env::InfoEnv.new(@opt.fns) - unless @opt.cmd =~/q/ - tool=(@opt.cmd =~/[MVv]/) \ + unless @opt.act[:quiet][:set]==:on + tool=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ ? "#{env.program.text_editor} #{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" - @opt.cmd=~/[MVvz]/ \ - ? 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]/ + (@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],'Plaintext',tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Plaintext',tool).green_title_hi + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{md.file.output_path.txt.dir}/#{md.file.base_filename.txt}").flow + end end dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here wrap_width=if defined? md.make.plaintext_wrap \ @@ -155,15 +162,15 @@ module SiSU_Plaintext : (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,1,1)) wrap=util.line_wrap wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m - wrap.gsub(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <',@put).dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->',@put).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on @remote.rsync.document end def rsync_base - SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync').dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->','rsync').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on @remote.rsync.site_base end def rsync_base_sync - SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync and sync').dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->','rsync and sync').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on @remote.rsync.site_base_sync end def rsync_sitemaps - SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement sitemaps ->','rsync').dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement sitemaps ->','rsync').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on @remote.rsync_sitemaps end def rsync_harvest - SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement metadata harvest ->','rsync_harvest').dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement metadata harvest ->','rsync_harvest').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on @remote.rsync.site_harvest end def scp - SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put).dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->',@put).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on @remote.scp.document end def scp_base - SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement of base site ->','excluding images').dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement of base site ->','excluding images').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on @remote.scp.site_base end def scp_base_all - SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','complete').dark_grey_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Remote placement ->','complete').dark_grey_title_hi unless @opt.act[:quiet][:set]==:on @remote.scp.site_base_all end end @@ -108,7 +108,7 @@ module SiSU_Remote def initialize(opt,get_s) @opt,@get_s=opt,get_s @msg,@msgs='',nil - @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") } + @tell=lambda { SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@msg,"#{@msgs.inspect if @msgs}") } end def fns require 'open-uri' @@ -141,12 +141,12 @@ module SiSU_Remote images.delete_if {|x| x =~/https?:\/\// } images=images.sort @msg,@msgs='downloading images:', [ images.join(',') ] - @tell.call.warn unless @opt.cmd =~/q/ + @tell.call.warn unless @opt.act[:quiet][:set]==:on image_info=image_download_url + images SiSU_Assemble::RemoteImage.new.download_images(image_info) #SiSU_Assemble::RemoteImage.new.download_images(image_download_url,images) @msg,@msgs='downloading done',nil - @tell.call.warn unless @opt.cmd =~/q/ + @tell.call.warn unless @opt.act[:quiet][:set]==:on end downloaded_file.close end diff --git a/lib/sisu/v5/rexml.rb b/lib/sisu/v5/rexml.rb index 7c5cb6fb..40135202 100644 --- a/lib/sisu/v5/rexml.rb +++ b/lib/sisu/v5/rexml.rb @@ -91,10 +91,11 @@ module SiSU_Rexml xmlfile=IO.readlines(@fnap,'').join begin @xmldoc=REXML::Document.new xmlfile - SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','REXML',"XML document #{@fnap} loaded").colorize unless @md.opt.cmd =~/q/ #% tell - if @md.opt.cmd =~ /v/i #% substantive text + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','REXML',"XML document #{@fnap} loaded").colorize unless @md.opt.act[:quiet][:set]==:on + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on) @xmldoc.elements.each(@e_head) do |e| - SiSU_Screen::Ansi.new(@md.opt.cmd,'brown',e).colorize unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'brown',e).colorize unless @md.opt.act[:quiet][:set]==:on end end rescue REXML::ParseException @@ -102,7 +103,7 @@ module SiSU_Rexml end end else - SiSU_Screen::Ansi.new(@md.opt.cmd,'fuchsia',"File Not Found #{xmlfile}",'requested XML processing skipped').colorize unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'fuchsia',"File Not Found #{xmlfile}",'requested XML processing skipped').colorize unless @md.opt.act[:quiet][:set]==:on exit end rescue diff --git a/lib/sisu/v5/screen_text_color.rb b/lib/sisu/v5/screen_text_color.rb index 10ced907..4e4a319f 100644 --- a/lib/sisu/v5/screen_text_color.rb +++ b/lib/sisu/v5/screen_text_color.rb @@ -68,20 +68,11 @@ module SiSU_Screen end class Ansi < Color attr_reader :cX - def initialize(cmd,*txt) - @cmd,@txt=cmd,txt - @color_instruct=txt[0] - flag=SiSU_Env::InfoProcessingFlag.new - if cmd - #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off - @use_color=(flag.color) \ - ? ((cmd =~/c/) ? false : true) - : ((cmd =~/c/) ? true : false) - if cmd =~/k/ then @use_color=false # useful color off switch, however, k may be used for something else in future - end - else @use_color=false - end - @cX=@@cX= unless @use_color + def initialize(color_state,*txt) + @color_state,@txt=color_state,txt + @color_instruct=txt[0] #### + #flag=SiSU_Env::InfoProcessingFlag.new + @cX=@@cX=if color_state==:on Color.new do self.off=self.white=self.white_bold=self.marker=self.bold=self.underline=self.invert=self.darkgrey_hi=self.grey_hi=self.pink_hi=self.fuchsia_hi=self.red_hi=self.orange_hi=self.yellow_hi=self.brown_hi=self.lightgreen_hi=self.green_hi=self.cyan_hi=self.blue_hi=self.navy_hi=self.grey=self.pink=self.fuchsia=self.ruby=self.red=self.orange=self.yellow=self.brown=self.green=self.darkgreen=self.cyan=self.blue=self.navy=self.black='' end diff --git a/lib/sisu/v5/share_src.rb b/lib/sisu/v5/share_src.rb index cb93dee2..69dd7bb9 100644 --- a/lib/sisu/v5/share_src.rb +++ b/lib/sisu/v5/share_src.rb @@ -70,14 +70,17 @@ module SiSU_Markup @opt=opt end def read - unless @opt.cmd =~/q/ - @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Share document markup text source',@opt.fns).cyan_hi_blue - : SiSU_Screen::Ansi.new(@opt.cmd,'Share document markup text source',@opt.fns).cyan_title_hi + unless @opt.act[:quiet][: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],'Share document markup text source',@opt.fns).cyan_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Share document markup text source',@opt.fns).cyan_title_hi end if FileTest.directory?(@path_pod[:fnb]) FileUtils::mkdir_p(@file.output_path.src.dir) unless FileTest.directory?(@file.output_path.src.dir) - v=(@opt.cmd =~/M/) ? 'v' : '' + v=(@opt.act[:maintenance][:set]==:on) \ + ? 'v' : '' system(%{ rsync -a#{v} #{@path_pod[:fnb]} #{@file.output_path.sisupod.dir} chbk=`pwd` @@ -87,7 +90,11 @@ module SiSU_Markup cd ${chbk} }) else - SiSU_Screen::Ansi.new('',"#{@opt.fno} not available").blue_tab if @opt.cmd=~/[MVv]/ + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new('',"#{@opt.fno} not available").blue_tab + end end end end diff --git a/lib/sisu/v5/share_src_kdissert.rb b/lib/sisu/v5/share_src_kdissert.rb index 2ed26aec..b696891e 100644 --- a/lib/sisu/v5/share_src_kdissert.rb +++ b/lib/sisu/v5/share_src_kdissert.rb @@ -71,8 +71,8 @@ module SiSU_KdiSource @output_path="#{@env.path.output}/#{@opt.fnb}" end def read - SiSU_Screen::Ansi.new(@opt.cmd,'Share Kdissert Source Document!',@opt.fnb).green_hi_blue unless @opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@opt.cmd,"Copy kdissert file to output directory","#{@opt.fnb} -> #{@output_path}").warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Share Kdissert Source Document!',@opt.fnb).green_hi_blue unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Copy kdissert file to output directory","#{@opt.fnb} -> #{@output_path}").warn unless @opt.act[:quiet][:set]==:on FileUtils::mkdir_p(@env.path.output) unless FileTest.directory?(@env.path.output) FileUtils::mkdir_p(@output_path) unless FileTest.directory?(@output_path) if FileTest.directory?(@output_path) @@ -81,7 +81,7 @@ module SiSU_KdiSource FileUtils::cp(@opt.fnb,@output_path) end else - SiSU_Screen::Ansi.new(@opt.cmd,"Output directory does not exist","#{@opt.fnb} -> #{@output_path}").warn unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Output directory does not exist","#{@opt.fnb} -> #{@output_path}").warn unless @opt.act[:quiet][:set]==:on exit end end diff --git a/lib/sisu/v5/shared_markup_alt.rb b/lib/sisu/v5/shared_markup_alt.rb index f2fca338..827e547a 100644 --- a/lib/sisu/v5/shared_markup_alt.rb +++ b/lib/sisu/v5/shared_markup_alt.rb @@ -262,7 +262,7 @@ module SiSU_TextRepresentation elsif FileTest.file?("#{@env.path.image_source_include}/#{i}") @env.path.image_source_include else - SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:", %{"#{i}" missing}, "search locations: #{@env.path.image_source_include_local}, #{@env.path.image_source_include_remote} and #{@env.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on nil end img_type = /\S+\.(png|jpg|gif)/.match(i)[1] diff --git a/lib/sisu/v5/shared_sisupod_source.rb b/lib/sisu/v5/shared_sisupod_source.rb index bd9b2d36..f8a4058d 100644 --- a/lib/sisu/v5/shared_sisupod_source.rb +++ b/lib/sisu/v5/shared_sisupod_source.rb @@ -69,7 +69,9 @@ module SiSU_Source @date=SiSU_Env::InfoDate.new.dt @env=SiSU_Env::InfoEnv.new(opt.fns) @ver=SiSU_Env::InfoVersion.instance.get_version - @v=(opt.cmd =~/[VM]/) ? 'v' : '' + @v=(@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + ? 'v' : '' @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) @file=@particulars.file @local_path="#{@file.output_path.sisupod.dir}" @@ -91,9 +93,11 @@ module SiSU_Source } end def read - unless @opt.cmd =~/q/ - @opt.cmd=~/[MVv]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Assemble SiSU source',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_hi_blue + unless @opt.act[:quiet][: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],'Assemble SiSU source',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_hi_blue : '' end unless @opt.fns.empty? diff --git a/lib/sisu/v5/sisupod_make.rb b/lib/sisu/v5/sisupod_make.rb index d4341abf..462e2ea4 100644 --- a/lib/sisu/v5/sisupod_make.rb +++ b/lib/sisu/v5/sisupod_make.rb @@ -69,17 +69,21 @@ module SiSU_Doc def initialize(opt,build=nil,place=nil) super(opt,build,place) @zipfile=@opt.fno.gsub(/(?:\~\S{2,3})?(\.ss[tm])$/,'\1') - unless @opt.cmd =~/q/ + unless @opt.act[:quiet][:set]==:on pthinfo="#{@file.output_path.sisupod.dir}/#{@zipfile}.txz" - @opt.cmd=~/[MVv]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'Assemble source for sisu document',"#{@opt.fns} -> file://#{pthinfo}").cyan_hi_blue - : SiSU_Screen::Ansi.new(@opt.cmd,'Assemble source for sisu document',pthinfo).cyan_title_hi + (@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],'Assemble source for sisu document',"#{@opt.fns} -> file://#{pthinfo}").cyan_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Assemble source for sisu document',pthinfo).cyan_title_hi end end def sisupod_tar_xz begin FileUtils::mkdir_p(@file.output_path.sisupod.dir) unless FileTest.directory?(@file.output_path.sisupod.dir) - tree=(@opt.cmd =~/[vVM]/ \ + tree=((@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ && SiSU_Env::SystemCall.new.program_found?('tree')) \ ? 'tree sisupod' : '' @@ -92,9 +96,17 @@ module SiSU_Doc }) FileUtils::mv("#{@zipfile}.txz",@file.place_file.sisupod.dir) Dir.chdir(@env.path.pwd) - SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz").blue_tab if @opt.cmd=~/[MVv]/ + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz").blue_tab + end else - SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz not built").blue_tab if @opt.cmd=~/[MVv]/ + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz not built").blue_tab + end end rescue ensure diff --git a/lib/sisu/v5/sitemaps.rb b/lib/sisu/v5/sitemaps.rb index c95404ca..8e4d1410 100644 --- a/lib/sisu/v5/sitemaps.rb +++ b/lib/sisu/v5/sitemaps.rb @@ -78,7 +78,7 @@ module SiSU_Sitemaps @sys=SiSU_Env::SystemCall.new fn_set_lang=SiSU_Env::StandardiseLanguage.new(@opt.lng).language @fn=SiSU_Env::EnvCall.new(@opt.fns).lang(fn_set_lang[:c]) - if @opt.cmd =~/Y/ + if @opt.act[:sitemap][:set]==:on @md=SiSU_Param::Parameters.new(@opt).get @trans=SiSU_XML_Munge::Trans.new(@md) #check @md is required @env=SiSU_Env::InfoEnv.new(@md.fns) @@ -91,7 +91,7 @@ module SiSU_Sitemaps @sitemap_idx_fn='sitemapindex.xml' @env=SiSU_Env::InfoEnv.new output_idx(sitemap_index) - SiSU_Screen::Ansi.new(@opt.cmd,"sitemap index:","#{@env.path.output}/#{@sitemap_idx_fn}").result unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sitemap index:","#{@env.path.output}/#{@sitemap_idx_fn}").result unless @opt.act[:quiet][:set]==:on end rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do diff --git a/lib/sisu/v5/sst_convert_markup.rb b/lib/sisu/v5/sst_convert_markup.rb index cbf40f24..6eaa691e 100644 --- a/lib/sisu/v5/sst_convert_markup.rb +++ b/lib/sisu/v5/sst_convert_markup.rb @@ -79,7 +79,7 @@ module SiSU_Modify def message(text) response='' unless @opt.cmd=~/QQ/ \ - or @opt.cmd=~/q/ + or @opt.act[:quiet][:set]==:on response=@ask.response?(%{#{ text}\nProceed? }) end end @@ -258,7 +258,7 @@ WOK end end if @matched - puts "conversion match in #{i}" unless @opt.cmd=~/q/ + puts "conversion match in #{i}" unless @opt.act[:quiet][:set]==:on @flag_start=true cont.each do |y| if y =~end_processing @@ -269,10 +269,18 @@ WOK match_and_replace.each do |m,r,w| if y =~m \ and y =~w - puts m.inspect + ' -> ' + r unless @opt.cmd=~/q/ - puts "in: #{y}" if @opt.cmd=~/[vVM]/ + puts m.inspect + ' -> ' + r unless @opt.act[:quiet][:set]==:on + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + puts "in: #{y}" + end y.gsub!(m,r) if m and r - puts "out: #{y}" if @opt.cmd=~/[vVM]/ + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + puts "out: #{y}" + end end end end @@ -285,9 +293,14 @@ WOK : false end @file.close - else puts "NO conversion match in #{i}" unless @opt.cmd=~/q/ + else puts "NO conversion match in #{i}" unless @opt.act[:quiet][:set]==:on + end + else + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + puts "Requested conversion #{@opt.mod.inspect} markup #{markup_version} identified in #{i}" end - else puts "Requested conversion #{@opt.mod.inspect} markup #{markup_version} identified in #{i}" if @opt.cmd=~/[vVM]/ end end end diff --git a/lib/sisu/v5/sst_do_inline_footnotes.rb b/lib/sisu/v5/sst_do_inline_footnotes.rb index 02b4a171..836d0d29 100644 --- a/lib/sisu/v5/sst_do_inline_footnotes.rb +++ b/lib/sisu/v5/sst_do_inline_footnotes.rb @@ -124,7 +124,7 @@ module SiSU_ConvertFootnotes protected def create_dal dal_array=[] - SiSU_Screen::Ansi.new(@opt.cmd,'convert footnotes').green_title_hi unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'convert footnotes').green_title_hi unless @opt.act[:quiet][:set]==:on file_array=IO.readlines(@opt.fns,'') file_array.each do |l| if l =~/\r\n/ then l.gsub!(/\r\n/,"\n") @@ -137,12 +137,12 @@ module SiSU_ConvertFootnotes or @md.opt.mod.inspect =~/=footnotes-force/ meta=nil dal=SiSU_ConvertFootnotes::Make.new(@md,file_array).song - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.fns}.fn").output if @md.opt.cmd =~/v/ - SiSU_Screen::Ansi.new(@opt.cmd,"#{@md.fns}.fn -> #{@md.fns}.fn").txt_red unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.fns}.fn").output if @md.opt.act[:verbose][:set]==:on + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"#{@md.fns}.fn -> #{@md.fns}.fn").txt_red unless @md.opt.act[:quiet][:set]==:on dal.each {|s| dal_array << "#{s.strip}\n\n" unless s.strip.empty?} dal_array else - SiSU_Screen::Ansi.new(@md.opt.cmd,'*WARN* no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn if @cmd !~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* no footnote conversion done, problem with source file','to override use --convert=footnote-force (this is not advised)').warn unless @md.opt.act[:quiet][:set]==:on '' end end @@ -353,7 +353,10 @@ module SiSU_ConvertFootnotes end def set_heading_top #% make sure no false positives unless @md.set_heading_top - puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/ + if (@md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + puts "\tdocument contains no top level heading, (will have to manufacture one)" + end data=@data @tuned_file=[] data.each do |para| @@ -374,7 +377,10 @@ module SiSU_ConvertFootnotes end def set_heading_seg #% make sure no false positives unless @md.set_heading_seg - puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/ + if (@md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + puts "\tdocument contains no segment level, (will have to manufacture one)" + end data=@data @tuned_file=[] data.each do |para| @@ -396,7 +402,10 @@ module SiSU_ConvertFootnotes end def set_header_title #% make sure no false positives unless @md.set_header_title - puts "\t no document title provided, (will have to manufacture one)" if @md.opt.cmd =~/[MV]/ + if (@md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + puts "\t no document title provided, (will have to manufacture one)" + end data=@data @tuned_file=[] data.each do |para| diff --git a/lib/sisu/v5/sst_from_xml.rb b/lib/sisu/v5/sst_from_xml.rb index 9d9f90ce..cf5a6ac6 100644 --- a/lib/sisu/v5/sst_from_xml.rb +++ b/lib/sisu/v5/sst_from_xml.rb @@ -71,7 +71,7 @@ module SiSU_sstFromXML @ver=SiSU_Env::InfoVersion.instance.get_version end def tell(filename,type) - SiSU_Screen::Ansi.new(@opt.cmd,"XML #{type} to SiSU sst","#{filename} --> #{filename}.sst").green_hi_blue + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"XML #{type} to SiSU sst","#{filename} --> #{filename}.sst").green_hi_blue end def read xml_to_sisu @@ -148,17 +148,17 @@ module SiSU_sstFromXML end end if xml =~/\.sxs\.xml$/ - unless @opt.cmd =~/q/ + unless @opt.act[:quiet][:set]==:on tell(xml,'sax') end sax elsif xml =~/\.sxd\.xml$/ - unless @opt.cmd =~/q/ + unless @opt.act[:quiet][:set]==:on tell(xml,'dom') end dom elsif xml =~/\.sxn\.xml$/ - unless @opt.cmd =~/q/ + unless @opt.act[:quiet][:set]==:on tell(xml,'node') end node diff --git a/lib/sisu/v5/sst_identify_markup.rb b/lib/sisu/v5/sst_identify_markup.rb index 248aa207..76b7770e 100644 --- a/lib/sisu/v5/sst_identify_markup.rb +++ b/lib/sisu/v5/sst_identify_markup.rb @@ -226,7 +226,7 @@ WOK if @opt.fns =~/\.(?:sst|ssm|ssi|s[123i]|r[123])/ markup=identify #(@opt.fns) if defined? markup.version - unless @opt.cmd =~/q/ + unless @opt.act[:quiet][:set]==:on message=unless markup.declared_version.empty? "#{@opt.fns}\n markup Type Declared as SiSU #{markup.declared_version} #{markup.declared_type}\n appears to be SiSU #{markup.version}" else diff --git a/lib/sisu/v5/sst_to_s_xml_sax.rb b/lib/sisu/v5/sst_to_s_xml_sax.rb index e40e21d4..d6767595 100644 --- a/lib/sisu/v5/sst_to_s_xml_sax.rb +++ b/lib/sisu/v5/sst_to_s_xml_sax.rb @@ -88,8 +88,11 @@ module SiSU_SimpleXML_ModelSax begin @md=@particulars.md #bug, relies on info persistence, assumes -m has previously been run @env=@particulars.env - SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',"#{@md.fns} -> #{@md.fn[:sxs]}").colorize unless @opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{Dir.pwd}/#{@md.fn[:sxs]}").flow if @opt.cmd =~/[MV]/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'invert','XML SAX',"#{@md.fns} -> #{@md.fn[:sxs]}").colorize unless @opt.act[:quiet][:set]==:on + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{Dir.pwd}/#{@md.fn[:sxs]}").flow + end unless @@fns==@opt.fns @@fns=@opt.fns @@fns_array=[] @@ -120,8 +123,12 @@ module SiSU_SimpleXML_ModelSax def songsheet begin SiSU_SimpleXML_ModelSax::Convert::Scroll.new(@data,@particulars).songsheet - SiSU_SimpleXML_ModelSax::Convert::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use - SiSU_Rexml::Rexml.new(@md,@md.fn[:sxs]).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_SimpleXML_ModelSax::Convert::Tidy.new(@md,@env).xml # test wellformedness, comment out when not in use + end + SiSU_Rexml::Rexml.new(@md,@md.fn[:sxs]).xml if @md.opt.act[:maintenance][:set]==:on # test rexml parsing, comment out when not in use #debug rescue SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -435,14 +442,15 @@ WOK end def xml if @prog.tidy !=false #note values can be other than true - if @md.opt.cmd =~/[VM]/ - SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@md.opt.cmd,'','','check document structure') - tell.grey_open unless @md.opt.cmd =~/q/ + if (@md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize unless @md.opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'','','check document structure') + tell.grey_open unless @md.opt.act[:quiet][:set]==:on tidyfile='/dev/null' #don't want one or screen output, check for alternative flags tidy =SiSU_Env::SystemCall.new("#{Dir.pwd}/#{@md.fn[:sxs]}",tidyfile) tidy.well_formed? - tell.p_off unless @md.opt.cmd =~/q/ + tell.p_off unless @md.opt.act[:quiet][:set]==:on end end end diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 4de45fd0..b23b7f80 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -2977,88 +2977,91 @@ WOK if @md \ and defined? @md.fn \ and @md.fn # used for by_language_code? - if @md.opt.cmd =~ /[hH]/ + if @md.opt.act[:html][:set]==:on #% --html, -h -H ft << @md.fn[:html] end - if @md.opt.cmd =~ /w/ \ - and @md.opt.cmd !~ /[hH]/ + if @md.opt.act[:concordance][:set]==:on #% --concordance, -w ft << @md.fn[:concordance] end - if @md.opt.cmd =~ /y/ \ - and @md.opt.cmd !~ /[hH]/ + if @md.opt.act[:manifest][:set]==:on #% --manifest, -y ft << @md.fn[:manifest] end - if @md.opt.cmd =~ /[at]/; ft << @md.fn[:plain] + if @md.opt.act[:txt][:set]==:on #% --txt, -t -a + ft << @md.fn[:plain] end - if @md.opt.cmd =~ /b/; ft << @md.fn[:xhtml] + if @md.opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml + ft << @md.fn[:xhtml] end - if @md.opt.cmd =~ /e/; ft << @md.fn[:epub] + if @md.opt.act[:epub][:set]==:on #% --epub, -e + ft << @md.fn[:epub] end - if @md.opt.cmd =~ /g/; ft << @md.fn[:wiki] + if @md.opt.act[:manpage][:set]==:on #% --manpage, -i + ft << @md.fn[:manpage] end - if @md.opt.cmd =~ /i/; ft << @md.fn[:manpage] + if @md.opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree + ft << @md.fn[:digest] end - if @md.opt.cmd =~ /N/; ft << @md.fn[:digest] + if @md.opt.act[:odt][:set]==:on #% --odt, -o opendocument + ft << @md.fn[:odf] end - if @md.opt.cmd =~ /o/; ft << @md.fn[:odf] + if @md.opt.act[:pdf][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf + ft << @md.fn[:pdf_l] << @md.fn[:pdf_p] end - if @md.opt.cmd =~ /O/; ft << @md.fn[:oai_pmh] + if @md.opt.act[:share_source][:set]==:on + ft << @md.fns end - if @md.opt.cmd =~ /p/; ft << @md.fn[:pdf_l] << @md.fn[:pdf_p] + if @md.opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod + ft << @md.fn[:sisupod] end - if @md.opt.cmd =~ /s/; ft << @md.fns + if @md.opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type + ft << @md.fn[:sax] end - if @md.opt.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi' - end - if @md.opt.cmd =~ /x/; ft << @md.fn[:sax] - end - if @md.opt.cmd =~ /X/; ft << @md.fn[:dom] - end - if @md.opt.cmd =~ /G/; ft << @md.fn[:pot] + if @md.opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type + ft << @md.fn[:dom] end @fnb=@md.fnb else # still needed where/when param is not parsed - if @opt.cmd =~ /[hH]/; ft << '.html' << '.html.??' + if @opt.act[:html][:set]==:on #% --html, -h -H + ft << '.html' << '.html.??' end - if @opt.cmd =~ /w/ \ - and @opt.cmd !~ /[hH]/ + if @opt.act[:concordance][:set]==:on #% --concordance, -w ft << 'concordance.html' << '??.concordance.html' << 'concordance.??.html' end - if @opt.cmd =~ /y/ \ - and @opt.cmd !~ /[hH]/ + if @opt.act[:manifest][:set]==:on #% --manifest, -y ft << 'sisu_manifest.html' << '??.sisu_manifest.html' << 'sisu_manifest.??.html' end - if @opt.cmd =~ /a/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' - end - if @opt.cmd =~ /b/; ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml' - end - if @opt.cmd =~ /e/; ft << @fnb << '.epub' - end - if @opt.cmd =~ /g/; ft << 'wiki.txt' << '??.wiki.txt' << 'wiki.??.txt' - end - if @opt.cmd =~ /i/; ft << '.1' << '??.man.1' << 'man.??.1' - end - if @opt.cmd =~ /N/; ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt' + if @opt.act[:txt][:set]==:on #% --txt, -t -a + ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' end - if @opt.cmd =~ /o/; ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt' + if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml + ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml' end - if @opt.cmd =~ /O/; ft << 'oai_pmh.xml' + if @opt.act[:epub][:set]==:on #% --epub, -e + ft << @fnb << '.epub' end - if @opt.cmd =~ /p/; ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf' + if @opt.act[:manpage][:set]==:on #% --manpage, -i + ft << '.1' << '??.man.1' << 'man.??.1' end - if @opt.cmd =~ /s/; ft << '.sst' << '.ssi' << '.ssm' + if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree + ft << 'digest.txt' << '??.digest.txt' << 'digest.??.txt' end - if @opt.cmd =~ /S/; ft << '.zip' << '.kdi' + if @opt.act[:odt][:set]==:on #% --odt, -o opendocument + ft << 'opendocument.odt' << '??.opendocument.odt' << 'opendocument.??.odt' end - if @opt.cmd =~ /x/; ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml' + if @opt.act[:pdf][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf + ft << 'landscape.pdf' << 'portrait.pdf' << '.pdf' end - if @opt.cmd =~ /X/; ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml' + if @opt.act[:share_source][:set]==:on + ft << '.sst' << '.ssi' << '.ssm' end - if @opt.mod.inspect =~ /sxm|sxs|xml/; ft << @fnb << '.sxs.xml' + if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod + ft << '.zip' end - if @opt.mod.inspect =~ /sxd/; ft << @fnb << '.sxd.xml' + if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type + ft << 'sax.xml' << '??.sax.xml' << 'sax.??.xml' end - if @opt.mod.inspect =~ /sxn/; ft << @fnb << '.sxn.xml' + if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type + ft << 'dom.xml' << '??.dom.xml' << 'dom.??.xml' end end ft=ft.uniq diff --git a/lib/sisu/v5/texinfo.rb b/lib/sisu/v5/texinfo.rb index aea3f372..623cee2d 100644 --- a/lib/sisu/v5/texinfo.rb +++ b/lib/sisu/v5/texinfo.rb @@ -103,13 +103,17 @@ module SiSU_TexInfo end def song begin - tool=(@opt.cmd =~/[MVv]/) \ + tool=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ ? "#{@env.program.texinfo} #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" - @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_title_hi + (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + && ! @opt.act[:quiet][:set]==:on \ + ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'TexInfo',tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'TexInfo',tool).green_title_hi @md=SiSU_Param::Parameters.new(@opt).get directories @marshalfile=SiSU_Env::InfoFile.new(@opt.fns).marshal.dal_content @@ -123,7 +127,7 @@ module SiSU_TexInfo tex_array=@@tuned_file TeXinfoMake.new(@md,tex_array).songsheet tex_array='' - rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt.cmd,$!,$@).rescue + rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],$!,$@).rescue ensure end end @@ -151,7 +155,7 @@ module SiSU_TexInfo output(doc_txt) makeinfo #KEEP reinstate when fixed #% place_info - rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.opt.cmd,$!,$@).rescue + rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],$!,$@).rescue ensure end end @@ -384,7 +388,7 @@ module SiSU_TexInfo def output(data) filename_texinfo=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo} file_texinfo=File.new(filename_texinfo,'w+') - puts filename_texinfo if @md.opt.cmd =~/M/ + puts filename_texinfo if @md.opt.act[:maintenance][:set]==:on data.each {|s| (file_texinfo.puts s,"\n") if s} file_texinfo.close end diff --git a/lib/sisu/v5/texpdf.rb b/lib/sisu/v5/texpdf.rb index 0d259cf1..2dc3e860 100644 --- a/lib/sisu/v5/texpdf.rb +++ b/lib/sisu/v5/texpdf.rb @@ -110,14 +110,16 @@ module SiSU_TeX def song begin @md=@particulars.md - SiSU_Screen::Ansi.new(@opt.cmd,'LaTeX/PDF',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.cmd =~/q/ - if @opt.cmd =~/[MVv]/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'LaTeX/PDF',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi unless @opt.act[:quiet][:set]==:on + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) @env.url.output_tell if @md.opt.act[:pdf_l][:set]==:on - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").flow + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").flow end if @md.opt.act[:pdf_p][:set]==:on - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").flow + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").flow end end @md=@particulars.md @@ -135,7 +137,8 @@ module SiSU_TeX __LINE__.to_s + ':' + __FILE__ end ensure - unless @opt.cmd =~/[MV]/ #check maintenance flag + unless (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) texfiles=Dir["#{@env.processing_path.tex}/#{@opt.fns}*"] texfiles.each do |f| if FileTest.file?(f) @@ -168,7 +171,11 @@ module SiSU_TeX tex_fn_base=@texfilename.gsub(/\.tex$/,'') tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md.opt.act[:pdf_p][:set]==:on - SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} portrait ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"#{papersize} portrait ->").dark_grey_title_hi + end cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.tex",'',@md.opt.cmd) tell.grey_open if @md.opt.cmd =~/[MVv]/ if "#{tex_fn_base}" =~/\w+/ \ @@ -178,14 +185,26 @@ module SiSU_TeX tell.p_off if @md.opt.cmd =~/[MVv]/ end if @md.opt.act[:pdf_l][:set]==:on - SiSU_Screen::Ansi.new(@md.opt.cmd,"#{papersize} landscape ->").dark_grey_title_hi if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"#{papersize} landscape ->").dark_grey_title_hi + end cmd=SiSU_Env::SystemCall.new("#{tex_fn_base}.landscape.tex",'',@md.opt.cmd) - tell.grey_open if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + tell.grey_open + end if "#{tex_fn_base}" =~/\w+/ \ and "#{papersize}" =~/\w+/ 2.times { |i| cmd.latex2pdf(@md,papersize) } #comment out to skip processing of latex landscape end - tell.p_off if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + tell.p_off + end end pwd=Dir.pwd if @md.opt.act[:pdf_p][:set]==:on @@ -203,14 +222,14 @@ module SiSU_TeX else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 end FileUtils::mkdir_p(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir) - cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX + cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX if @md.opt.act[:pdf_p][:set]==:on if FileTest.file?(portrait_pdf) FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}") FileUtils::rm(portrait_pdf) else STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{portrait_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)" - STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.cmd.inspect =~/M/ + STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.act[:maintenance][:set]==:on end end if @md.opt.act[:pdf_l][:set]==:on @@ -219,10 +238,14 @@ module SiSU_TeX FileUtils::rm(landscape_pdf) else STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{landscape_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)" - STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.cmd.inspect =~/M/ + STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.act[:maintenance][:set]==:on end end - SiSU_Screen::Ansi.new(@md.opt.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number if @md.opt.cmd =~/[MVv]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number + end end def latexrun_selective begin @@ -291,7 +314,7 @@ module SiSU_TeX end end else - SiSU_Screen::Ansi.new(@md.opt.cmd,"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"*WARN* FILE NOT FOUND: << #{@md.fns} >> - requested latex system processing skipped").warn end lst=Dir["*.{aux,log,out}"] lst.each {|file| File.unlink(file)} if lst @@ -343,7 +366,11 @@ module SiSU_TeX else SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark('error: neither landscape nor portrait') end - SiSU_Screen::Ansi.new(@md.opt.cmd,txt_gen).txt_grey if @md.opt.cmd=~/[MVvz]/ + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],txt_gen).txt_grey + 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 @@ -853,7 +880,7 @@ module SiSU_TeX p: markup_common(dob.tmp[ps][:p]), l: markup_common(dob.tmp[ps][:l]) } - else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/ + else p "#{__FILE__}:#{__LINE__}" if @md.opt.act[:maintenance][:set]==:on end end end @@ -863,7 +890,7 @@ module SiSU_TeX p: markup_common(dob.tmp[:p]), l: markup_common(dob.tmp[:l]) } - else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/ + else p "#{__FILE__}:#{__LINE__}" if @md.opt.act[:maintenance][:set]==:on end end @tex_file << dob @@ -918,7 +945,7 @@ module SiSU_TeX l: number_paras_numbering(dob.tmp[ps][:l]) } dob.tmp=para_hash - else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/ + else p "#{__FILE__}:#{__LINE__}" if @md.opt.act[:maintenance][:set]==:on end end end @@ -927,7 +954,7 @@ module SiSU_TeX p: number_paras_numbering(dob.tmp[:p]), l: number_paras_numbering(dob.tmp[:l]) } - else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/ + else p "#{__FILE__}:#{__LINE__}" if @md.opt.act[:maintenance][:set]==:on end else dob=if dob.of !=:comment \ @@ -981,7 +1008,7 @@ module SiSU_TeX fn[:landscape].puts h[:l],"\n" end end - else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/ + else p "#{__FILE__}:#{__LINE__}" if @md.opt.act[:maintenance][:set]==:on end end def output(array) diff --git a/lib/sisu/v5/texpdf_format.rb b/lib/sisu/v5/texpdf_format.rb index 5ed6ca75..b20105af 100644 --- a/lib/sisu/v5/texpdf_format.rb +++ b/lib/sisu/v5/texpdf_format.rb @@ -483,7 +483,7 @@ module SiSU_TeX_Pdf @txt.gsub!(/<:=\s*(\S+?)\s*>/, "\\includegraphics*[width=11pt]{#{dir.path.image_source_include}/c_\\1.png}") else - SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_include}").error2 unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'') # fragile match operator\\ fragile ! end end @@ -626,7 +626,7 @@ module SiSU_TeX_Pdf hsp="\n{\\color{mywhite} .}&~\n" # ~ character for hardspace caption=(c ? "{\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" : '') elsif images_hash[ps] =~/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/m - SiSU_Screen::Ansi.new(@md.opt.cmd,%{document built without image: "#{$1}" as image dimensions not provided (either image not found or neither imagemagick nor graphicsmagick is installed)?\n}).print_grey #unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],%{document built without image: "#{$1}" as image dimensions not provided (either image not found or neither imagemagick nor graphicsmagick is installed)?\n}).print_grey #unless @md.opt.act[:quiet][:set]==:on images_hash[ps].gsub!(/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/,'[image]') end if image #most images fc etc. #% clean up ! @@ -678,7 +678,7 @@ module SiSU_TeX_Pdf end images_hash[ps] else - SiSU_Screen::Ansi.new(@md.opt.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_include_local},#{dir.path.image_source_include_remote} and #{dir.path.image_source_include}").error2 unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_include_local},#{dir.path.image_source_include_remote} and #{dir.path.image_source_include}").error2 unless @md.opt.act[:quiet][:set]==:on if images_hash[ps] =~url_image_rgx \ or images_hash[ps] =~image_rgx images_hash[ps]='' @@ -1560,7 +1560,7 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ sisu_ico=if FileTest.file?("#{dir.path.image_source_include}/sisu.png") "\\includegraphics*[width=60pt]{#{dir.path.image_source_include}/sisu.png}" else - SiSU_Screen::Ansi.new(@md.opt.cmd,'WARNING - image directory or image(s) missing:', %{"#{dir.path.image_source_include}"} ).warn unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'WARNING - image directory or image(s) missing:', %{"#{dir.path.image_source_include}"} ).warn unless @md.opt.act[:quiet][:set]==:on " SiSU " end url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') diff --git a/lib/sisu/v5/update.rb b/lib/sisu/v5/update.rb index cfa4c1c0..22abc6a0 100644 --- a/lib/sisu/v5/update.rb +++ b/lib/sisu/v5/update.rb @@ -73,7 +73,7 @@ module SiSU_UpdateControlFlag @env=SiSU_Env::InfoEnv.new(@md.fns) out=@env.path.output base_path="#{out}/#{@md.fnb}" - SiSU_Screen::Ansi.new(@md.opt.cmd,'Checking previous output',base_path).green_hi_blue unless @md.opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'Checking previous output',base_path).green_hi_blue unless @md.opt.act[:quiet][:set]==:on SetCF.new(@md).set_flags rescue SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do diff --git a/lib/sisu/v5/urls.rb b/lib/sisu/v5/urls.rb index 3b9f5034..9f8c9a75 100644 --- a/lib/sisu/v5/urls.rb +++ b/lib/sisu/v5/urls.rb @@ -124,7 +124,7 @@ module SiSU_Urls end def songsheet begin - @opt.cmd=~/U/ ? urls_all : (urls_select unless @opt.cmd=~/q/) + @opt.cmd=~/U/ ? urls_all : (urls_select unless @opt.act[:quiet][:set]==:on) rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -135,97 +135,97 @@ module SiSU_Urls def show def source def src(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} #{@md.file.output_path.src.dir}/#{y}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} #{@md.file.output_path.src.dir}/#{y}").result end def pod(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sisupod.dir}/#{y}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sisupod.dir}/#{y}").result end self end def generic(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} #{@env.url.output_tell}/#{@fnb}/#{y}").result end def meta(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} ~#{y}/#{@fnb}.#{y}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} ~#{y}/#{@fnb}.#{y}").result end def text(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}").result end def epub(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}").result end def html def scroll(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}").result end def toc(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}").result end def concordance(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").result end def manifest(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result end self end def qrcode(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result end def odt(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.odf_viewer} file://#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}").result end def pdf def portrait(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").result end def landscape(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").result end self end def manpage(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.manpage_viewer} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.manpage_viewer} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").result end def pinfo(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","pinfo -f #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","pinfo -f #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}").result end def po4a def po(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@md.file.output_path.po.dir}/#{y}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@md.file.output_path.po.dir}/#{y}").result end def pot(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@md.file.output_path.pot.dir}/#{y}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@md.file.output_path.pot.dir}/#{y}").result end self end def xhtml(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").result end def xml def sax(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").result end def dom(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").result end def sitemap(x) #BROKEN - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sitemaps.dir}/#{@md.file.base_filename.sitemap}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.sitemaps.dir}/#{@md.file.base_filename.sitemap}").result end self end def hash_digest(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.hash_digest.dir}/#{@md.file.base_filename.hash_digest}").result end def db def psql(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y).result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y).result end def sqlite(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x} DBI sqlite","sqlite3 #{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}/sisu_sqlite.db").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x} DBI sqlite","sqlite3 #{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}/sisu_sqlite.db").result end def sqlite_discrete(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","sqlite3 #{@md.file.output_path.sqlite_discrete.dir}/#{@md.file.base_filename.sqlite_discrete}").result + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","sqlite3 #{@md.file.output_path.sqlite_discrete.dir}/#{@md.file.base_filename.sqlite_discrete}").result end self end @@ -235,18 +235,19 @@ module SiSU_Urls if x=~/^([abcehHmNoptwxXy])/ \ and opt.cmd =~/[abcehHmNoptwxXy]/ \ and x=~/^[#{opt.cmd}]/ \ - and opt.cmd =~/[MV]/ + and (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) tool=@prog.text_editor if x =~/^m/ \ and @opt.cmd=~/m/ \ and x=~/^[#{opt.cmd}]/ - SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.dal}/#{@opt.fns}.meta").maintenance + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.dal}/#{@opt.fns}.meta").maintenance end if x=~/^([hw])/ \ and @opt.cmd=~/[hw]/ \ and x=~/^[#{@opt.cmd}]/ \ and x !~/segmented/ - SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.tune}/#{@md.fns}.tune").maintenance + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.tune}/#{@md.fns}.tune").maintenance end if x=~/^p/ \ and @opt.cmd=~/p/ \ @@ -255,8 +256,8 @@ module SiSU_Urls fns=@opt.fns.gsub(/~/,'-') unless @opt.cmd =~/q/ tell=if x =~/landscape/ - SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.landscape.tex") - else SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.tex") + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.landscape.tex") + else SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.tex") end tell.maintenance end @@ -269,12 +270,12 @@ module SiSU_Urls if x=~/^e/ \ and @opt.cmd=~/e/ \ and x=~/^[#{@opt.cmd}]/ - SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.epub}/#{Ep[:d_oebps]}/toc.xhtml").maintenance + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.epub}/#{Ep[:d_oebps]}/toc.xhtml").maintenance end if x=~/^o/ \ and @opt.cmd=~/o/ \ and x=~/^[#{@opt.cmd}]/ - SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.odf}/#{@opt.fns}/odt/content.xml").maintenance + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"-#{x}","#{@prog.text_editor} #{@env.processing_path.odf}/#{@opt.fns}/odt/content.xml").maintenance end end end @@ -282,17 +283,21 @@ module SiSU_Urls unless @opt.cmd =~/q/ i1="[#{@opt.f_pth[:lng_is]}]" i2="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" - @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'URLs').green_title_hi - : SiSU_Screen::Ansi.new(@opt.cmd,'URL (output manifest)',i1, i2).grey_title_grey_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]/ + (@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],'URLs').green_title_hi + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'URL (output manifest)',i1, i2).grey_title_grey_blue + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").flow if @opt.cmd =~/[MVv]/ end m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m @pwd_stub="#{@env.url.output_tell}"[m,1] - unless @opt.cmd =~/q/ + unless @opt.act[:quiet][:set]==:on @u.each do |x,y| if @opt.fns =~ @m_regular - if @opt.cmd =~/[MVv]/ + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) if x=~/--txt\b/ \ and @opt.act[:txt][:set]==:on show.text(x) @@ -406,14 +411,17 @@ module SiSU_Urls show.html.manifest(x) end end - urls_maintenance(@opt,x,y) if @opt.cmd =~/[MV]/ + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + urls_maintenance(@opt,x,y) + end end end end end def urls_all i="(output manifest) [#{@opt.f_pth[:lng_is]}] #{@env.url.output_tell}/#{@fnb}/sisu_manifest.html" - SiSU_Screen::Ansi.new(@opt.cmd,'URLs',i).grey_title_hi + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'URLs',i).grey_title_hi @u.each do |x,y| case x when /^m/ diff --git a/lib/sisu/v5/wikispeak.rb b/lib/sisu/v5/wikispeak.rb index 838afa36..da8fc9fa 100644 --- a/lib/sisu/v5/wikispeak.rb +++ b/lib/sisu/v5/wikispeak.rb @@ -80,11 +80,16 @@ module SiSU_Wikispeak @md=SiSU_Param::Parameters.new(@opt).get @env=SiSU_Env::InfoEnv.new(@opt.fns) path=@env.path.output_tell - tool=(@opt.cmd =~/[MVv]/) \ + tool=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ ? "#{@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]/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Wikispeak',tool).green_hi_blue unless @opt.act[:quiet][:set]==:on + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:wiki]}").flow + end @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here SiSU_Wikispeak::Source::Scroll.new(@dal_array,@md).songsheet rescue diff --git a/lib/sisu/v5/xhtml.rb b/lib/sisu/v5/xhtml.rb index 1a194139..03ba0134 100644 --- a/lib/sisu/v5/xhtml.rb +++ b/lib/sisu/v5/xhtml.rb @@ -83,17 +83,23 @@ module SiSU_XHTML def read begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array - unless @opt.cmd =~/q/ - tool=if @opt.cmd =~/[MV]/ + unless @opt.act[:quiet][:set]==:on + tool=if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" - elsif @opt.cmd =~/v/ + elsif @opt.act[:verbose][:set]==:on "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" end - @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'XHTML',tool).green_hi_blue - : 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]/ + (@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],'XHTML',tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'XHTML',tool).green_title_hi + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"/#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}").flow + end end SiSU_XHTML::Source::Songsheet.new(@particulars).song rescue @@ -113,8 +119,12 @@ module SiSU_XHTML def song begin SiSU_XHTML::Source::Scroll.new(@particulars).songsheet - SiSU_XHTML::Source::Tidy.new(@md,@file.place_file.xhtml.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use - SiSU_Rexml::Rexml.new(@md,@file.place_file.xhtml.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_XHTML::Source::Tidy.new(@md,@file.place_file.xhtml.dir).xml # test wellformedness, comment out when not in use + end + SiSU_Rexml::Rexml.new(@md,@file.place_file.xhtml.dir).xml if @md.opt.act[:maintenance][:set]==:on # test rexml parsing, comment out when not in use #debug rescue SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -413,16 +423,17 @@ WOK end def xml if @prog.tidy !=false - if @md.opt.cmd =~/[VM]/ - unless @md.opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize - tell=SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','','') + if (@md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + unless @md.opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize + tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','','') tell.grey_open end tidyfile='/dev/null' #don't want one or screen output, check for alternative flags tidy=SiSU_Env::SystemCall.new(@file,tidyfile) tidy.well_formed? - tell.p_off unless @md.opt.cmd =~/q/ + tell.p_off unless @md.opt.act[:quiet][:set]==:on end end end diff --git a/lib/sisu/v5/xml.rb b/lib/sisu/v5/xml.rb index 99fd184e..f9741ec1 100644 --- a/lib/sisu/v5/xml.rb +++ b/lib/sisu/v5/xml.rb @@ -83,15 +83,23 @@ module SiSU_XML_SAX def read begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array - unless @opt.cmd =~/q/ - tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}\n\t#{@env.program.xml_viewer} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}" - elsif @opt.cmd =~/v/; "#{@env.program.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}" + unless @opt.act[:quiet][:set]==:on + tool=if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + "#{@env.program.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}\n\t#{@env.program.xml_viewer} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}" + elsif @opt.act[:verbose][:set]==:on + "#{@env.program.web_browser} file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}" else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" end - @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'XML SAX',tool).green_hi_blue - : 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]/ + (@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],'XML SAX',tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'XML SAX',tool).green_title_hi + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}").flow + end end SiSU_XML_SAX::Source::Songsheet.new(@particulars).song rescue @@ -112,8 +120,12 @@ module SiSU_XML_SAX def song begin SiSU_XML_SAX::Source::Scroll.new(@particulars).songsheet - SiSU_XML_SAX::Source::Tidy.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use - SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_XML_SAX::Source::Tidy.new(@md,@file.place_file.xml_sax.dir).xml # test wellformedness, comment out when not in use + end + SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.act[:maintenance][:set]==:on # test rexml parsing, comment out when not in use #debug rescue SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -453,16 +465,17 @@ WOK end def xml if @prog.tidy !=false #note values can be other than true - if @md.opt.cmd =~/[VM]/ - unless @md.opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize - tell=SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','','') + if (@md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + unless @md.opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize + tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','','') tell.grey_open end tidyfile='/dev/null' #don't want one or screen output, check for alternative flags tidy=SiSU_Env::SystemCall.new(@file,tidyfile) tidy.well_formed? - tell.p_off unless @md.opt.cmd =~/q/ + tell.p_off unless @md.opt.act[:quiet][:set]==:on end end end diff --git a/lib/sisu/v5/xml_dom.rb b/lib/sisu/v5/xml_dom.rb index 29d8ea7e..f6d86883 100644 --- a/lib/sisu/v5/xml_dom.rb +++ b/lib/sisu/v5/xml_dom.rb @@ -84,15 +84,23 @@ module SiSU_XML_DOM def read begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array - unless @opt.cmd =~/q/ - tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}\n\t#{@env.program.xml_viewer} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}" - elsif @opt.cmd =~/v/; "#{@env.program.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}" + unless @opt.act[:quiet][:set]==:on + tool=if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + "#{@env.program.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}\n\t#{@env.program.xml_viewer} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}" + elsif @opt.act[:verbose][:set]==:on + "#{@env.program.web_browser} file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}" else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" end - @opt.cmd=~/[MVvz]/ \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'XML DOM',tool).green_hi_blue - : 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]/ + (@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],'XML DOM',tool).green_hi_blue + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'XML DOM',tool).green_title_hi + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"file://#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}").flow + end end SiSU_XML_DOM::Source::Songsheet.new(@particulars).songsheet rescue @@ -112,8 +120,12 @@ module SiSU_XML_DOM def songsheet begin SiSU_XML_DOM::Source::Scroll.new(@particulars).songsheet - SiSU_XML_DOM::Source::Tidy.new(@md,@file.place_file.xml_dom.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use - SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_dom.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug + if (@md.opt.act[:verbose][:set]==:on \ + || @md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_XML_DOM::Source::Tidy.new(@md,@file.place_file.xml_dom.dir).xml # test wellformedness, comment out when not in use + end + SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_dom.dir).xml if @md.opt.act[:maintenance][:set]==:on # test rexml parsing, comment out when not in use #debug rescue SiSU_Errors::Rescued.new($!,$@,@md.opt.cmd,@md.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -526,14 +538,15 @@ WOK end def xml if @prog.tidy !=false - if @md.opt.cmd =~/[VM]/ - SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','Using XML Tidy','check document structure').colorize unless @md.opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','','') - tell.grey_open unless @md.opt.cmd =~/q/ + if (@md.opt.act[:verbose_plus][:set]==:on \ + || @md.opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','Using XML Tidy','check document structure').colorize unless @md.opt.act[:quiet][:set]==:on + tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'invert','','') + tell.grey_open unless @md.opt.act[:quiet][:set]==:on tidyfile='/dev/null' #don't want one or screen output, check for alternative flags tidy=SiSU_Env::SystemCall.new(@file,tidyfile) tidy.well_formed? - tell.p_off unless @md.opt.cmd =~/q/ + tell.p_off unless @md.opt.act[:quiet][:set]==:on end end end diff --git a/lib/sisu/v5/xml_fictionbook.rb b/lib/sisu/v5/xml_fictionbook.rb index 05a02c9b..446e12e2 100644 --- a/lib/sisu/v5/xml_fictionbook.rb +++ b/lib/sisu/v5/xml_fictionbook.rb @@ -186,7 +186,7 @@ WOK end def put(line) @file_fictionbook.puts line - puts line if @md.opt.cmd =~/V/ + puts line if @md.opt.act[:verbose_plus][:set]==:on end def structure_build_tag_close(lev,h) @sp=' ' @@ -266,7 +266,7 @@ WOK y="#{@sp*6}<#{@s[6]}>\n#{x[:para]}" @h[0]=6 else - y=if @md.opt.cmd =~/V/; "#{x[:para]}" + y=if @md.opt.act[:verbose_plus][:set]==:on; "#{x[:para]}" else nil end end @@ -291,7 +291,7 @@ WOK @ds[c][:para]=markup(para,'title') else @ds[c]={} - @ds[c][:para]=markup(para) if @md.opt.cmd =~/V/ + @ds[c][:para]=markup(para) if @md.opt.act[:verbose_plus][:set]==:on end c+=1 end diff --git a/lib/sisu/v5/xml_format.rb b/lib/sisu/v5/xml_format.rb index 14710a99..642096c0 100644 --- a/lib/sisu/v5/xml_format.rb +++ b/lib/sisu/v5/xml_format.rb @@ -1001,7 +1001,7 @@ WOK else nil end else - if @md.opt.cmd =~/M/ + if @md.opt.act[:maintenance][:set]==:on p __FILE__ << ':' << __LINE__.to_s p t_o.class p caller diff --git a/lib/sisu/v5/xml_scaffold.rb b/lib/sisu/v5/xml_scaffold.rb index c935c384..10a1aee8 100644 --- a/lib/sisu/v5/xml_scaffold.rb +++ b/lib/sisu/v5/xml_scaffold.rb @@ -108,8 +108,10 @@ module SiSU_XML_Scaffold # 'sect2' # 'section' #] #] data=@data - structure_outline(data) if @md.opt.cmd =~/V/ - structure_simple(data) if @md.opt.cmd =~/V/ + if @md.opt.act[:verbose_plus][:set]==:on + structure_outline(data) + structure_simple(data) + end structure_build(data) end def structure_outline(data) diff --git a/lib/sisu/v5/zap.rb b/lib/sisu/v5/zap.rb index 9d3cd10c..908d33d1 100644 --- a/lib/sisu/v5/zap.rb +++ b/lib/sisu/v5/zap.rb @@ -71,14 +71,14 @@ module SiSU_Zap zap_path="#{@env.path.output}/#{@env.fnb}" z=SiSU_Env::CleanOutput.new(@opt) if SiSU_Env::InfoSettings.new.permission?('zap') - unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,"Clean files related to processing #{@opt.cmd} ->","#{@opt.fns} -> #{zap_path}") + unless @opt.act[:quiet][:set]==:on + tell=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"Clean files related to processing #{@opt.cmd} ->","#{@opt.fns} -> #{zap_path}") tell.warn end z.zap.remove_output else - unless @opt.cmd =~/q/ - tell=SiSU_Screen::Ansi.new(@opt.cmd,'use of -Z (zap) has not enabled in sisurc.yml') + unless @opt.act[:quiet][:set]==:on + tell=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'use of -Z (zap) has not enabled in sisurc.yml') tell.warn end end -- cgit v1.2.3