OLD | NEW |
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 * |
11 * /** | 11 * /** |
12 * * Comment here. | 12 * * Comment here. |
13 * */ | 13 * */ |
14 * | 14 * |
15 * Or the triple-slash style: | 15 * Or the triple-slash style: |
16 * | 16 * |
17 * /// Docs go here. | 17 * /// Docs go here. |
18 * /// And here. | 18 * /// And here. |
19 * | 19 * |
20 * Each member that is to be documented should be preceeded by a meta-comment | 20 * Each member that is to be documented should be preceeded by a meta-comment |
21 * containing the string `@docsEditable` such as: | 21 * containing the string `@docsEditable` such as: |
22 * | 22 * |
23 * /// @docsEditable | 23 * /// @docsEditable |
24 */ | 24 */ |
25 library html_to_json; | 25 library html_to_json; |
26 | 26 |
27 import 'dart:json'; | 27 import 'dart:json'; |
28 import 'dart:io'; | 28 import 'dart:io'; |
| 29 import 'dart:async'; |
29 | 30 |
30 | 31 |
31 /// True if any errors were triggered through the conversion. | 32 /// True if any errors were triggered through the conversion. |
32 bool _anyErrors = false; | 33 bool _anyErrors = false; |
33 | 34 |
34 | 35 |
35 /** | 36 /** |
36 * Convert files on [htmlPath] and write JSON to [jsonPath]. | 37 * Convert files on [htmlPath] and write JSON to [jsonPath]. |
37 */ | 38 */ |
38 Future<bool> convert(Path htmlPath, Path jsonPath) { | 39 Future<bool> convert(Path htmlPath, Path jsonPath) { |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 '${prettyPrintJson(json[key], '$indentation ')}'); | 309 '${prettyPrintJson(json[key], '$indentation ')}'); |
309 var recursiveOutput = Strings.join(mapList, ',\n'); | 310 var recursiveOutput = Strings.join(mapList, ',\n'); |
310 output = '$indentation{\n' | 311 output = '$indentation{\n' |
311 '$recursiveOutput' | 312 '$recursiveOutput' |
312 '\n$indentation}'; | 313 '\n$indentation}'; |
313 } else { | 314 } else { |
314 output = '$indentation${JSON.stringify(json)}'; | 315 output = '$indentation${JSON.stringify(json)}'; |
315 } | 316 } |
316 return output; | 317 return output; |
317 } | 318 } |
OLD | NEW |