From e6fbf79145f16370f1f1d23d78e5e0649b573297 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 1 Feb 2015 10:26:56 +0100 Subject: [PATCH 1/1] countries: only set short name if different --- tools/mkcountries-geonames | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/mkcountries-geonames b/tools/mkcountries-geonames index 91daae7..32883ec 100755 --- a/tools/mkcountries-geonames +++ b/tools/mkcountries-geonames @@ -62,7 +62,8 @@ $cc{io}->[2] = "Chagos Islands"; $cc{um}->[2] = "U.S. isl."; for (values %cc) { - for ($_->[2] //= $_->[0]) { + my $abbr = do { + local $_ = $_->[2] // $_->[0]; s/,.*//; s/(?<=.)\(.*\)\s*//; s/ republic\b//gi; @@ -77,7 +78,9 @@ for (values %cc) { s/New /n./g; s/(\S)(\S+)-/$1-/g; # strip most chars preceding dash s/(\S{4}[b-df-hj-np-tv-xz])((?[2] = $abbr if $abbr ne $_->[0]; # short name if different } say "# automatically generated by $0"; -- 2.30.0