From 19b724947c2a1058d63f2dda83106922912f2de6 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Mon, 3 May 2010 17:31:53 -0400
Subject: dal_numbering, heading auto-numbering, a fix

---
 lib/sisu/v2/dal_numbering.rb | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

(limited to 'lib')

diff --git a/lib/sisu/v2/dal_numbering.rb b/lib/sisu/v2/dal_numbering.rb
index d1db1939..c8460ced 100644
--- a/lib/sisu/v2/dal_numbering.rb
+++ b/lib/sisu/v2/dal_numbering.rb
@@ -89,18 +89,20 @@ module SiSU_numbering
       @tuned_file=@tuned_file.flatten
     end
     def number_sub_heading(dob,num,title_no)
-      case dob.name
-      when /-/;  dob.obj.gsub!(/^/,"#{title_no} ")
-      when /^#/; dob.obj.gsub!(/^/,"#{title_no} ")
-      when /^[a-z_\.]+/
-        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
-      end
-      if @md.toc_lev_limit \
-      and @md.toc_lev_limit < num
-        dob.obj.gsub!(/^/,'!_ ') #bold line, watch
+      unless dob.obj =~/\d+\.|(?:chapter|article|section|clause)\s+\d+/i #name selection arbitrary, fix
+        case dob.name
+        when /-/;  dob.obj.gsub!(/^/,"#{title_no} ")
+        when /^#/; dob.obj.gsub!(/^/,"#{title_no} ")
+        when /^[a-z_\.]+/
+          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
+        end
+        if @md.toc_lev_limit \
+        and @md.toc_lev_limit < num
+          dob.obj.gsub!(/^/,'!_ ') #bold line, watch
+        end
       end
       dob
     end
-- 
cgit v1.2.3