From b0082c4cfc4acc2588912863ea461f1f07237a4c Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 9 Dec 2010 22:19:45 +0100 Subject: [PATCH] browser: import caniuse jsonp data Support the new API which actually returns valid JSON. --- tools/convert-caniuse.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/convert-caniuse.pl b/tools/convert-caniuse.pl index 467b9ba..f013baf 100755 --- a/tools/convert-caniuse.pl +++ b/tools/convert-caniuse.pl @@ -11,6 +11,9 @@ 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; @@ -42,6 +45,6 @@ convert-caniuse - Turn Javascript data into an equivalent Perl structure =head1 SYNOPSIS - curl http://caniuse.com/js/data.js | + curl http://caniuse.com/jsonp.php | tools/convert-caniuse.pl > browser-support.inc.pl -- 2.30.0