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 * Generates the complete set of corelib reference documentation. | 6 * Generates the complete set of corelib reference documentation. |
7 */ | 7 */ |
8 #library('apidoc'); | 8 #library('apidoc'); |
9 | 9 |
10 #import('html_diff.dart'); | 10 #import('html_diff.dart'); |
11 #import('../../frog/lang.dart'); | 11 #import('../../frog/lang.dart'); |
12 #import('../../frog/file_system_node.dart'); | 12 #import('../../frog/file_system_node.dart'); |
13 #import('../../frog/file_system.dart'); | 13 #import('../../frog/file_system.dart'); |
14 #import('../dartdoc/dartdoc.dart', prefix: 'doc'); | 14 #import('../dartdoc/dartdoc.dart', prefix: 'doc'); |
15 | 15 |
16 HtmlDiff _diff; | 16 HtmlDiff _diff; |
17 | 17 |
18 void main() { | 18 void main() { |
19 var files = new NodeFileSystem(); | 19 var files = new NodeFileSystem(); |
20 parseOptions('../../frog', [] /* args */, files); | 20 parseOptions('../../frog', [] /* args */, files); |
21 initializeWorld(files); | 21 initializeWorld(files); |
22 final apidoc = new Apidoc(); | 22 final apidoc = new Apidoc(); |
23 apidoc.mainTitle = 'Dart API Reference'; | |
24 | 23 |
25 HtmlDiff.initialize(); | 24 HtmlDiff.initialize(); |
26 | 25 |
27 _diff = new HtmlDiff(); | 26 _diff = new HtmlDiff(); |
28 _diff.run(); | 27 _diff.run(); |
29 world.reset(); | 28 world.reset(); |
30 | 29 |
31 apidoc.document('html'); | 30 apidoc.document('html'); |
32 } | 31 } |
33 | 32 |
34 class Apidoc extends doc.Dartdoc { | 33 class Apidoc extends doc.Dartdoc { |
| 34 Apidoc() { |
| 35 mainTitle = 'Dart API Reference'; |
| 36 mainUrl = 'http://dartlang.org'; |
| 37 |
| 38 final note = 'http://code.google.com/policies.html#restrictions'; |
| 39 final cca = 'http://creativecommons.org/licenses/by/3.0/'; |
| 40 final bsd = 'http://code.google.com/google_bsd_license.html'; |
| 41 final tos = 'http://www.dartlang.org/tos.html'; |
| 42 final privacy = 'http://www.google.com/intl/en/privacy/privacy-policy.html'; |
| 43 |
| 44 footerText = |
| 45 ''' |
| 46 <p>Except as otherwise <a href="$note">noted</a>, the content of this |
| 47 page is licensed under the <a href="$cca">Creative Commons Attribution |
| 48 3.0 License</a>, and code samples are licensed under the |
| 49 <a href="$bsd">BSD License</a>.</p> |
| 50 <p><a href="$tos">Terms of Service</a> | |
| 51 <a href="$privacy">Privacy Policy</a></p> |
| 52 '''; |
| 53 } |
| 54 |
| 55 void writeHeadContents(String title) { |
| 56 super.writeHeadContents(title); |
| 57 |
| 58 // Add the analytics code. |
| 59 doc.writeln( |
| 60 ''' |
| 61 <script type="text/javascript"> |
| 62 var _gaq = _gaq || []; |
| 63 _gaq.push(['_setAccount', 'UA-26406144-4']); |
| 64 _gaq.push(['_setDomainName', 'dartlang.org']); |
| 65 _gaq.push(['_trackPageview']); |
| 66 |
| 67 (function() { |
| 68 var ga = document.createElement('script'); ga.type = 'text/javascrip
t'; ga.async = true; |
| 69 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : '
http://www') + '.google-analytics.com/ga.js'; |
| 70 var s = document.getElementsByTagName('script')[0]; s.parentNode.ins
ertBefore(ga, s); |
| 71 })(); |
| 72 </script> |
| 73 '''); |
| 74 } |
| 75 |
35 getTypeComment(Type type) { | 76 getTypeComment(Type type) { |
36 return _mergeComments(super.getTypeComment(type), getTypeDoc(type)); | 77 return _mergeComments(super.getTypeComment(type), getTypeDoc(type)); |
37 } | 78 } |
38 | 79 |
39 getMethodComment(MethodMember method) { | 80 getMethodComment(MethodMember method) { |
40 return _mergeComments(super.getMethodComment(method), getMemberDoc(method)); | 81 return _mergeComments(super.getMethodComment(method), getMemberDoc(method)); |
41 } | 82 } |
42 | 83 |
43 getFieldComment(FieldMember field) { | 84 getFieldComment(FieldMember field) { |
44 return _mergeComments(super.getFieldComment(field), getMemberDoc(field)); | 85 return _mergeComments(super.getFieldComment(field), getMemberDoc(field)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 "library._"; | 167 "library._"; |
127 } else if (_diff.htmlTypesToDom.containsKey(type)) { | 168 } else if (_diff.htmlTypesToDom.containsKey(type)) { |
128 var domTypes = doc.joinWithCommas( | 169 var domTypes = doc.joinWithCommas( |
129 map(_diff.htmlTypesToDom[type], _linkType)); | 170 map(_diff.htmlTypesToDom[type], _linkType)); |
130 return "_This corresponds to $domTypes in the [dart:dom](../dom.html) " + | 171 return "_This corresponds to $domTypes in the [dart:dom](../dom.html) " + |
131 "library._"; | 172 "library._"; |
132 } else { | 173 } else { |
133 return ""; | 174 return ""; |
134 } | 175 } |
135 } | 176 } |
OLD | NEW |