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 * |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 var completer = new Completer(); | 75 var completer = new Completer(); |
76 | 76 |
77 List<Future> fileFutures = []; | 77 List<Future> fileFutures = []; |
78 | 78 |
79 // Get a list of all HTML dart files. | 79 // Get a list of all HTML dart files. |
80 // TODO(amouravski): discriminate .dart files. | 80 // TODO(amouravski): discriminate .dart files. |
81 final htmlDir = new Directory.fromPath(htmlPath); | 81 final htmlDir = new Directory.fromPath(htmlPath); |
82 final lister = htmlDir.list(recursive: false); | 82 final lister = htmlDir.list(recursive: false); |
83 | 83 |
84 lister.onFile = (String path) { | 84 lister.onFile = (String path) { |
85 final name = new Path.fromNative(path).filename; | 85 final name = new Path(path).filename; |
86 | 86 |
87 // Ignore private classes. | 87 // Ignore private classes. |
88 if (name.startsWith('_')) return; | 88 if (name.startsWith('_')) return; |
89 | 89 |
90 // Ignore non-dart files. | 90 // Ignore non-dart files. |
91 if (!name.endsWith('.dart')) return; | 91 if (!name.endsWith('.dart')) return; |
92 | 92 |
93 File file = new File(path); | 93 File file = new File(path); |
94 | 94 |
95 // TODO(amouravski): Handle missing file. | 95 // TODO(amouravski): Handle missing file. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 '${prettyPrintJson(json[key], '$indentation ')}'); | 308 '${prettyPrintJson(json[key], '$indentation ')}'); |
309 var recursiveOutput = Strings.join(mapList, ',\n'); | 309 var recursiveOutput = Strings.join(mapList, ',\n'); |
310 output = '$indentation{\n' | 310 output = '$indentation{\n' |
311 '$recursiveOutput' | 311 '$recursiveOutput' |
312 '\n$indentation}'; | 312 '\n$indentation}'; |
313 } else { | 313 } else { |
314 output = '$indentation${JSON.stringify(json)}'; | 314 output = '$indentation${JSON.stringify(json)}'; |
315 } | 315 } |
316 return output; | 316 return output; |
317 } | 317 } |
OLD | NEW |