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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months 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
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 taking a JSON file and putting the comments located within into 6 * Library for taking a JSON file and putting the comments located within into
7 * the HTML files the comments are associated with. 7 * the HTML files the comments are associated with.
8 * 8 *
9 * The format of the JSON file is: 9 * The format of the JSON file is:
10 * 10 *
11 * { 11 * {
12 * "$filename": 12 * "$filename":
13 * { 13 * {
14 * "$lineInHtml": 14 * "$lineInHtml":
15 * [ 15 * [
16 * "lines of comment", 16 * "lines of comment",
17 * "here" 17 * "here"
18 * ] 18 * ]
19 * }, 19 * },
20 * ... 20 * ...
21 * } 21 * }
22 */ 22 */
23 library json_to_html; 23 library json_to_html;
24 24
25 import 'dart:json'; 25 import 'dart:json' as JSON;
26 import 'dart:io'; 26 import 'dart:io';
27 27 import 'dart:async';
28 28
29 /// True if any errors were triggered through the conversion. 29 /// True if any errors were triggered through the conversion.
30 bool _anyErrors = false; 30 bool _anyErrors = false;
31 31
32 32
33 /** 33 /**
34 * Take comments from [jsonPath] and apply them to all the files found in 34 * Take comments from [jsonPath] and apply them to all the files found in
35 * [htmlPath]. This will overwrite the files in htmlPath. 35 * [htmlPath]. This will overwrite the files in htmlPath.
36 */ 36 */
37 Future<bool> convert(Path htmlPath, Path jsonPath) { 37 Future<bool> convert(Path htmlPath, Path jsonPath) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } else { 132 } else {
133 unusedComments.putIfAbsent(key, () => comments); 133 unusedComments.putIfAbsent(key, () => comments);
134 } 134 }
135 }); 135 });
136 136
137 unusedComments.forEach((String key, _) { 137 unusedComments.forEach((String key, _) {
138 print('WARNING: the following key was found in the JSON but not in ' 138 print('WARNING: the following key was found in the JSON but not in '
139 '${new Path(file.fullPathSync()).filename}:\n"$key"'); 139 '${new Path(file.fullPathSync()).filename}:\n"$key"');
140 _anyErrors = true; 140 _anyErrors = true;
141 }); 141 });
142 142
143 // TODO(amouravski): file.writeAsStringSync('${Strings.join(fileLines, '\n')}\ n'); 143 // TODO(amouravski): file.writeAsStringSync('${Strings.join(fileLines, '\n')}\ n');
144 var outputStream = file.openOutputStream(); 144 var outputStream = file.openOutputStream();
145 outputStream.writeString(Strings.join(fileLines, '\n')); 145 outputStream.writeString(Strings.join(fileLines, '\n'));
146 outputStream.writeString('\n'); 146 outputStream.writeString('\n');
147 147
148 outputStream.onNoPendingWrites = () { 148 outputStream.onNoPendingWrites = () {
149 outputStream.close(); 149 outputStream.close();
150 }; 150 };
151 } 151 }
OLDNEW
« no previous file with comments | « tools/dom/templates/immutable_list_mixin.darttemplate ('k') | tools/testing/dart/test_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698