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('dart:json'); | 10 #import('dart:json'); |
(...skipping 12 matching lines...) Expand all Loading... | |
23 | 23 |
24 print('Parsing MDN data...'); | 24 print('Parsing MDN data...'); |
25 final mdn = JSON.parse(files.readAll('mdn/database.json')); | 25 final mdn = JSON.parse(files.readAll('mdn/database.json')); |
26 | 26 |
27 print('Cross-referencing dart:dom and dart:html...'); | 27 print('Cross-referencing dart:dom and dart:html...'); |
28 HtmlDiff.initialize(); | 28 HtmlDiff.initialize(); |
29 _diff = new HtmlDiff(); | 29 _diff = new HtmlDiff(); |
30 _diff.run(); | 30 _diff.run(); |
31 world.reset(); | 31 world.reset(); |
32 | 32 |
33 // TODO(rnystrom): Cram in the the IO libraries. This is hackish right now. | |
34 // We should probably move corelib stuff completely out of dartdoc and have it | |
35 // all here. | |
36 world.getOrAddLibrary('io_libs.dart'); | |
37 | |
33 print('Generating docs...'); | 38 print('Generating docs...'); |
34 final apidoc = new Apidoc(mdn); | 39 final apidoc = new Apidoc(mdn); |
35 apidoc.document('html'); | 40 apidoc.document('html'); |
36 } | 41 } |
37 | 42 |
38 class Apidoc extends doc.Dartdoc { | 43 class Apidoc extends doc.Dartdoc { |
39 /** Big ball of JSON containing the scraped MDN documentation. */ | 44 /** Big ball of JSON containing the scraped MDN documentation. */ |
40 final Map mdn; | 45 final Map mdn; |
41 | 46 |
42 /** | 47 /** |
(...skipping 15 matching lines...) Expand all Loading... | |
58 | 63 |
59 footerText = | 64 footerText = |
60 ''' | 65 ''' |
61 <p>Except as otherwise <a href="$note">noted</a>, the content of this | 66 <p>Except as otherwise <a href="$note">noted</a>, the content of this |
62 page is licensed under the <a href="$cca">Creative Commons Attribution | 67 page is licensed under the <a href="$cca">Creative Commons Attribution |
63 3.0 License</a>, and code samples are licensed under the | 68 3.0 License</a>, and code samples are licensed under the |
64 <a href="$bsd">BSD License</a>.</p> | 69 <a href="$bsd">BSD License</a>.</p> |
65 <p><a href="$tos">Terms of Service</a> | | 70 <p><a href="$tos">Terms of Service</a> | |
66 <a href="$privacy">Privacy Policy</a></p> | 71 <a href="$privacy">Privacy Policy</a></p> |
67 '''; | 72 '''; |
73 | |
74 searchEngineId = '011220921317074318178:i4mscbaxtru'; | |
75 searchResultsUrl = 'http://www.dartlang.org/search.html'; | |
68 } | 76 } |
69 | 77 |
70 void writeHeadContents(String title) { | 78 void writeHeadContents(String title) { |
71 super.writeHeadContents(title); | 79 super.writeHeadContents(title); |
72 | 80 |
73 // Include the apidoc-specific CSS. | 81 // Include the apidoc-specific CSS. |
74 // TODO(rnystrom): Use our CSS pre-processor to combine these. | 82 // TODO(rnystrom): Use our CSS pre-processor to combine these. |
75 writeln( | 83 writeln( |
76 ''' | 84 ''' |
77 <link rel="stylesheet" type="text/css" | 85 <link rel="stylesheet" type="text/css" |
(...skipping 14 matching lines...) Expand all Loading... | |
92 ga.type = "text/javascript"; ga.async = true; | 100 ga.type = "text/javascript"; ga.async = true; |
93 ga.src = ("https:" == document.location.protocol ? | 101 ga.src = ("https:" == document.location.protocol ? |
94 "https://ssl" : "http://www") + ".google-analytics.com/ga.js"; | 102 "https://ssl" : "http://www") + ".google-analytics.com/ga.js"; |
95 var s = document.getElementsByTagName("script")[0]; | 103 var s = document.getElementsByTagName("script")[0]; |
96 s.parentNode.insertBefore(ga, s); | 104 s.parentNode.insertBefore(ga, s); |
97 })(); | 105 })(); |
98 </script> | 106 </script> |
99 '''); | 107 '''); |
100 } | 108 } |
101 | 109 |
110 void docIndexLibrary(Library library) { | |
111 // TODO(rnystrom): Hackish. The IO libraries reference this but we don't | |
112 // want it in the docs. | |
nweiz
2012/01/31 23:35:33
I dunno if this is even that hackish. It makes sen
Bob Nystrom
2012/02/01 00:35:29
Yeah, it's kind of hairy because if stuff in the i
| |
113 if (library.name == 'dart:nativewrappers') return; | |
114 super.docIndexLibrary(library); | |
115 } | |
116 | |
117 void docLibraryNavigationJson(Library library, Map libraries) { | |
118 // TODO(rnystrom): Hackish. The IO libraries reference this but we don't | |
119 // want it in the docs. | |
120 if (library.name == 'dart:nativewrappers') return; | |
121 super.docLibraryNavigationJson(library, libraries); | |
122 } | |
123 | |
124 void docLibrary(Library library) { | |
125 // TODO(rnystrom): Hackish. The IO libraries reference this but we don't | |
126 // want it in the docs. | |
127 if (library.name == 'dart:nativewrappers') return; | |
128 super.docLibrary(library); | |
129 } | |
130 | |
102 String getTypeComment(Type type) { | 131 String getTypeComment(Type type) { |
103 return _mergeDocs( | 132 return _mergeDocs( |
104 includeMdnTypeComment(type), | 133 includeMdnTypeComment(type), |
105 super.getTypeComment(type), | 134 super.getTypeComment(type), |
106 getTypeDoc(type)); | 135 getTypeDoc(type)); |
107 } | 136 } |
108 | 137 |
109 String getMethodComment(MethodMember method) { | 138 String getMethodComment(MethodMember method) { |
110 // TODO(rnystrom): Disabling cross-linking between individual members. | 139 // TODO(rnystrom): Disabling cross-linking between individual members. |
111 // Now that we include MDN content for most members, it doesn't add much | 140 // Now that we include MDN content for most members, it doesn't add much |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 return | 380 return |
352 ''' | 381 ''' |
353 <p class="correspond">This corresponds to $domTypesText in the | 382 <p class="correspond">This corresponds to $domTypesText in the |
354 ${a("dom.html", "dart:dom")} library.</p> | 383 ${a("dom.html", "dart:dom")} library.</p> |
355 '''; | 384 '''; |
356 } | 385 } |
357 | 386 |
358 return ''; | 387 return ''; |
359 } | 388 } |
360 } | 389 } |
OLD | NEW |