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

Side by Side Diff: tools/dom/docs/lib/docs.dart

Issue 19931008: Fix paths in DOM doc test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
« no previous file with comments | « tools/dom/docs/bin/docs.dart ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 * A library for extracting the documentation from the various HTML libraries 6 * A library for extracting the documentation from the various HTML libraries
7 * ([dart:html], [dart:svg], [dart:web_audio], [dart:indexed_db]) and saving 7 * ([dart:html], [dart:svg], [dart:web_audio], [dart:indexed_db]) and saving
8 * those documentation comments to a JSON file. 8 * those documentation comments to a JSON file.
9 */ 9 */
10 10
11 library docs; 11 library docs;
12 12
13 import '../../../../sdk/lib/_internal/dartdoc/lib/src/dart2js_mirrors.dart'; 13 import '../../../../sdk/lib/_internal/dartdoc/lib/src/dart2js_mirrors.dart';
14 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.da rt'; 14 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.da rt';
15 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_ut il.dart'; 15 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_ut il.dart';
16 import '../../../../sdk/lib/_internal/dartdoc/lib/dartdoc.dart'; 16 import '../../../../sdk/lib/_internal/dartdoc/lib/dartdoc.dart';
17 import '../../../../sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart'; 17 import '../../../../sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart';
18 import '../../../../utils/apidoc/lib/metadata.dart'; 18 import '../../../../utils/apidoc/lib/metadata.dart';
19 import 'dart:async'; 19 import 'dart:async';
20 import 'dart:io'; 20 import 'dart:io';
21 21
22 /// The various HTML libraries. 22 /// The various HTML libraries.
23 const List<String> HTML_LIBRARY_NAMES = const ['dart:html', 23 const List<String> HTML_LIBRARY_NAMES = const ['dart:html',
24 'dart:indexed_db', 24 'dart:indexed_db',
25 'dart:svg', 25 'dart:svg',
26 'dart:web_audio', 26 'dart:web_audio',
27 'dart:web_sql']; 27 'dart:web_sql'];
28 /** 28 /**
29 * Converts the libraries in [HTML_LIBRARY_NAMES] to a json file at [jsonPath] 29 * Converts the libraries in [HTML_LIBRARY_NAMES] to a json file at [jsonPath]
30 * given the library path at [libPath]. 30 * given the library path at [libUri].
31 * 31 *
32 * The json output looks like: 32 * The json output looks like:
33 * { 33 * {
34 * $library_name: { 34 * $library_name: {
35 * $interface_name: { 35 * $interface_name: {
36 * comment: "$comment" 36 * comment: "$comment"
37 * members: { 37 * members: {
38 * $member: [ 38 * $member: [
39 * [$comment1line1, 39 * [$comment1line1,
40 * $comment1line2, 40 * $comment1line2,
41 * ...], 41 * ...],
42 * ... 42 * ...
43 * ], 43 * ],
44 * ... 44 * ...
45 * } 45 * }
46 * }, 46 * },
47 * ... 47 * ...
48 * }, 48 * },
49 * ... 49 * ...
50 * } 50 * }
51 * 51 *
52 * Completes to `true` if any errors were encountered, `false` otherwise. 52 * Completes to `true` if any errors were encountered, `false` otherwise.
53 */ 53 */
54 Future<bool> convert(String libPath, String jsonPath) { 54 Future<bool> convert(String libUri, String jsonPath) {
55 var paths = <String>[]; 55 var paths = <String>[];
56 for (var libraryName in HTML_LIBRARY_NAMES) { 56 for (var libraryName in HTML_LIBRARY_NAMES) {
57 paths.add(libraryName); 57 paths.add(libraryName);
58 } 58 }
59 59
60 return analyze(paths, libPath, options: ['--preserve-comments']) 60 return analyze(paths, libUri, options: ['--preserve-comments'])
61 .then((MirrorSystem mirrors) { 61 .then((MirrorSystem mirrors) {
62 var convertedJson = _generateJsonFromLibraries(mirrors); 62 var convertedJson = _generateJsonFromLibraries(mirrors);
63 return _exportJsonToFile(convertedJson, jsonPath); 63 return _exportJsonToFile(convertedJson, jsonPath);
64 }); 64 });
65 } 65 }
66 66
67 Future<bool> _exportJsonToFile(Map convertedJson, String jsonPath) { 67 Future<bool> _exportJsonToFile(Map convertedJson, String jsonPath) {
68 return new Future.sync(() { 68 return new Future.sync(() {
69 final jsonFile = new File(jsonPath); 69 final jsonFile = new File(jsonPath);
70 var writeJson = prettySerialize(convertedJson); 70 var writeJson = prettySerialize(convertedJson);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 for (var s in tags.reflectee.split(',')) { 185 for (var s in tags.reflectee.split(',')) {
186 domNames.add(s.trim()); 186 domNames.add(s.trim());
187 } 187 }
188 188
189 if (domNames.length == 1 && domNames[0] == 'none') return <String>[]; 189 if (domNames.length == 1 && domNames[0] == 'none') return <String>[];
190 return domNames; 190 return domNames;
191 } else { 191 } else {
192 return <String>[]; 192 return <String>[];
193 } 193 }
194 } 194 }
OLDNEW
« no previous file with comments | « tools/dom/docs/bin/docs.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698