diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v2/dal_numbering.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sisu/v2/dal_numbering.rb b/lib/sisu/v2/dal_numbering.rb index ea68fd22..d1db1939 100644 --- a/lib/sisu/v2/dal_numbering.rb +++ b/lib/sisu/v2/dal_numbering.rb @@ -134,6 +134,7 @@ module SiSU_numbering end t_not=0 data.compact! + chapter_number_counter=0 data.each do |dob| #@md.seg_names << [additions to segment names] title_no=nil dob=SiSU_document_structure_extract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require @@ -141,6 +142,12 @@ module SiSU_numbering and dob.autonum_ \ and defined? @md.make.num_top \ and @md.make.num_top !~/^$/ + if dob.lv=='1' \ + and dob.obj =~/^#\s|\s#(?:\s|$)/ + chapter_number_counter +=1 + dob.obj.gsub!(/^#\s/,"#{chapter_number_counter} ") + dob.obj.gsub!(/#([:,]?\s|[.]?$)/,"#{chapter_number_counter}\\1") + end if dob.ln==no1 @subnumber=1 @subnumber=0 if dob.ln==no1 |