X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/068f457f9a60a17ca141d3b90bd7dee9aa7267bc..bd77795ed44d7b642c66b05e0982bff026fdc68f:/tools/convert-caniuse.pl diff --git a/tools/convert-caniuse.pl b/tools/convert-caniuse.pl index 7006b18..467b9ba 100755 --- a/tools/convert-caniuse.pl +++ b/tools/convert-caniuse.pl @@ -12,14 +12,14 @@ my $source = readline; for ($source) { # cleanup # convert seperate variables to hash keys - s/\A/{/; - s/^caniuse\.(\w+) = /"$1":/gm; + s/\A/{\n/; + s/^caniuse\.(\w+) *= */"$1":/gm; s/;$/,/gm; s/,\s*\Z/\n}/; # fractions not supported by barekey - s/(?<=[,{]) (\d*\.\d) (?=:')/"$1"/gx; + s/(?<=[,{\n]) (\d*\.\d) (?=:['"])/"$1"/gx; # escapes not supported in singlequote - s{'((?:[^\\']+|\\.)*)'}{ + s{: *\K'((?:[^\\']+|\\.)*)'}{ my $_ = $1; s/"/\\"/g; s/\\'/'/g;