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 * This generates the reference documentation for the core libraries that come | 6 * This generates the reference documentation for the core libraries that come |
7 * with dart. It is built on top of dartdoc, which is a general-purpose library | 7 * with dart. It is built on top of dartdoc, which is a general-purpose library |
8 * for generating docs from any Dart code. This library extends that to include | 8 * for generating docs from any Dart code. This library extends that to include |
9 * additional information and styling specific to our standard library. | 9 * additional information and styling specific to our standard library. |
10 * | 10 * |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 }); | 148 }); |
149 }); | 149 }); |
150 }; | 150 }; |
151 } | 151 } |
152 | 152 |
153 class Apidoc extends doc.Dartdoc { | 153 class Apidoc extends doc.Dartdoc { |
154 /** Big ball of JSON containing the scraped MDN documentation. */ | 154 /** Big ball of JSON containing the scraped MDN documentation. */ |
155 final Map mdn; | 155 final Map mdn; |
156 | 156 |
157 | 157 |
158 static const disqusShortname = 'dartapidocs'; | |
159 | |
160 // A set of type names (TypeMirror.simpleName values) to ignore while | 158 // A set of type names (TypeMirror.simpleName values) to ignore while |
161 // looking up information from MDN data. TODO(eub, jacobr): fix up the MDN | 159 // looking up information from MDN data. TODO(eub, jacobr): fix up the MDN |
162 // import scripts so they run correctly and generate data that doesn't have | 160 // import scripts so they run correctly and generate data that doesn't have |
163 // any entries that need to be ignored. | 161 // any entries that need to be ignored. |
164 static Set<String> _mdnTypeNamesToSkip = null; | 162 static Set<String> _mdnTypeNamesToSkip = null; |
165 | 163 |
166 /** | 164 /** |
167 * The URL to the page on MDN that content was pulled from for the current | 165 * The URL to the page on MDN that content was pulled from for the current |
168 * type being documented. Will be `null` if the type doesn't use any MDN | 166 * type being documented. Will be `null` if the type doesn't use any MDN |
169 * content. | 167 * content. |
(...skipping 23 matching lines...) Expand all Loading... |
193 final bsd = 'http://code.google.com/google_bsd_license.html'; | 191 final bsd = 'http://code.google.com/google_bsd_license.html'; |
194 final tos = 'http://www.dartlang.org/tos.html'; | 192 final tos = 'http://www.dartlang.org/tos.html'; |
195 final privacy = 'http://www.google.com/intl/en/privacy/privacy-policy.html'; | 193 final privacy = 'http://www.google.com/intl/en/privacy/privacy-policy.html'; |
196 | 194 |
197 footerText = | 195 footerText = |
198 ''' | 196 ''' |
199 <p>Except as otherwise <a href="$note">noted</a>, the content of this | 197 <p>Except as otherwise <a href="$note">noted</a>, the content of this |
200 page is licensed under the <a href="$cca">Creative Commons Attribution | 198 page is licensed under the <a href="$cca">Creative Commons Attribution |
201 3.0 License</a>, and code samples are licensed under the | 199 3.0 License</a>, and code samples are licensed under the |
202 <a href="$bsd">BSD License</a>.</p> | 200 <a href="$bsd">BSD License</a>.</p> |
203 <p> | |
204 Comments that are not specifically about the API libraries will | |
205 be moderated and possibly deleted. | |
206 Because we may incorporate information from comments into the | |
207 documentation, any comment submitted here is under the same | |
208 license as the documentation. | |
209 </p> | |
210 <p><a href="$tos">Terms of Service</a> | | 201 <p><a href="$tos">Terms of Service</a> | |
211 <a href="$privacy">Privacy Policy</a></p> | 202 <a href="$privacy">Privacy Policy</a></p> |
212 '''; | 203 '''; |
213 | 204 |
214 preFooterText = | |
215 ''' | |
216 <div id="comments"> | |
217 <div id="disqus_thread"></div> | |
218 <script type="text/javascript"> | |
219 /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAG
E * * */ | |
220 var disqus_shortname = "$disqusShortname"; // required: replace exam
ple with your forum shortname | |
221 | |
222 /* * * DON\'T EDIT BELOW THIS LINE * * */ | |
223 (function() { | |
224 var dsq = document.createElement("script"); dsq.type = "text/jav
ascript"; dsq.async = true; | |
225 dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js"; | |
226 (document.getElementsByTagName("head")[0] || document.getElement
sByTagName("body")[0]).appendChild(dsq); | |
227 })(); | |
228 </script> | |
229 <noscript>Please enable JavaScript to view the <a href="http://disqus.co
m/?ref_noscript">comments powered by Disqus.</a></noscript> | |
230 </div> <!-- #comments --> | |
231 '''; | |
232 | |
233 searchEngineId = '011220921317074318178:i4mscbaxtru'; | 205 searchEngineId = '011220921317074318178:i4mscbaxtru'; |
234 searchResultsUrl = 'http://www.dartlang.org/search.html'; | 206 searchResultsUrl = 'http://www.dartlang.org/search.html'; |
235 } | 207 } |
236 | 208 |
237 void writeHeadContents(String title) { | 209 void writeHeadContents(String title) { |
238 super.writeHeadContents(title); | 210 super.writeHeadContents(title); |
239 | 211 |
240 // Include the apidoc-specific CSS. | 212 // Include the apidoc-specific CSS. |
241 // TODO(rnystrom): Use our CSS pre-processor to combine these. | 213 // TODO(rnystrom): Use our CSS pre-processor to combine these. |
242 writeln( | 214 writeln( |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 return ''' | 455 return ''' |
484 <div class="mdn"> | 456 <div class="mdn"> |
485 $mdnComment | 457 $mdnComment |
486 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> | 458 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> |
487 </div> | 459 </div> |
488 '''; | 460 '''; |
489 } | 461 } |
490 | 462 |
491 String toString() => mdnComment; | 463 String toString() => mdnComment; |
492 } | 464 } |
OLD | NEW |