aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/sisu/v2/dal_numbering.rb26
1 files changed, 14 insertions, 12 deletions
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