From d9763aebaf71cf9629fdcf3c0e8818a1edb2b528 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 1 May 2010 01:44:04 -0400 Subject: reduce screen output unless some verbose flag (such as -v) is used --- lib/sisu/v2/concordance.rb | 9 ++++++--- lib/sisu/v2/digests.rb | 9 ++++++--- lib/sisu/v2/epub.rb | 16 ++++++++++++---- lib/sisu/v2/epub_segments.rb | 5 +++-- lib/sisu/v2/epub_tune.rb | 5 +++-- lib/sisu/v2/html.rb | 16 ++++++++++++---- lib/sisu/v2/html_minitoc.rb | 4 +++- lib/sisu/v2/html_segments.rb | 5 +++-- lib/sisu/v2/html_tune.rb | 5 +++-- lib/sisu/v2/hub.rb | 5 +++-- lib/sisu/v2/manifest.rb | 7 +++++-- lib/sisu/v2/odf.rb | 9 ++++++--- lib/sisu/v2/plaintext.rb | 9 ++++++--- lib/sisu/v2/texpdf.rb | 10 ++++++---- lib/sisu/v2/xhtml.rb | 8 ++++++-- lib/sisu/v2/xml.rb | 8 ++++++-- lib/sisu/v2/xml_dom.rb | 8 ++++++-- 17 files changed, 95 insertions(+), 43 deletions(-) diff --git a/lib/sisu/v2/concordance.rb b/lib/sisu/v2/concordance.rb index 74338e98..3546b002 100644 --- a/lib/sisu/v2/concordance.rb +++ b/lib/sisu/v2/concordance.rb @@ -76,9 +76,12 @@ module SiSU_Concordance begin @env,@md=@particulars.env,@particulars.md loc=@env.url.output_tell - tool=(@md.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : '' - tell=SiSU_Screen::Ansi.new(@md.cmd,"Concordance",tool) - tell.grey_title_hi unless @md.cmd =~/q/ + tool=(@md.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : @md.fns + unless @md.cmd =~/q/ + @md.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@md.cmd,"Concordance",tool).grey_title_hi \ + : SiSU_Screen::Ansi.new(@md.cmd,'Concordance',tool).green_title_hi + end wordmax=@env.concord_max unless @md.wc_words.nil? if @md.wc_words < wordmax diff --git a/lib/sisu/v2/digests.rb b/lib/sisu/v2/digests.rb index 59893aee..3f1c5445 100644 --- a/lib/sisu/v2/digests.rb +++ b/lib/sisu/v2/digests.rb @@ -75,10 +75,13 @@ module SiSU_Digest_view begin @env,@md,@dal_array=@particulars.env,@particulars.md,@particulars.dal_array tool=if @opt.cmd =~/[MVv]/; "#{@env.program.text_editor} #{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}" - else '' + else @opt.fns + end + unless @opt.cmd =~/q/ + @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 end - tell=SiSU_Screen::Ansi.new(@opt.cmd,"Document #{@dg} Digests",tool) - tell.green_hi_blue unless @opt.cmd =~/q/ tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:digest]}") tell.flow if @opt.cmd =~/[MV]/ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) diff --git a/lib/sisu/v2/epub.rb b/lib/sisu/v2/epub.rb index e6ab1e12..ecc30424 100644 --- a/lib/sisu/v2/epub.rb +++ b/lib/sisu/v2/epub.rb @@ -86,9 +86,13 @@ module SiSU_EPUB loc=@env.path.url.output_tell tool=if @opt.cmd =~/z/; "#{@env.program.epub_viewer} #{loc}/epub/#{@fnb}.epub" elsif @opt.cmd =~/[MVv]/; "#{@env.program.epub_viewer} #{loc}/epub/#{@fnb}.epub" - else '' + else @opt.fns + end + unless @opt.cmd =~/q/ + @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 end - SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_hi_blue unless @opt.cmd =~/q/ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{loc}/epub/#{@fnb}.epub").flow if @opt.cmd =~/[MV]/ @env.path.epub_bld #(@md) @env.path.epub_cp_images(@md) @@ -195,7 +199,9 @@ module SiSU_EPUB @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md end def songsheet #extracts toc for scroll & seg - SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/ + end toc=nil @@firstseg=nil @@toc={ :seg=>[],:seg_mini=>[],:scr=>[],:ncx=>[],:opf=>[] } @@ -491,7 +497,9 @@ module SiSU_EPUB def in_common toc_shared=[] segtoc=[] - SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey if @md.cmd =~/[MVv]/ + end format_head_toc=SiSU_EPUB_Format::Head_toc.new(@md) dochead=format_head_toc.head dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge diff --git a/lib/sisu/v2/epub_segments.rb b/lib/sisu/v2/epub_segments.rb index 5f0b74d3..aa25b82a 100644 --- a/lib/sisu/v2/epub_segments.rb +++ b/lib/sisu/v2/epub_segments.rb @@ -178,8 +178,9 @@ WOK @@seg_name_xhtml=@@seg_name @@seg_total=@@seg_name.length testforartnum=@@seg_name_xhtml - tell=SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length) - tell.segmented unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length) if @md.cmd =~/[MVv]/ + end map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags data.each do |dob| if defined? dob.obj \ diff --git a/lib/sisu/v2/epub_tune.rb b/lib/sisu/v2/epub_tune.rb index 25621bdd..7e012f42 100644 --- a/lib/sisu/v2/epub_tune.rb +++ b/lib/sisu/v2/epub_tune.rb @@ -208,8 +208,9 @@ module SiSU_EPUB_Tune def songsheet begin @cX=SiSU_Screen::Ansi.new(@md.cmd).cX - tell=SiSU_Screen::Ansi.new(@md.cmd,'Tune') - tell.txt_grey unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Tune').txt_grey if @md.cmd =~/[MVv]/ + end data=Tune.new(@data,@md).amp_html data=Tune.new(data,@md).endnotes_html data=Tune.new(data,@md).url_markup diff --git a/lib/sisu/v2/html.rb b/lib/sisu/v2/html.rb index 834eefa1..7e9204fa 100644 --- a/lib/sisu/v2/html.rb +++ b/lib/sisu/v2/html.rb @@ -88,9 +88,13 @@ module SiSU_HTML loc=@env.url.output_tell tool=if @opt.cmd =~/z/; "#{@env.program.web_browser} #{loc}/#{@fnb}/#{@md.fn[:index]}" elsif @opt.cmd =~/[MVv]/; "#{@env.program.web_browser} #{loc}/#{@fnb}/#{@md.fn[:index]}" - else '' + else @opt.fns + end + unless @opt.cmd =~/q/ + @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 end - SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue unless @opt.cmd =~/q/ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@fnb}/#{@md.fn[:index]}").flow if @opt.cmd =~/[MV]/ SiSU_Env::Info_skin.new(@md).select data=nil @@ -226,7 +230,9 @@ module SiSU_HTML @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md end def songsheet #extracts toc for scroll & seg - SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/ + end toc=nil @@firstseg=nil @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] } @@ -503,7 +509,9 @@ WOK def in_common toc_shared=[] @segtoc=[] - SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey if @md.cmd =~/[MVv]/ + end format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) dochead=format_head_toc.head dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge diff --git a/lib/sisu/v2/html_minitoc.rb b/lib/sisu/v2/html_minitoc.rb index 6c3733d7..1a8d6210 100644 --- a/lib/sisu/v2/html_minitoc.rb +++ b/lib/sisu/v2/html_minitoc.rb @@ -70,7 +70,9 @@ @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md end def songsheet - SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey if @md.cmd =~/[MVv]/ + end toc=nil @toc=[] @data.each do |txt| diff --git a/lib/sisu/v2/html_segments.rb b/lib/sisu/v2/html_segments.rb index 022a1d0c..5c0a118c 100644 --- a/lib/sisu/v2/html_segments.rb +++ b/lib/sisu/v2/html_segments.rb @@ -162,8 +162,9 @@ module SiSU_HTML_seg @@seg_name_html=@@seg_name @@seg_total=@@seg_name.length testforartnum=@@seg_name_html - tell=SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length) - tell.segmented unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,@@seg_name.length).segmented if @md.cmd =~/[MVv]/ + end map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map #p map_nametags data.each do |dob| if defined? dob.obj \ diff --git a/lib/sisu/v2/html_tune.rb b/lib/sisu/v2/html_tune.rb index 5f9f981c..65a60af7 100644 --- a/lib/sisu/v2/html_tune.rb +++ b/lib/sisu/v2/html_tune.rb @@ -205,8 +205,9 @@ module SiSU_HTML_Tune def songsheet begin @cX=SiSU_Screen::Ansi.new(@md.cmd).cX - tell=SiSU_Screen::Ansi.new(@md.cmd,'Tune') - tell.txt_grey unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,'Tune').txt_grey if @md.cmd =~/[MVv]/ + end data=Tune.new(@data,@md).endnotes_html data=Tune.new(data,@md).url_markup data=Tune.new(data,@md).markup diff --git a/lib/sisu/v2/hub.rb b/lib/sisu/v2/hub.rb index 58f62d0f..b54ebc51 100644 --- a/lib/sisu/v2/hub.rb +++ b/lib/sisu/v2/hub.rb @@ -152,8 +152,9 @@ module SiSU when /^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d end @n_do=@n_do+1 - tell=SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed") - tell.files_processed unless @opt.cmd =~/q/ + unless @opt.cmd =~/q/ + SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/ + end ObjectSpace.garbage_collect else #print "not processed --> ", fns, "\n" end diff --git a/lib/sisu/v2/manifest.rb b/lib/sisu/v2/manifest.rb index 9f0f2513..829ce03b 100644 --- a/lib/sisu/v2/manifest.rb +++ b/lib/sisu/v2/manifest.rb @@ -84,8 +84,11 @@ module SiSU_Manifest browser=@env.program.console_web_browser webserv_url=@env.path.url.output_tell url_html="#{webserv_url}/#{@md.fnb}/#{@md.fn[:manifest]}" - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}") - tell.green_hi_blue unless @opt.cmd =~/q/ + unless @opt.cmd =~/q/ + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}").green_hi_blue \ + : SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',@opt.fns).green_title_hi + end tell=SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}") tell.grey_tab if @opt.cmd =~/v/i data=SiSU_HTML::Source::Html_environment.new(@particulars).tuned_file_instructions diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb index d4aeb616..b6524876 100644 --- a/lib/sisu/v2/odf.rb +++ b/lib/sisu/v2/odf.rb @@ -85,10 +85,13 @@ module SiSU_ODF opendoc=@md.fn[:odf] path=@env.path.output_tell tool=if @opt.cmd =~/[MVv]/; "#{@env.program.odf_viewer} #{path}/#{@md.fnb}/#{opendoc}" - else '' + else @opt.fns + end + unless @opt.cmd =~/q/ + @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 end - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Opendocument (ODF:ODT)',tool) - tell.green_hi_blue unless @opt.cmd =~/q/ tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{opendoc}") tell.flow if @opt.cmd =~/[MV]/ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) diff --git a/lib/sisu/v2/plaintext.rb b/lib/sisu/v2/plaintext.rb index c69490ab..09e94392 100644 --- a/lib/sisu/v2/plaintext.rb +++ b/lib/sisu/v2/plaintext.rb @@ -83,10 +83,13 @@ module SiSU_Plaintext env=SiSU_Env::Info_env.new(@opt.fns) path=env.path.output_tell tool=if @opt.cmd =~/[MVv]/; "#{env.program.text_editor} #{path}/#{md.fnb}/#{md.fn[:plain]}" - else '' + else @opt.fns + end + unless @opt.cmd =~/q/ + @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 end - tell=SiSU_Screen::Ansi.new(@opt.cmd,'Plaintext',tool) - tell.green_hi_blue unless @opt.cmd =~/q/ tell=SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{env.path.output_tell}/#{md.fnb}/#{md.fn[:plain]}") tell.flow if @opt.cmd =~/[MV]/ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) diff --git a/lib/sisu/v2/texpdf.rb b/lib/sisu/v2/texpdf.rb index 4854ce72..bdb3f7dd 100644 --- a/lib/sisu/v2/texpdf.rb +++ b/lib/sisu/v2/texpdf.rb @@ -200,8 +200,9 @@ module SiSU_TeX rm(landscape_pdf) else p "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.cmd.inspect =~/M/ end - tell=SiSU_Screen::Ansi.new(@md.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)') - tell.generic_number unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,@@n_lpdf,'processed (SiSU LaTeX to pdf - using pdfetex aka. pdftex or pdflatex)').generic_number if @md.cmd =~/[MVv]/ + end end def latexrun_selective begin @@ -296,8 +297,9 @@ module SiSU_TeX data=@data @@tex_footnote_array=[] @@rights=nil - tell=SiSU_Screen::Ansi.new(@md.cmd,"pdfTex portrait & landscape") - tell.txt_grey unless @md.cmd =~/q/ + unless @md.cmd =~/q/ + SiSU_Screen::Ansi.new(@md.cmd,"pdfTex portrait & landscape").txt_grey if @md.cmd=~/[MVvz]/ + 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 diff --git a/lib/sisu/v2/xhtml.rb b/lib/sisu/v2/xhtml.rb index 80eb76d5..56371ef8 100644 --- a/lib/sisu/v2/xhtml.rb +++ b/lib/sisu/v2/xhtml.rb @@ -84,9 +84,13 @@ module SiSU_XHTML loc=@env.url.output_tell tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:xhtml]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:xhtml]}" elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:xhtml]}" - else '' + else @opt.fns + end + unless @opt.cmd =~/q/ + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XHTML',tool).colorize \ + : SiSU_Screen::Ansi.new(@opt.cmd,'XHTML',tool).green_title_hi end - SiSU_Screen::Ansi.new(@opt.cmd,'invert','XHTML',tool).colorize unless @opt.cmd =~/q/ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:xhtml]}").flow if @opt.cmd =~/[MV]/ SiSU_XHTML::Source::Songsheet.new(@particulars).song rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error diff --git a/lib/sisu/v2/xml.rb b/lib/sisu/v2/xml.rb index 7c95f1ce..d9664b92 100644 --- a/lib/sisu/v2/xml.rb +++ b/lib/sisu/v2/xml.rb @@ -84,9 +84,13 @@ module SiSU_XML_SAX loc=@env.url.output_tell tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:sax]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:sax]}" elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:sax]}" - else '' + else @opt.fns + end + unless @opt.cmd =~/q/ + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',tool).colorize \ + : SiSU_Screen::Ansi.new(@opt.cmd,'XML SAX',tool).green_title_hi end - SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML SAX',tool).colorize unless @opt.cmd =~/q/ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:sax]}").flow if @opt.cmd =~/[MV]/ SiSU_XML_SAX::Source::Songsheet.new(@particulars).song rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error diff --git a/lib/sisu/v2/xml_dom.rb b/lib/sisu/v2/xml_dom.rb index ff38ff86..8242385d 100644 --- a/lib/sisu/v2/xml_dom.rb +++ b/lib/sisu/v2/xml_dom.rb @@ -82,9 +82,13 @@ module SiSU_XML_DOM loc=@env.url.output_tell tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:dom]}\n\t#{@env.program.xml_viewer} #{path}/#{@md.fnb}/#{@md.fn[:dom]}" elsif @opt.cmd =~/v/; "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:dom]}" - else '' + else @opt.fns + end + unless @opt.cmd =~/q/ + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',tool).colorize \ + : SiSU_Screen::Ansi.new(@opt.cmd,'XML DOM',tool).green_title_hi end - SiSU_Screen::Ansi.new(@opt.cmd,'invert','XML DOM',tool).colorize unless @opt.cmd =~/q/ SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#{@md.fnb}/#{@md.fn[:dom]}").flow if @opt.cmd =~/[MV]/ SiSU_XML_DOM::Source::Songsheet.new(@particulars).songsheet rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error -- cgit v1.2.3