diff options
author | Ralph Amissah <ralph@amissah.com> | 2010-05-03 17:31:53 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2010-05-03 17:31:53 -0400 |
commit | 19b724947c2a1058d63f2dda83106922912f2de6 (patch) | |
tree | 74049e1af5d3e530d7d6689d9f18754c7aec4b95 | |
parent | shared_txt, text wrap, <br> related, revert, issues when indented, revisit (diff) |
dal_numbering, heading auto-numbering, a fix
-rw-r--r-- | lib/sisu/v2/dal_numbering.rb | 26 |
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 |