browser: include perl data prepared by converter script
[sheet.git] / browser.plp
index 330b443c1e944c6614e4087473dd8b7b6c27621a..16aad08a1a93afb61e6b44df04c947526043ab11 100644 (file)
@@ -9,7 +9,7 @@ Html({
                "caniuse.",
        keywords => [qw'html css browser feature'],
        stylesheet => [qw'light dark circus mono red'],
                "caniuse.",
        keywords => [qw'html css browser feature'],
        stylesheet => [qw'light dark circus mono red'],
-       data => ['caniuse.js'],
+       data => ['browser-support.inc.pl'],
 });
 
 :>
 });
 
 :>
@@ -20,29 +20,7 @@ with <a href="http://stats.wikimedia.org/archive/squid_reports/">Wikimedia</a>
 browser usage statistics.</p>
 
 <:
 browser usage statistics.</p>
 
 <:
-use JSON;
-use File::Slurp 'read_file';
-my $source = read_file('caniuse.js');
-for ($source) { # cleanup
-       # convert seperate variables to hash keys
-       s/\A/{/;
-       s/^caniuse\.(\w+) = /"$1":/gm;
-       s/;$/,/gm;
-       s/,\s*\Z/\n}/;
-       # fractions not supported by barekey
-       s/(?<=[,{]) (\d*\.\d) (?=:')/"$1"/gx;
-       # escapes not supported in singlequote
-       s{'((?:[^\\']+|\\.)*)'}{
-               my $_ = $1;
-               s/"/\\"/g;
-               s/\\'/'/g;
-               qq("$_");
-       }ge;
-}
-my $caniuse = from_json($source, {
-#      allow_singlequote => 1,
-       allow_barekey => 1,
-});
+my $caniuse = do 'browser-support.inc.pl' or die $! || $@;
 
 my %CSTATS = (
        n => 'di-b',
 
 my %CSTATS = (
        n => 'di-b',