add meta data (language, description, keywords)
[sheet.git] / cc.plp
diff --git a/cc.plp b/cc.plp
index afd10edcffb242df0f9e96df96d123957e28ad95..e2d4f991ff4263f27ad533d562450858ebd00f62 100644 (file)
--- a/cc.plp
+++ b/cc.plp
@@ -1,27 +1,16 @@
-<:
-use utf8;
-use strict;
-use warnings;
-use open IO => ':utf8';
-
-our $VERSION = 'v1.0';
-
-$header{content_type} = 'text/html; charset=utf-8';
+<(common.inc.plp)><:
+       our $VERSION = 'v1.0';
 
 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
-<html>
+<html lang="en">
 
 <head>
 <meta http-equiv="content-type" content="<:= $header{content_type} :>">
 <title>country code cheat sheet</title>
-<link rel="stylesheet" type="text/css" media="all" href="/base.css"><:
-       my %styles = map {$_ => $_} qw(dark mono red);
-       our $style = exists $get{style} && $styles{$get{style}} || 'light';
-       printf(qq{\n<link rel="%s" type="text/css" media="all" href="%s" title="%s">},
-               $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css", $_
-       ) for keys %styles;
-:>
+<meta name="description" content="Table of ISO-3166-2 country codes with the names of reserved territories.">
+<meta name="keywords" content="country, code, cc, tld, territory, land, table">
+<:= stylesheet(qw'light dark mono red') :>
 </head>
 
 <body>
@@ -30,14 +19,6 @@ $header{content_type} = 'text/html; charset=utf-8';
 <:
 my $cc = do 'cc.inc.pl';
 
-sub quote {
-       local $_ = shift;
-       s/"/&quot;/g;
-       s/</&lt;/g;
-       s/>/&gt;/g;
-       return $_;
-}
-
 {
        printf '<table class="mcmap">';
        print '<col><colgroup span="26">';
@@ -75,12 +56,12 @@ sub quote {
                                s/North(?:ern)? /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])(\w{2,})/$1./g;  # abbreviate (at consonant)
-                               $_ = quote($_);
+                               s/(\S{4}[b-df-hj-np-tv-xz])((?<!Austr)(?!land)\w{2,})/$1./g;  # abbreviate (at consonant)
+                               $_ = EscapeHTML($_);
                        }
                        $name =~ s/([^,]*), (.*)/$2 $1/;
                        printf "\n".'<td class="%s" title="%s">%s',
-                               $_ ? 'X '.$class : '', quote("$code: $name"), $_;
+                               $_ ? 'X '.$class : '', EscapeHTML("$code: $name"), $_;
                }
                print "\n";
        }