diff options
Diffstat (limited to 'lib/sisu/v5/ao_numbering.rb')
-rw-r--r-- | lib/sisu/v5/ao_numbering.rb | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/sisu/v5/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb index 00afdfa5..8caa5ccc 100644 --- a/lib/sisu/v5/ao_numbering.rb +++ b/lib/sisu/v5/ao_numbering.rb @@ -8,7 +8,8 @@ * Author: Ralph Amissah * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -97,9 +98,9 @@ module SiSU_AO_Numbering def number_sub_heading(dob,num,title_no) unless dob.obj =~/\d+\.|(?:chapter|article|section|clause)\s+\d+/i #name selection arbitrary, fix dob.obj=case dob.name - when /-/; dob.obj.gsub(/^/,"#{title_no} ") - when /^#/; dob.obj.gsub(/^/,"#{title_no} ") - when /^[a-z_\.]+/; dob.obj.gsub(/^/,"#{title_no} ") + when /-/ then dob.obj.gsub(/^/,"#{title_no} ") + when /^#/ then dob.obj.gsub(/^/,"#{title_no} ") + when /^[a-z_\.]+/ then dob.obj.gsub(/^/,"#{title_no} ") else dob.name=title_no if dob.name=~/^$/ #where title contains title number dob.obj.gsub(/^/,"#{title_no} ") if title_no =~/\d+/ #main, where title number is to be provided #watch changed placement @@ -157,7 +158,7 @@ module SiSU_AO_Numbering @subnumber=1 @subnumber=0 if dob.ln==no1 end - if dob.ln.to_s =~/^[1-6]/ \ + if dob.ln.to_s =~/^[0-6]/ \ and not dob.toc_ \ and dob.obj !~/#{Mx[:fa_o]}(?:~#|-#)#{Mx[:fa_c]}/ # <-- fix if dob.ln==no1 @@ -205,7 +206,7 @@ module SiSU_AO_Numbering dob.tags=["h#{title_no}",dob.tags].flatten #check whether will work across file types with stop signs dob=number_sub_heading(dob,no3,title_no) end - elsif dob.ln.to_s =~/^[1-6]/ \ + elsif dob.ln.to_s =~/^[0-6]/ \ and dob.name =~ /^[\w-]+-/ # endnotes, watch2005# endnotes, watch2005 dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs dob.name.gsub(/^([a-z_\.]+)-$/,'\1') @@ -215,7 +216,7 @@ module SiSU_AO_Numbering and @md.markup =~/num_extract/ #AS DANGEROUS force enable with document, note already does this type of numbering for cisg, locate and coordinate logic, is currently misplaced in code, chengwei inspired 2004w23/4 #here lies a bug, as is nil when run from -Dv --update, FIX if (dob.name.nil? or dob.name.empty?) \ - and dob.ln.to_s =~/^[1-9]/ \ + and dob.ln.to_s =~/^[0-9]/ \ and dob.obj =~ /^([\d\.]+)/ #risky (must be unique) consider output to 4~~\d instead of 4~\d dob.name=$1 dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs @@ -249,7 +250,7 @@ module SiSU_AO_Numbering || dob.of ==:para \ || dob.of ==:block if dob.is ==:heading \ - and dob.ln.to_s=~/^[1-9]/ #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later) + and dob.ln.to_s=~/^[0-9]/ #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later) number_small,letter_small=0,0 elsif dob.is ==:para if dob.obj =~/^#[ 1]/ \ @@ -372,7 +373,7 @@ module SiSU_AO_Numbering : @segname tags["#{dob.ocn}"]={ segname: @segname } ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert) - if dob.ln =~/[1-3]/ + if dob.ln =~/[0-3]/ { seg: nil, level: dob.ln } else #elsif dob.ln =~/[4-6]/ { seg: @seg, level: dob.ln } @@ -445,7 +446,7 @@ module SiSU_AO_Numbering @tuned_file=[] data.each do |dob| unless @md.set_heading_seg - if defined? dob.ln and dob.ln.to_s !~/^[123]/m \ + if defined? dob.ln and dob.ln.to_s !~/^[0-3]/m \ and dob.obj !~/\A\s*\Z/m \ and dob.is !=:layout @md.set_heading_seg=true |