From 0e42ce6f34c3cfdf370f439f58c4e3de8b05ea92 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 6 Jan 2014 22:42:31 -0500 Subject: v5: cosmetic code, case statement --- lib/sisu/v5/sst_convert_markup.rb | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'lib/sisu/v5/sst_convert_markup.rb') diff --git a/lib/sisu/v5/sst_convert_markup.rb b/lib/sisu/v5/sst_convert_markup.rb index 23ac591b..cec67960 100644 --- a/lib/sisu/v5/sst_convert_markup.rb +++ b/lib/sisu/v5/sst_convert_markup.rb @@ -161,9 +161,9 @@ WOK def convert_filename_36_to_37 @opt.files.each do |f| s=case f - when /(\.s[1-3])$/; f.sub($1,'.sst') - when /(\.r[1-3])$/; f.sub($1,'.ssm') - when /(\.ri)$/; f.sub($1,'.ssi') + when /(\.s[1-3])$/ then f.sub($1,'.sst') + when /(\.r[1-3])$/ then f.sub($1,'.ssm') + when /(\.ri)$/ then f.sub($1,'.ssi') else f end pwd=Dir.pwd @@ -204,26 +204,26 @@ WOK if @opt.mod.inspect =~/--help/ then help elsif @opt.mod.inspect =~/(?:convert|to)[=-](?:xml |sxs|sax|sxd|dom|sxn|node)/ ext=case @opt.mod.inspect - when /(?:convert|to)[=-](?:xml|sxs|sax)/; '.sxs.xml' - when /(?:convert|to)[=-](?:sxd|dom)/; '.sxd.xml' - when /(?:convert|to)[=-](?:sxn|node)/; '.sxn.xml' + when /(?:convert|to)[=-](?:xml|sxs|sax)/ then '.sxs.xml' + when /(?:convert|to)[=-](?:sxd|dom)/ then '.sxd.xml' + when /(?:convert|to)[=-](?:sxn|node)/ then '.sxn.xml' end message("#{@opt.files.inspect}\n\nWARNING, PROCEED AT YOUR OWN RISK,\noverwriting any equivalent file with the extension #{ext}") mr=case @opt.mod.inspect - when /(?:convert|to)[=-](?:sxs|sax|xml )/; convert_to_simple_xml_model_sax - when /(?:convert|to)[=-](?:sxd|dom)/; convert_to_simple_xml_model_dom - when /(?:convert|to)[=-](?:sxn|node)/; convert_to_simple_xml_model_node + when /(?:convert|to)[=-](?:sxs|sax|xml )/ then convert_to_simple_xml_model_sax + when /(?:convert|to)[=-](?:sxd|dom)/ then convert_to_simple_xml_model_dom + when /(?:convert|to)[=-](?:sxn|node)/ then convert_to_simple_xml_model_node else help end else mr=case @opt.mod.inspect - when /(?:(?:37)?to-?38|--(?:convert|to)[=-](?:current|0.38))/; convert_37_to_38 - when /(?:(?:38)?to-?37|--(?:convert|to)[=-](?:0.37))/; convert_38_to_37 - when /(?:36to37)/; convert_filename_36_to_37 - when /(?:convert|from)[=-]kdi/; convert_kdi_to_sst - when /(?:(?:convert|from)[=-])?(?:xml_to_sst|xml2sst|sxml|sxs|sxd|sxd)/; convert_s_xml_to_sst - when /(?:convert|to)[=-]footnotes/; convert_footnotes - when /convert|default/; current_match_and_replace + when /(?:(?:37)?to-?38|--(?:convert|to)[=-](?:current|0.38))/ then convert_37_to_38 + when /(?:(?:38)?to-?37|--(?:convert|to)[=-](?:0.37))/ then convert_38_to_37 + when /(?:36to37)/ then convert_filename_36_to_37 + when /(?:convert|from)[=-]kdi/ then convert_kdi_to_sst + when /(?:(?:convert|from)[=-])?(?:xml_to_sst|xml2sst|sxml|sxs|sxd|sxd)/ then convert_s_xml_to_sst + when /(?:convert|to)[=-]footnotes/ then convert_footnotes + when /convert|default/ then current_match_and_replace else help end end -- cgit v1.2.3