Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: tools/html_json_doc/lib/html_to_json.dart

Issue 11446053: Alphabetize json output. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Put thing back. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/docs/html_docs.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Library for extracting the documentation comments from files generated by 6 * Library for extracting the documentation comments from files generated by
7 * the HTML library. The comments are stored in a JSON file. 7 * the HTML library. The comments are stored in a JSON file.
8 * 8 *
9 * Comments must be in either the block style with leading *s: 9 * Comments must be in either the block style with leading *s:
10 * 10 *
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 var output; 292 var output;
293 293
294 if (json is List) { 294 if (json is List) {
295 var recursiveOutput = 295 var recursiveOutput =
296 Strings.join(json.map((e) => 296 Strings.join(json.map((e) =>
297 prettyPrintJson(e, '$indentation ')), ',\n'); 297 prettyPrintJson(e, '$indentation ')), ',\n');
298 output = '$indentation[\n' 298 output = '$indentation[\n'
299 '$recursiveOutput' 299 '$recursiveOutput'
300 '\n$indentation]'; 300 '\n$indentation]';
301 } else if (json is Map) { 301 } else if (json is Map) {
302 var keys = json.keys
303 ..sort();
304
302 // TODO(amouravski): No newline after : 305 // TODO(amouravski): No newline after :
303 var mapList = json.keys.map((key) => 306 var mapList = keys.map((key) =>
304 '$indentation${JSON.stringify(key)}:\n' 307 '$indentation${JSON.stringify(key)}:\n'
305 '${prettyPrintJson(json[key], '$indentation ')}'); 308 '${prettyPrintJson(json[key], '$indentation ')}');
306 var recursiveOutput = Strings.join(mapList, ',\n'); 309 var recursiveOutput = Strings.join(mapList, ',\n');
307 output = '$indentation{\n' 310 output = '$indentation{\n'
308 '$recursiveOutput' 311 '$recursiveOutput'
309 '\n$indentation}'; 312 '\n$indentation}';
310 } else { 313 } else {
311 output = '$indentation${JSON.stringify(json)}'; 314 output = '$indentation${JSON.stringify(json)}';
312 } 315 }
313 return output; 316 return output;
314 } 317 }
OLDNEW
« no previous file with comments | « sdk/lib/html/docs/html_docs.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698