Changeset 385
- Timestamp:
- 1999-07-14T14:54:20+12:00 (25 years ago)
- Location:
- trunk/gsdl/perllib/classify
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/AZList.pm
r360 r385 2 2 3 3 package AZList; 4 5 use sorttools; 4 6 5 7 sub new { … … 34 36 if (defined $metavalue && $metavalue =~ /\w/) { 35 37 if ($self->{'metaname'} eq 'Creator') { 36 $self->format_string_name_english (\$metavalue);38 &sorttools::format_string_name_english (\$metavalue); 37 39 } else { 38 $self->format_string_english (\$metavalue);40 &sorttools::format_string_english (\$metavalue); 39 41 } 40 42 if (defined $self->{'list'}->{$doc_OID}) { … … 201 203 } 202 204 203 # format an english name for sorting204 # i.e. convert to lowercase, put surname before205 # first names etc.206 sub format_string_name_english {207 my $self = shift (@_);208 my ($stringref) = @_;209 210 $$stringref =~ tr/A-Z/a-z/;211 $$stringref =~ s/[^a-z0-9 ]//g;212 $$stringref =~ s/\s+/ /g;213 $$stringref =~ s/^\s+//;214 my @names = split / /, $$stringref;215 my $surname = pop @names;216 while (scalar @names && $surname =~ /^(jnr|snr)$/i) {217 $surname = pop @names;218 }219 $$stringref = $surname . " " . $$stringref;220 }221 222 # format an english string for sorting223 # i.e. convert to lowercase, remove the, a or an224 # from beginning of string etc.225 sub format_string_english {226 my $self = shift (@_);227 my ($stringref) = @_;228 229 $$stringref =~ tr/A-Z/a-z/;230 $$stringref =~ s/[^a-z0-9 ]//g;231 $$stringref =~ s/^\s*(the|a|an)\b//;232 $$stringref =~ s/^\s+//;233 }234 235 205 1; -
trunk/gsdl/perllib/classify/List.pm
r316 r385 10 10 11 11 package List; 12 13 use sorttools; 12 14 13 15 sub new { … … 46 48 if (defined $metavalue) { 47 49 if ($self->{'metaname'} eq 'Creator') { 48 $self->format_string_name_english (\$metavalue);50 &sorttools::format_string_name_english (\$metavalue); 49 51 } else { 50 $self->format_string_english (\$metavalue);52 &sorttools::format_string_english (\$metavalue); 51 53 } 52 54 if (defined $self->{'list'}->{$doc_OID}) { … … 88 90 89 91 90 # format an english name for sorting91 # i.e. convert to lowercase, put surname before92 # first names etc.93 sub format_string_name_english {94 my $self = shift (@_);95 my ($stringref) = @_;96 97 $$stringref =~ tr/A-Z/a-z/;98 $$stringref =~ s/[^a-z0-9 ]//g;99 $$stringref =~ s/\s+/ /g;100 $$stringref =~ s/^\s+//;101 my @names = split / /, $$stringref;102 my $surname = pop @names;103 while (scalar @names && $surname =~ /^(jnr|snr)$/i) {104 $surname = pop @names;105 }106 $$stringref = $surname . " " . $$stringref;107 }108 109 # format an english string for sorting110 # i.e. convert to lowercase, remove the, a or an111 # from beginning of string etc.112 sub format_string_english {113 my $self = shift (@_);114 my ($stringref) = @_;115 116 $$stringref =~ tr/A-Z/a-z/;117 $$stringref =~ s/[^a-z0-9 ]//g;118 $$stringref =~ s/^\s*(the|a|an)\b//;119 $$stringref =~ s/^\s+//;120 }121 122 123 92 1;
Note:
See TracChangeset
for help on using the changeset viewer.