aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2010-04-28 22:39:57 -0400
committerRalph Amissah <ralph@amissah.com>2010-04-28 22:39:57 -0400
commitc11185f9e9c7b9acabb3a8a49dbc56d1a01c51b3 (patch)
treee930220b94943e0ee5c10109b7142decae315208 /lib
parentsha256 (2.3.1) (diff)
dal, markup, auto-level 1~ conversion of hash to number
In cases where the line is interpreted as level 1~ (either by explicit 1~ tag or @make: :heading:) a hash (#) [octothorpe] will be auto-incremented, markup e.g. "1~ Chapter #: My Way".
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v2/dal_numbering.rb7
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