countries: rename ez title to eurozone
[sheet.git] / tools / mkcaniuse
index d0cb8278c0b7c6b251d720c425ebad626d8d0739..de3d789f5df9dcde5ebba811104f4e15104abf9a 100755 (executable)
@@ -13,35 +13,16 @@ our $VERSION = '1.01';
 local $/;  # slurp
 my $source = readline;
 
-for ($source) { # cleanup
-       s/\A\(// and s/\);?\s*\Z//;  # empty callback
-       next if /^\{/;  # valid json
-
-       # convert seperate variables to hash keys
-       s/\A/{\n/;
-       s/^caniuse\.(\w+) *= */"$1":/gm;
-       s/;$/,/gm;
-       s/,\s*\Z/\n}/;
-       # fractions not supported by barekey
-       s/(?<=[,{\n]) (\d*\.\d) (?=:['"])/"$1"/gx;
-       # escapes not supported in singlequote
-       s{: *\K'((?:[^\\']+|\\.)*)'}{
-               my $_ = $1;
-               s/"/\\"/g;
-               s/\\'/'/g;
-               qq("$_");
-       }ge;
-}
-
-my $data = from_json($source, {
-       allow_singlequote => 1,
-       allow_barekey => 1,
-});
+$JSON::PP::false = 0;
+$JSON::PP::true  = 1;
+
+my $data = from_json($source);
 my $update = eval { stat(${^LAST_FH} // $ARGV)->mtime }
        or warn "Could not determine input time\n";
 $data->{-date} = Time::Piece->new($update)->datetime;
 
-print pp($data);
+say "# automatically generated by $0";
+print '+', pp($data);
 
 __END__