git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d00ffd3
)
browser: import caniuse jsonp data
author
Mischa POSLAWSKY
<perl@shiar.org>
Thu, 9 Dec 2010 21:19:45 +0000
(22:19 +0100)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Wed, 15 Dec 2010 21:40:44 +0000
(22:40 +0100)
Support the new API which actually returns valid JSON.
tools/convert-caniuse.pl
patch
|
blob
|
history
diff --git
a/tools/convert-caniuse.pl
b/tools/convert-caniuse.pl
index 467b9ba7b5405cdfc37304638332ea1960c89260..f013baf17ee0de04768e49854e00d40399bd7f19 100755
(executable)
--- 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/js
onp.php
|
tools/convert-caniuse.pl > browser-support.inc.pl