aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-07-24 20:51:43 -0400
committerRalph Amissah <ralph@amissah.com>2014-07-24 20:51:46 -0400
commit2907137b4402a01c36730dfa834363c4d4b4122f (patch)
tree35879197ba433fad034246dd8f6050ef48fbf11e /lib
parentv5 v6: version & changelog (& rakefile) (diff)
v5 v6: ao_numbering, auto name segment, tweak to make behave as intendedsisu_5.5.4
* further testing required
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v5/ao_numbering.rb20
-rw-r--r--lib/sisu/v5/constants.rb5
-rw-r--r--lib/sisu/v6/ao_numbering.rb20
-rw-r--r--lib/sisu/v6/constants.rb5
4 files changed, 26 insertions, 24 deletions
diff --git a/lib/sisu/v5/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb
index a8304fa3..b4ff7f0b 100644
--- a/lib/sisu/v5/ao_numbering.rb
+++ b/lib/sisu/v5/ao_numbering.rb
@@ -301,8 +301,8 @@ module SiSU_AO_Numbering
@tuned_file=@tuned_file.flatten
end
def leading_zeros_fixed_width_number(possible_seg_name)
- if possible_seg_name =~/^([0-9]+?\.|[0-9]+)$/m #!~/[.,:-]+/
- possible_seg_name=possible_seg_name.
+ if possible_seg_name.to_s =~/^([0-9]+?\.|[0-9]+)$/m #!~/[.,:-]+/
+ possible_seg_name=possible_seg_name.to_s.
gsub(/\.$/,'')
nl=possible_seg_name.to_s.length
zero='0'
@@ -324,31 +324,31 @@ module SiSU_AO_Numbering
possible_seg_name=possible_seg_name.
gsub(/\.$/,'')
end
- chosen_seg_name=if possible_seg_name =~/^[0-9]+[.]?$/m \
+ 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'
prefix + leading_zeros_fixed_width_number(possible_seg_name)
- elsif possible_seg_name =~/^[0-9]+[.,:-]*$/m \
+ elsif possible_seg_name.to_s =~/^[0-9]+[.,:-]*$/m \
and lv == '1'
- possible_seg_name=possible_seg_name.
+ possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
- elsif possible_seg_name =~
+ elsif possible_seg_name.to_s =~
/^[0-9]+[.,:-][0-9]+[.,:-]*$/m \
and lv == '2'
- possible_seg_name=possible_seg_name.
+ possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
- elsif possible_seg_name =~
+ elsif possible_seg_name.to_s =~
/^[0-9]+[.,:-][0-9]+[.,:-][0-9][\d.,:-]*$/m \
and lv == '3'
- possible_seg_name=possible_seg_name.
+ possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
- else 'x'*lv.to_i + possible_seg_name.to_s
+ else Mx[:segname_prefix_auto_num_other]*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
diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb
index d242ef1d..55c3ff2a 100644
--- a/lib/sisu/v5/constants.rb
+++ b/lib/sisu/v5/constants.rb
@@ -104,8 +104,9 @@ Xx={
html_relative1: '※',
}
Mx={
- segname_prefix_auto_num_extract: 's',
- segname_prefix_auto_num_provide: 's_',
+ segname_prefix_auto_num_extract: 'c',
+ segname_prefix_auto_num_provide: 's',
+ segname_prefix_auto_num_other: 'x',
ocn_id_char: 'o',
note: 'note_',
note_ref: 'noteref_',
diff --git a/lib/sisu/v6/ao_numbering.rb b/lib/sisu/v6/ao_numbering.rb
index 1c5c326e..a96df577 100644
--- a/lib/sisu/v6/ao_numbering.rb
+++ b/lib/sisu/v6/ao_numbering.rb
@@ -301,8 +301,8 @@ module SiSU_AO_Numbering
@tuned_file=@tuned_file.flatten
end
def leading_zeros_fixed_width_number(possible_seg_name)
- if possible_seg_name =~/^([0-9]+?\.|[0-9]+)$/m #!~/[.,:-]+/
- possible_seg_name=possible_seg_name.
+ if possible_seg_name.to_s =~/^([0-9]+?\.|[0-9]+)$/m #!~/[.,:-]+/
+ possible_seg_name=possible_seg_name.to_s.
gsub(/\.$/,'')
nl=possible_seg_name.to_s.length
zero='0'
@@ -324,31 +324,31 @@ module SiSU_AO_Numbering
possible_seg_name=possible_seg_name.
gsub(/\.$/,'')
end
- chosen_seg_name=if possible_seg_name =~/^[0-9]+[.]?$/m \
+ 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'
prefix + leading_zeros_fixed_width_number(possible_seg_name)
- elsif possible_seg_name =~/^[0-9]+[.,:-]*$/m \
+ elsif possible_seg_name.to_s =~/^[0-9]+[.,:-]*$/m \
and lv == '1'
- possible_seg_name=possible_seg_name.
+ possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
- elsif possible_seg_name =~
+ elsif possible_seg_name.to_s =~
/^[0-9]+[.,:-][0-9]+[.,:-]*$/m \
and lv == '2'
- possible_seg_name=possible_seg_name.
+ possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
- elsif possible_seg_name =~
+ elsif possible_seg_name.to_s =~
/^[0-9]+[.,:-][0-9]+[.,:-][0-9][\d.,:-]*$/m \
and lv == '3'
- possible_seg_name=possible_seg_name.
+ possible_seg_name=possible_seg_name.to_s.
gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
prefix + possible_seg_name
- else 'x'*lv.to_i + possible_seg_name.to_s
+ else Mx[:segname_prefix_auto_num_other]*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
diff --git a/lib/sisu/v6/constants.rb b/lib/sisu/v6/constants.rb
index 87611bf9..2a5e124c 100644
--- a/lib/sisu/v6/constants.rb
+++ b/lib/sisu/v6/constants.rb
@@ -104,8 +104,9 @@ Xx={
html_relative1: '※',
}
Mx={
- segname_prefix_auto_num_extract: 's',
- segname_prefix_auto_num_provide: 's_',
+ segname_prefix_auto_num_extract: 'c',
+ segname_prefix_auto_num_provide: 's',
+ segname_prefix_auto_num_other: 'x',
ocn_id_char: 'o',
note: 'note_',
note_ref: 'noteref_',