From: Mischa POSLAWSKY Date: Tue, 13 Oct 2009 00:32:40 +0000 (+0000) Subject: cc: names by default X-Git-Tag: v1.3~119 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/0ec1918e9ea19466404dd204c30dea88af25bea7 cc: names by default Abbreviated country names make for a better sheet. Flag images have to be requested manually by getting ?show. Makes most glyph styling apply to any table, including this one. Enlarged text and uniform width remains .glyphs-specific, but colouring and borders should be good to enforce for all (future) tables. --- diff --git a/base.css b/base.css index 50e12f2..a488e97 100644 --- a/base.css +++ b/base.css @@ -152,25 +152,30 @@ ul.keys.ctrl li b small { /* meta key indicator */ font-weight: normal; /* nice and subtle */ } -/* character table */ +/* tables */ li table { float: left; position: relative; /* prevents buggy hovering if table-caption present in gecko */ } -table.glyphs { +table { border-collapse: collapse; } -.glyphs thead th, .glyphs td { - text-align: center; - width: 1.6em; /* regular interval */ -} -.glyphs th, .glyphs td { +th, td { border-color: #778; border: 1px solid #888; background: #DDD; } +thead th, td { + text-align: center; +} + +/* character table */ + +.glyphs thead th, .glyphs td { + width: 1.6em; /* regular interval */ +} .glyphs tbody td { font-size: 112%; } @@ -186,22 +191,22 @@ table.glyphs { /* table headers */ -.glyphs th, -.glyphs thead td { +th, +thead td { border: 0; background: transparent !important; } .glyphs thead td { width: auto; /* no glyph cells in header */ } -.glyphs th { +th { padding: 0 0.2em; } -.diinfo .glyphs th { +.diinfo th { font-size: 50%; /* mostly insignificant here */ font-weight: normal; } -.diinfo .glyphs tbody th { +.diinfo tbody th { text-align: right; /* variable width so keep near cells */ padding: 0 0.5em; } diff --git a/cc.inc.pl b/cc.inc.pl index 786655a..8be81c9 100644 --- a/cc.inc.pl +++ b/cc.inc.pl @@ -1,6 +1,6 @@ # perl -MDBIx::Simple -MData::Dump=pp -e 'pp({DBIx::Simple->new("dbi:SQLite:dbname=locale.db")->query("SELECT country.code_alpha2, country.name, continent.name FROM country LEFT JOIN continent ON country.code_alpha2 = continent.country_code ORDER BY country.code_alpha2")->map_arrays(0)})' { -ac => ["Ascension (dependency of Saint Helena)", 'c-oc Xr', 'sh'], +ac => ["Ascension (dependency of Saint Helena)", 'c-oc Xr', undef, 'sh'], ad => ["Andorra", 'c-eu'], ae => ["United Arab Emirates", 'c-as'], af => ["Afghanistan", 'c-as'], @@ -48,7 +48,7 @@ cl => ["Chile", 'c-sa'], cm => ["Cameroon", 'c-af'], cn => ["China", 'c-as'], co => ["Colombia", 'c-sa'], -cp => ["Clipperton (French possession)", 'c-na Xr', 'fr'], +cp => ["Clipperton (French possession)", 'c-na Xr', undef, 'fr'], cr => ["Costa Rica", 'c-na'], cu => ["Cuba", 'c-na'], cv => ["Cape Verde", 'c-af'], @@ -58,11 +58,11 @@ cz => ["Czech Republic", 'c-eu'], de => ["Germany", 'c-eu'], dj => ["Djibouti", 'c-af'], dk => ["Denmark", 'c-eu'], -dg => ["Diego Garcia (British Territory)", 'c-as Xr', 'io'], +dg => ["Diego Garcia (British Territory)", 'c-as Xr', undef, 'io'], dm => ["Dominica", 'c-na'], do => ["Dominican Republic", 'c-na'], dz => ["Algeria", 'c-af'], -ea => ["Ceuta and Melilla (Spanish cities outside EU territory)", 'c-af Xr', 'es'], +ea => ["Ceuta and Melilla (Spanish cities outside EU territory)", 'c-af Xr', undef, 'es'], ec => ["Ecuador", 'c-sa'], ee => ["Estonia", 'c-eu'], eg => ["Egypt", 'c-af'], @@ -77,7 +77,7 @@ fk => ["Falkland Islands (Malvinas)", 'c-sa'], fm => ["Micronesia, Federated States of", 'c-oc'], fo => ["Faroe Islands", 'c-oc'], fr => ["France", 'c-eu'], -fx => ["Metropolitan France", 'c-eu Xr', 'fr'], +fx => ["Metropolitan France", 'c-eu Xr', undef, 'fr'], ga => ["Gabon", 'c-af'], gb => ["United Kingdom", 'c-eu'], gd => ["Grenada", 'c-na'], @@ -107,7 +107,7 @@ id => ["Indonesia", 'c-as'], ie => ["Ireland", 'c-eu'], il => ["Israel", 'c-as'], in => ["India", 'c-as'], -io => ["British Indian Ocean Territory", 'c-oc'], +io => ["British Indian Ocean Territory", 'c-oc', 'Chagos'], iq => ["Iraq", 'c-as'], ir => ["Iran, Islamic Republic of", 'c-as'], is => ["Iceland", 'c-eu'], @@ -121,12 +121,12 @@ kh => ["Cambodia", 'c-as'], ki => ["Kiribati", 'c-oc'], km => ["Comoros", 'c-af'], kn => ["Saint Kitts and Nevis", 'c-na'], -kp => ["Korea, Democratic People's Republic of", 'c-as'], -kr => ["Korea, Republic of", 'c-as'], +kp => ["Korea, Democratic People's Republic of", 'c-as', "North Korea"], +kr => ["Korea, Republic of", 'c-as', "South Korea"], kw => ["Kuwait", 'c-as'], ky => ["Cayman Islands", 'c-oc'], kz => ["Kazakhstan", 'c-as'], -la => ["Lao People's Democratic Republic", 'c-as'], +la => ["Lao People's Democratic Republic", 'c-as', "Lao"], lb => ["Lebanon", 'c-as'], lc => ["Saint Lucia", 'c-na'], li => ["Liechtenstein", 'c-eu'], @@ -136,11 +136,11 @@ ls => ["Lesotho", 'c-af'], lt => ["Lithuania", 'c-eu'], lu => ["Luxembourg", 'c-eu'], lv => ["Latvia", 'c-eu'], -ly => ["Libyan Arab Jamahiriya", 'c-af'], +ly => ["Libyan Arab Jamahiriya", 'c-af', "Libya"], ma => ["Morocco", 'c-af'], mc => ["Monaco", 'c-eu'], md => ["Moldova, Republic of", 'c-eu'], -me => ["Republic of Montenegro", 'c-eu'], +me => ["Montenegro, Republic of", 'c-eu'], mg => ["Madagascar", 'c-af'], mh => ["Marshall Islands", 'c-oc'], mk => ["Macedonia, the Former Yugoslav Republic of", 'c-eu'], @@ -189,8 +189,8 @@ py => ["Paraguay", 'c-sa'], qa => ["Qatar", 'c-as'], re => ["Reunion", 'c-oc'], ro => ["Romania", 'c-eu'], -rs => ["Republic of Serbia", 'c-eu'], -ru => ["Russian Federation", 'c-eu'], +rs => ["Serbia, Republic of", 'c-eu'], +ru => ["Russian Federation", 'c-eu', "Russia"], rw => ["Rwanda", 'c-af'], sa => ["Saudi Arabia", 'c-as'], sb => ["Solomon Islands", 'c-oc'], @@ -231,16 +231,16 @@ tw => ["Taiwan, Province of China", 'c-as'], tz => ["Tanzania, United Republic of", 'c-af'], ua => ["Ukraine", 'c-eu'], ug => ["Uganda", 'c-af'], -uk => ["(United Kingdom)", 'c-eu Xr', 'gb'], -um => ["United States Minor Outlying Islands", 'c-na'], +uk => ["(United Kingdom)", 'c-eu Xr', undef, 'gb'], +um => ["United States Minor Outlying Islands", 'c-na', 'U.S. isl.'], us => ["United States", 'c-na'], uy => ["Uruguay", 'c-sa'], uz => ["Uzbekistan", 'c-as'], va => ["Holy See (Vatican City State)", 'c-eu'], vc => ["Saint Vincent and the Grenadines", 'c-na'], ve => ["Venezuela", 'c-sa'], -vg => ["Virgin Islands, British", 'c-na'], -vi => ["Virgin Islands, U.S.", 'c-na'], +vg => ["Virgin Islands, British", 'c-na', "British Virgin"], +vi => ["Virgin Islands, U.S.", 'c-na', "U.S. Virgin"], vn => ["Vietnam", 'c-as'], vu => ["Vanuatu", 'c-oc'], wf => ["Wallis and Futuna", 'c-oc'], diff --git a/cc.plp b/cc.plp index 584884d..08a2341 100644 --- a/cc.plp +++ b/cc.plp @@ -33,7 +33,7 @@ sub quote { } { - printf ''; + printf '
'; print ''; for my $section (qw{thead}) { print "<$section>
↱"; @@ -49,11 +49,32 @@ sub quote { print $code =~ /^x|^q[m-z]|^aa|^zz/ ? '' : ''; next; }; - $code = $country->[2] if defined $country->[2]; - my $img = sprintf '%s', $code, $code - if -e "flag/$code.png"; + my ($name, $class, $short, $ref) = @$country; + $ref ||= $code; + local $_ = $ref; + if (exists $get{show}) { + my $img = "flag/$ref.png"; + $_ = sprintf '%s', $img, $ref if -e $img; + } + else { + $_ = $short || $name; + s/,.*//; + s/(?<=.)\(.*\)\s*//; + s/ republic\b//gi; + s/ islands?\b//gi; + s/\bthe //g; + s/ and / & /g; + s/\bsaint /st /gi; + s/South /S-/g; + s/North /N-/g; + s/New /n./g; + s/(\S)(\S+)-/$1-/g; # strip most chars preceding dash + s/(\S{4}[b-df-hj-np-tv-xz])(\S{2,})/$1./g; # abbreviate (at consonant) + $_ = quote($_); + } + $name =~ s/([^,]*), (.*)/$2 $1/; printf "\n".'%s', - $img ? 'X '.$country->[1] : '', quote($country->[0]), $img; + $_ ? 'X '.$class : '', quote("$code: $name"), $_; } print "\n"; } diff --git a/dark.css b/dark.css index b33e7da..732a563 100644 --- a/dark.css +++ b/dark.css @@ -49,7 +49,7 @@ dl.legend-options dt {background: #333} /* character properties */ -.glyphs th, .glyphs td { +th, td { border-color: #333; background: #181818; }