OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 script to document the HTML library, including annotations on the mapping | 6 * Generates the complete set of corelib reference documentation. |
7 * to and from the DOM library. To use it, from utils/dartdoc, run: | |
8 * | |
9 * $ htmldoc | |
10 * | |
11 * This works just like `dartdoc html`, with the additions of the DOM/HTML | |
12 * mapping documentation. | |
13 */ | 7 */ |
14 #library('html_doc'); | 8 #library('apidoc'); |
15 | 9 |
16 #import('html_diff.dart'); | 10 #import('html_diff.dart'); |
17 #import('../../../frog/lang.dart'); | 11 #import('../../frog/lang.dart'); |
18 #import('../../../frog/file_system_node.dart'); | 12 #import('../../frog/file_system_node.dart'); |
19 #import('../../../frog/file_system.dart'); | 13 #import('../../frog/file_system.dart'); |
20 #import('../../../utils/dartdoc/dartdoc.dart', prefix: 'doc'); | 14 #import('../dartdoc/dartdoc.dart', prefix: 'doc'); |
21 | 15 |
22 HtmlDiff _diff; | 16 HtmlDiff _diff; |
23 | 17 |
24 void main() { | 18 void main() { |
25 var files = new NodeFileSystem(); | 19 var files = new NodeFileSystem(); |
26 parseOptions('../../frog', [] /* args */, files); | 20 parseOptions('../../frog', [] /* args */, files); |
27 initializeWorld(files); | 21 initializeWorld(files); |
28 final htmldoc = new Htmldoc(); | 22 final apidoc = new Apidoc(); |
29 HtmlDiff.initialize(); | 23 HtmlDiff.initialize(); |
30 | 24 |
31 _diff = new HtmlDiff(); | 25 _diff = new HtmlDiff(); |
32 _diff.run(); | 26 _diff.run(); |
33 world.reset(); | 27 world.reset(); |
34 | 28 |
35 htmldoc.document('html'); | 29 apidoc.document('html'); |
36 } | 30 } |
37 | 31 |
38 class Htmldoc extends doc.Dartdoc { | 32 class Apidoc extends doc.Dartdoc { |
39 getTypeComment(Type type) { | 33 getTypeComment(Type type) { |
40 return _mergeComments(super.getTypeComment(type), getTypeDoc(type)); | 34 return _mergeComments(super.getTypeComment(type), getTypeDoc(type)); |
41 } | 35 } |
42 | 36 |
43 getMethodComment(MethodMember method) { | 37 getMethodComment(MethodMember method) { |
44 return _mergeComments(super.getMethodComment(method), getMemberDoc(method)); | 38 return _mergeComments(super.getMethodComment(method), getMemberDoc(method)); |
45 } | 39 } |
46 | 40 |
47 getFieldComment(FieldMember field) { | 41 getFieldComment(FieldMember field) { |
48 return _mergeComments(super.getFieldComment(field), getMemberDoc(field)); | 42 return _mergeComments(super.getFieldComment(field), getMemberDoc(field)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 "library._"; | 124 "library._"; |
131 } else if (_diff.htmlTypesToDom.containsKey(type)) { | 125 } else if (_diff.htmlTypesToDom.containsKey(type)) { |
132 var domTypes = doc.joinWithCommas( | 126 var domTypes = doc.joinWithCommas( |
133 map(_diff.htmlTypesToDom[type], _linkType)); | 127 map(_diff.htmlTypesToDom[type], _linkType)); |
134 return "_This corresponds to $domTypes in the [dart:dom](../dom.html) " + | 128 return "_This corresponds to $domTypes in the [dart:dom](../dom.html) " + |
135 "library._"; | 129 "library._"; |
136 } else { | 130 } else { |
137 return ""; | 131 return ""; |
138 } | 132 } |
139 } | 133 } |
OLD | NEW |