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/ --- lib/sisu/v5/xml.rb | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'lib/sisu/v5/xml.rb') 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 -- cgit v1.2.3