git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e7c68cd
)
countries: only set short name if different
author
Mischa POSLAWSKY
<perl@shiar.org>
Sun, 1 Feb 2015 09:26:56 +0000
(10:26 +0100)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Sun, 1 Feb 2015 17:34:57 +0000
(18:34 +0100)
tools/mkcountries-geonames
patch
|
blob
|
history
diff --git
a/tools/mkcountries-geonames
b/tools/mkcountries-geonames
index 91daae753722d030e40af9340c1d6221f59377c0..32883ec9511694ad739e7180c2b3a27843a1df01 100755
(executable)
--- 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) {
$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;
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])((?<!Austr)(?!land)\w{2,})/$1./g; # abbreviate (at consonant)
s/New /n./g;
s/(\S)(\S+)-/$1-/g; # strip most chars preceding dash
s/(\S{4}[b-df-hj-np-tv-xz])((?<!Austr)(?!land)\w{2,})/$1./g; # abbreviate (at consonant)
- }
+ $_;
+ };
+ $_->[2] = $abbr if $abbr ne $_->[0]; # short name if different
}
say "# automatically generated by $0";
}
say "# automatically generated by $0";