summaryrefslogtreecommitdiff
path: root/scripts/acronyms.pl
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-11-24 13:17:07 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-11-24 13:17:07 +0100
commitb295d78bcf305cf222c65fc2cad0c52ae3d42793 (patch)
tree535f60118bf696edf125faf407c9a7a6f086a819 /scripts/acronyms.pl
parentff8d44e45ea6e7dac7a50a676378b2a537aee8e8 (diff)
update stations list, run perltidy on it
Diffstat (limited to 'scripts/acronyms.pl')
-rwxr-xr-xscripts/acronyms.pl20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/acronyms.pl b/scripts/acronyms.pl
index ac4bd68..73cb817 100755
--- a/scripts/acronyms.pl
+++ b/scripts/acronyms.pl
@@ -45,6 +45,20 @@ sub get_stations {
return @stations;
}
+sub normalize {
+ my ($val) = @_;
+
+ $val =~ s{Ä}{Ae}g;
+ $val =~ s{Ö}{Oe}g;
+ $val =~ s{Ü}{Ue}g;
+ $val =~ s{ä}{ae}g;
+ $val =~ s{ö}{oe}g;
+ $val =~ s{ß}{sz}g;
+ $val =~ s{ü}{ue}g;
+
+ return $val;
+}
+
sub get_station {
my ( $name ) = @_;
@@ -67,6 +81,12 @@ sub get_station_by_name {
return ($actual_match);
}
+ $nname = normalize($nname);
+ $actual_match = firstval { $nname eq normalize(lc($_->[1])) } @stations;
+ if ($actual_match) {
+ return $actual_match;
+ }
+
return ( grep { $_->[1] =~ m{$name}i } @stations );
}