diff options
| author | Ralph Amissah <ralph@amissah.com> | 2014-07-07 01:37:55 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2014-07-07 01:37:55 -0400 | 
| commit | ea8c79ccb94c29daa34246dc3125b23406b9a8ac (patch) | |
| tree | a6a2e24a0b20831efb8af2fcea5241fdddd59a3c /lib | |
| parent | debian/changelog (5.4.4-1) (diff) | |
| parent | sisu.org, README minor (diff) | |
Merge tag 'sisu_5.4.5' into debian/sid
SiSU 5.4.5
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sisu/v5/ao_numbering.rb | 23 | ||||
| -rw-r--r-- | lib/sisu/v5/constants.rb | 3 | ||||
| -rw-r--r-- | lib/sisu/v6/ao_numbering.rb | 23 | ||||
| -rw-r--r-- | lib/sisu/v6/constants.rb | 3 | 
4 files changed, 30 insertions, 22 deletions
| diff --git a/lib/sisu/v5/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb index 9fbaaab5..278ea514 100644 --- a/lib/sisu/v5/ao_numbering.rb +++ b/lib/sisu/v5/ao_numbering.rb @@ -308,27 +308,30 @@ module SiSU_AO_Numbering          zeros_fixed_width=number_of_segments?.to_s.length          zero_width=(zeros_fixed_width - nl)          zero_width == 0 \ -        ? Mx[:auto_seg_prefix] + -          possible_seg_name.to_s -        : Mx[:auto_seg_prefix] + -          zero*zero_width + +        ? possible_seg_name.to_s +        : zero*zero_width +            possible_seg_name.to_s        end      end -    def auto_seg_name(possible_seg_name,heading_num_is) +    def auto_seg_name(possible_seg_name,heading_num_is,type) +      prefix=case type +      when :auto then    Mx[:segname_prefix_auto_num_provide] +      when :extract then Mx[:segname_prefix_auto_num_extract] +      else               '_' #should not occur +      end        if possible_seg_name =~/^[0-9]+?\.$/m                                  #!~/[.,:-]+/          possible_seg_name=possible_seg_name.            gsub(/\.$/,'')        end        if possible_seg_name =~/^[0-9]+$/m \        and possible_seg_name.to_i <= heading_num_is.to_i -        leading_zeros_fixed_width_number(possible_seg_name) +        prefix + leading_zeros_fixed_width_number(possible_seg_name)        elsif possible_seg_name =~/^[\d.,:-]+$/m          possible_seg_name=possible_seg_name.            gsub(/(?:[:,-]|\W)/,'.').            gsub(/\.$/,'') -        #Mx[:auto_seg_prefix] + possible_seg_name -      else possible_seg_name.to_s +        prefix + possible_seg_name +      else prefix + possible_seg_name.to_s        end      end      def name_para_seg_filename(data)                                                   #segment naming, remaining @@ -369,7 +372,7 @@ module SiSU_AO_Numbering            and dob.obj =~/^\s*(?:\S+\s+)?([\d.,:-]+)/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) +              auto_seg_name(possible_seg_name,heading_num_is,:extract)              possible_seg_name=possible_seg_name.                gsub(/(?:[:,-]|\W)/,'.').                gsub(/\.$/,'') @@ -394,7 +397,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) +              auto_seg_name(art_filename_auto,heading_num_is,: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/v5/constants.rb b/lib/sisu/v5/constants.rb index eb252fda..05678b32 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -104,7 +104,8 @@ Xx={    html_relative1:            '※',  }  Mx={ -  auto_seg_prefix:           's', +  segname_prefix_auto_num_extract: 's', +  segname_prefix_auto_num_provide: 's_',    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 755db795..ffafbf9c 100644 --- a/lib/sisu/v6/ao_numbering.rb +++ b/lib/sisu/v6/ao_numbering.rb @@ -308,27 +308,30 @@ module SiSU_AO_Numbering          zeros_fixed_width=number_of_segments?.to_s.length          zero_width=(zeros_fixed_width - nl)          zero_width == 0 \ -        ? Mx[:auto_seg_prefix] + -          possible_seg_name.to_s -        : Mx[:auto_seg_prefix] + -          zero*zero_width + +        ? possible_seg_name.to_s +        : zero*zero_width +            possible_seg_name.to_s        end      end -    def auto_seg_name(possible_seg_name,heading_num_is) +    def auto_seg_name(possible_seg_name,heading_num_is,type) +      prefix=case type +      when :auto then    Mx[:segname_prefix_auto_num_provide] +      when :extract then Mx[:segname_prefix_auto_num_extract] +      else               '_' #should not occur +      end        if possible_seg_name =~/^[0-9]+?\.$/m                                  #!~/[.,:-]+/          possible_seg_name=possible_seg_name.            gsub(/\.$/,'')        end        if possible_seg_name =~/^[0-9]+$/m \        and possible_seg_name.to_i <= heading_num_is.to_i -        leading_zeros_fixed_width_number(possible_seg_name) +        prefix + leading_zeros_fixed_width_number(possible_seg_name)        elsif possible_seg_name =~/^[\d.,:-]+$/m          possible_seg_name=possible_seg_name.            gsub(/(?:[:,-]|\W)/,'.').            gsub(/\.$/,'') -        #Mx[:auto_seg_prefix] + possible_seg_name -      else possible_seg_name.to_s +        prefix + possible_seg_name +      else prefix + possible_seg_name.to_s        end      end      def name_para_seg_filename(data)                                                   #segment naming, remaining @@ -369,7 +372,7 @@ module SiSU_AO_Numbering            and dob.obj =~/^\s*(?:\S+\s+)?([\d.,:-]+)/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) +              auto_seg_name(possible_seg_name,heading_num_is,:extract)              possible_seg_name=possible_seg_name.                gsub(/(?:[:,-]|\W)/,'.').                gsub(/\.$/,'') @@ -394,7 +397,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) +              auto_seg_name(art_filename_auto,heading_num_is,: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/constants.rb b/lib/sisu/v6/constants.rb index d25478d1..53ed226a 100644 --- a/lib/sisu/v6/constants.rb +++ b/lib/sisu/v6/constants.rb @@ -104,7 +104,8 @@ Xx={    html_relative1:            '※',  }  Mx={ -  auto_seg_prefix:           's', +  segname_prefix_auto_num_extract: 's', +  segname_prefix_auto_num_provide: 's_',    ocn_id_char:               'o',    note:                      'note_',    note_ref:                  'noteref_', | 
