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