aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-09-05 23:17:24 -0400
committerRalph Amissah <ralph@amissah.com>2014-09-05 23:17:26 -0400
commitcf1ec2346fbe9d0c54d887eb7cd79588dcf3606b (patch)
tree862439cad3bd6a3d1b54e2b667f737c871994aa8
parentv5 v6: html navigation, enable turn off (nav buttons on remaining html segments) (diff)
v5 v6: ao_numbering, provide more information on duplicate numbering before stop
-rw-r--r--data/doc/sisu/CHANGELOG_v52
-rw-r--r--data/doc/sisu/CHANGELOG_v62
-rw-r--r--lib/sisu/v5/ao_numbering.rb23
-rw-r--r--lib/sisu/v6/ao_numbering.rb23
4 files changed, 30 insertions, 20 deletions
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index aed37d24..90d95339 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -38,6 +38,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.5.orig.tar.xz
sisu_5.6.5.orig.tar.xz
sisu_5.6.5-1.dsc
+* ao_numbering, provide more information on duplicate numbering before stop
+
* html navigation, enable turn off (nav buttons on remaining html segments)
* (for html) set default to navigation bar off
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 2e6a6f9b..772c2df9 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.6.orig.tar.xz
sisu_6.2.6.orig.tar.xz
sisu_6.2.6-1.dsc
+* ao_numbering, provide more information on duplicate numbering before stop
+
* html navigation, enable turn off (nav buttons on remaining html segments)
* (for html) set default to navigation bar off
diff --git a/lib/sisu/v5/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb
index b4ff7f0b..f9257e6a 100644
--- a/lib/sisu/v5/ao_numbering.rb
+++ b/lib/sisu/v5/ao_numbering.rb
@@ -314,11 +314,11 @@ module SiSU_AO_Numbering
possible_seg_name.to_s
end
end
- def auto_seg_name(possible_seg_name,heading_num_is,lv,type)
+ def auto_seg_name(possible_seg_name,heading_num_is,dob,type)
prefix=case type
when :auto then Mx[:segname_prefix_auto_num_provide]
when :extract then Mx[:segname_prefix_auto_num_extract]
- else '_'*lv.to_i #should not occur
+ else '_'*dob.lv.to_i #should not occur
end
if possible_seg_name =~/^[0-9]+?\.$/m #!~/[.,:-]+/
possible_seg_name=possible_seg_name.
@@ -326,35 +326,38 @@ module SiSU_AO_Numbering
end
chosen_seg_name=if possible_seg_name.to_s =~/^[0-9]+[.]?$/m \
and possible_seg_name.to_i <= heading_num_is.to_i \
- and lv == '1'
+ and dob.lv == '1'
prefix + leading_zeros_fixed_width_number(possible_seg_name)
elsif possible_seg_name.to_s =~/^[0-9]+[.,:-]*$/m \
- and lv == '1'
+ and dob.lv == '1'
possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
elsif possible_seg_name.to_s =~
/^[0-9]+[.,:-][0-9]+[.,:-]*$/m \
- and lv == '2'
+ and dob.lv == '2'
possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
elsif possible_seg_name.to_s =~
/^[0-9]+[.,:-][0-9]+[.,:-][0-9][\d.,:-]*$/m \
- and lv == '3'
+ and dob.lv == '3'
possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
- else Mx[:segname_prefix_auto_num_other]*lv.to_i + possible_seg_name.to_s
+ else
+ Mx[:segname_prefix_auto_num_other]*dob.lv.to_i \
+ + possible_seg_name.to_s
end
@chosen_seg_names << chosen_seg_name
if @chosen_seg_names.compact.uniq.length == @chosen_seg_names.compact.length #checks that all auto given seg names are unique
chosen_seg_name
else
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark("duplicated auto segment name: #{type} #{chosen_seg_name} - #{@chosen_seg_names}; manually name level 1 segments '1~given_name'")
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).
+ mark("duplicated auto segment name: #{type} #{chosen_seg_name} - #{@chosen_seg_names}; manually name level 1 segments '1~given_name'\n #{@md.fns}\n #{dob.obj}")
exit
end
end
@@ -396,7 +399,7 @@ module SiSU_AO_Numbering
and dob.obj =~/^\s*(?:\S+\s+)?([0-9][0-9.,:-]*)/m #heading starts with a recognised numeric or word followed by a recognised numeric construct, use that as name
possible_seg_name=$1
possible_seg_name=
- auto_seg_name(possible_seg_name,heading_num_is,dob.lv,:extract)
+ auto_seg_name(possible_seg_name,heading_num_is,dob,:extract)
possible_seg_name=possible_seg_name.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
@@ -421,7 +424,7 @@ module SiSU_AO_Numbering
if dob.ln==4 \
and not dob.name #if still no segment name, provide a numerical one
possible_seg_name=
- auto_seg_name(art_filename_auto,heading_num_is,dob.lv,:auto)
+ auto_seg_name(art_filename_auto,heading_num_is,dob,:auto)
if @md.seg_names.is_a?(Array) \
and not @md.seg_names.include?(possible_seg_name)
dob.name=possible_seg_name
diff --git a/lib/sisu/v6/ao_numbering.rb b/lib/sisu/v6/ao_numbering.rb
index a96df577..7a4e4cee 100644
--- a/lib/sisu/v6/ao_numbering.rb
+++ b/lib/sisu/v6/ao_numbering.rb
@@ -314,11 +314,11 @@ module SiSU_AO_Numbering
possible_seg_name.to_s
end
end
- def auto_seg_name(possible_seg_name,heading_num_is,lv,type)
+ def auto_seg_name(possible_seg_name,heading_num_is,dob,type)
prefix=case type
when :auto then Mx[:segname_prefix_auto_num_provide]
when :extract then Mx[:segname_prefix_auto_num_extract]
- else '_'*lv.to_i #should not occur
+ else '_'*dob.lv.to_i #should not occur
end
if possible_seg_name =~/^[0-9]+?\.$/m #!~/[.,:-]+/
possible_seg_name=possible_seg_name.
@@ -326,35 +326,38 @@ module SiSU_AO_Numbering
end
chosen_seg_name=if possible_seg_name.to_s =~/^[0-9]+[.]?$/m \
and possible_seg_name.to_i <= heading_num_is.to_i \
- and lv == '1'
+ and dob.lv == '1'
prefix + leading_zeros_fixed_width_number(possible_seg_name)
elsif possible_seg_name.to_s =~/^[0-9]+[.,:-]*$/m \
- and lv == '1'
+ and dob.lv == '1'
possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
elsif possible_seg_name.to_s =~
/^[0-9]+[.,:-][0-9]+[.,:-]*$/m \
- and lv == '2'
+ and dob.lv == '2'
possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
elsif possible_seg_name.to_s =~
/^[0-9]+[.,:-][0-9]+[.,:-][0-9][\d.,:-]*$/m \
- and lv == '3'
+ and dob.lv == '3'
possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
- else Mx[:segname_prefix_auto_num_other]*lv.to_i + possible_seg_name.to_s
+ else
+ Mx[:segname_prefix_auto_num_other]*dob.lv.to_i \
+ + possible_seg_name.to_s
end
@chosen_seg_names << chosen_seg_name
if @chosen_seg_names.compact.uniq.length == @chosen_seg_names.compact.length #checks that all auto given seg names are unique
chosen_seg_name
else
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).mark("duplicated auto segment name: #{type} #{chosen_seg_name} - #{@chosen_seg_names}; manually name level 1 segments '1~given_name'")
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).
+ mark("duplicated auto segment name: #{type} #{chosen_seg_name} - #{@chosen_seg_names}; manually name level 1 segments '1~given_name'\n #{@md.fns}\n #{dob.obj}")
exit
end
end
@@ -396,7 +399,7 @@ module SiSU_AO_Numbering
and dob.obj =~/^\s*(?:\S+\s+)?([0-9][0-9.,:-]*)/m #heading starts with a recognised numeric or word followed by a recognised numeric construct, use that as name
possible_seg_name=$1
possible_seg_name=
- auto_seg_name(possible_seg_name,heading_num_is,dob.lv,:extract)
+ auto_seg_name(possible_seg_name,heading_num_is,dob,:extract)
possible_seg_name=possible_seg_name.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
@@ -421,7 +424,7 @@ module SiSU_AO_Numbering
if dob.ln==4 \
and not dob.name #if still no segment name, provide a numerical one
possible_seg_name=
- auto_seg_name(art_filename_auto,heading_num_is,dob.lv,:auto)
+ auto_seg_name(art_filename_auto,heading_num_is,dob,:auto)
if @md.seg_names.is_a?(Array) \
and not @md.seg_names.include?(possible_seg_name)
dob.name=possible_seg_name