Make the script generate formatted json file

Otherwise changes are almost impossible to review.
This commit is contained in:
Niklas Laxström
2016-05-26 15:18:28 +02:00
parent f5eb37ba73
commit 0927f4be0e
2 changed files with 5561 additions and 2 deletions

5556
data/generated-langdb.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -70,17 +70,20 @@ foreach ( $supplementalData->territoryInfo->territory as $territoryRecord ) {
} }
print "Writing JSON langdb...\n"; print "Writing JSON langdb...\n";
$json = json_encode( $parsedLangdb, JSON_UNESCAPED_UNICODE ); $jsonVerbose = json_encode( $parsedLangdb, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE );
$jsonSlim = json_encode( $parsedLangdb, JSON_UNESCAPED_UNICODE );
$js = <<<JAVASCRIPT $js = <<<JAVASCRIPT
// Please do not edit. This file is generated from data/langdb.yaml by ulsdata2json.php // Please do not edit. This file is generated from data/langdb.yaml by ulsdata2json.php
( function ( $ ) { ( function ( $ ) {
'use strict'; 'use strict';
$.uls = $.uls || {}; $.uls = $.uls || {};
//noinspection JSHint //noinspection JSHint
$.uls.data = $json; $.uls.data = $jsonSlim;
} ( jQuery ) ); } ( jQuery ) );
JAVASCRIPT; JAVASCRIPT;
file_put_contents( '../src/jquery.uls.data.js', $js ); file_put_contents( '../src/jquery.uls.data.js', $js );
// For making diff review easier.
file_put_contents( 'generated-langdb.json', $jsonVerbose );
print "Done.\n"; print "Done.\n";