From 809034240a1be22cc00cb3b4c1df1dd2facdc8f8 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Aug 2014 00:32:27 -0400 Subject: v5: merged v6 libraries * commandline, --act0 to --act9, rc-config with flag:act[0-9] * configurable command line options increased to 0 - 9 (instead of 0 - 5) * use --act0 to --act9 (previous flags -1 to -5; -0 to -9 now available) * default --act0 * rc config with flag:act0 to flag:act9 (previously roman numerals) * legacy roman numeral configuration works (for now) * use opt.act, code internals (simplify, cleaner; remove opt.cmd & opt.mod) * hub, further changes related to use of opt.act; hub file split --- lib/sisu/v5/xml_dom.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 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 a602eee3..38c60edf 100644 --- a/lib/sisu/v5/xml_dom.rb +++ b/lib/sisu/v5/xml_dom.rb @@ -117,7 +117,7 @@ module SiSU_XML_DOM end SiSU_XML_DOM::Source::Songsheet.new(@particulars).songsheet rescue - SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do + SiSU_Errors::Rescued.new($!,$@,@opt.selections.str,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ end ensure @@ -141,7 +141,7 @@ module SiSU_XML_DOM 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 + SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do __LINE__.to_s + ':' + __FILE__ end ensure -- cgit v1.2.3 From 6bc3b814011e829db684ec96bb3abd1e4abb29c3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Aug 2014 00:34:25 -0400 Subject: v5 v6: extend document structure, headings A - D, 1 - 4 * sql db table structure changed (needs to be rebuilt) --- lib/sisu/v5/xml_dom.rb | 67 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 19 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 38c60edf..fb7d3cb9 100644 --- a/lib/sisu/v5/xml_dom.rb +++ b/lib/sisu/v5/xml_dom.rb @@ -226,12 +226,15 @@ WOK WOK if lv==4 @copen[1]=true - @copen[2]=@copen[3]=false + @copen[2]=@copen[3]=@copen[4]=false elsif lv==5 @copen[2]=true - @copen[3]=false + @copen[3]=@copen[4]=false elsif lv==6 @copen[3]=true + @copen[4]=false + elsif lv==7 + @copen[4]=true end end def xml_structure(dob,type='norm') @@ -259,21 +262,24 @@ WOK @cont[2]=false if @cont[2] @cont[3]=false if @cont[3] ####### attempt to close contents - if @copen[3] # 6~ + if @copen[4] # 4~ + [4,3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } + @copen[1]=@copen[2]=@copen[3]=@copen[4]=false + elsif @copen[3] # 3~ [3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } @copen[1]=@copen[2]=@copen[3]=false - elsif @copen[2] # 5~ + elsif @copen[2] # 2~ [2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } @copen[1]=@copen[2]=@copen[3]=false - elsif @copen[1] # 4~ + elsif @copen[1] # 1~ [1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } @copen[1]=@copen[2]=@copen[3]=false end @@xml[:body] << "#{Ax[:tab]*y}" if @level[x] @level[x]=false end - when 4..6 - 6.downto(lv) do |x| + when 4..7 + 7.downto(lv) do |x| if @level[x]==true @xml_contents_close[x]='' end @@ -284,42 +290,61 @@ WOK case lv when 4 @@xml[:body] << "#{Ax[:tab]*5}" if @cont[1] - if @copen[3]==true # 6~ + if @copen[4]==true # 4~ + [4,3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } + elsif @copen[3]==true # 3~ [3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } - elsif @copen[2]==true # 5~ + elsif @copen[2]==true # 2~ [2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } - elsif @copen[1]==true # 4~ + elsif @copen[1]==true # 1~ [1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } end @cont[1]=true when 5 - if @cont[2] \ + if @cont[3] \ + or @cont[2] \ or @cont[1] @@xml[:body] << "#{Ax[:tab]*5}" end - if @copen[3]==true #6~ + if @copen[4]==true #4~ + [4,3,2].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } + elsif @copen[3]==true #3~ [3,2].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } - elsif @copen[2]==true #5~ + elsif @copen[2]==true #2~ [2].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } end @cont[2]=true when 6 - if @cont[3] \ + if @cont[4] \ + or @cont[3] \ or @cont[2] \ or @cont[1] @@xml[:body] << "#{Ax[:tab]*5}" end - if @copen[3] #6{ + if @copen[4] #4~ + [4,3].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } + elsif @copen[3] #3~ [3].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } end @cont[3]=true + when 7 + if @cont[4] \ + or @cont[3] \ + or @cont[2] \ + or @cont[1] + @@xml[:body] << "#{Ax[:tab]*5}" + end + if @copen[4] #4~ + [4].each { |v| @@xml[:body] << "#{Ax[:tab]*n}" } + end + @cont[4]=true end end xml_el ||='' xml_element(dob,xml_el,xml_content,type) if lv @level[lv]=true - ((lv+1)..6).each { |x| @level[x]=false } + ((lv+1)..7).each { |x| @level[x]=false } end end def add_to_body(dob,type='norm') @@ -367,8 +392,8 @@ WOK @level,@cont,@copen,@xml_contents_close=[],[],[],[] @rcdc=false type='norm' - (0..6).each { |x| @cont[x]=@level[x]=false } - (4..6).each { |x| @xml_contents_close[x]='' } + (0..7).each { |x| @cont[x]=@level[x]=false } + (4..7).each { |x| @xml_contents_close[x]='' } xml_head data.each do |dob| @trans.char_enc.utf8(dob) if @sys.locale =~/utf-?8/i #% utf8 @@ -420,6 +445,10 @@ WOK type="heading_content_#{dob.lv}" xml_structure(dob,type) dob.obj=x.heading_body6 + elsif dob.ln==7 + type="heading_content_#{dob.lv}" + xml_structure(dob,type) + dob.obj=x.heading_body7 end else dob.ocn @@ -486,7 +515,7 @@ WOK end end @content_flag=true - 6.downto(4) do |x| + 7.downto(4) do |x| y=x - 1; v=x - 3 if @level[x]==true #2004w36 bug fix? watch/test previous logic broke on free.for.all @coontent_flag introduced if @content_flag==true -- cgit v1.2.3