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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 doc.DocComment getMemberComment(MemberMirror member) { | 406 doc.DocComment getMemberComment(MemberMirror member) { |
407 return _mergeDocs( | 407 return _mergeDocs( |
408 includeMdnMemberComment(member), super.getMemberComment(member), | 408 includeMdnMemberComment(member), super.getMemberComment(member), |
409 htmldoc.getRecordedMemberComment(member)); | 409 htmldoc.getRecordedMemberComment(member)); |
410 } | 410 } |
411 | 411 |
412 doc.DocComment _mergeDocs(MdnComment mdnComment, | 412 doc.DocComment _mergeDocs(MdnComment mdnComment, |
413 doc.DocComment fileComment, | 413 doc.DocComment fileComment, |
414 doc.DocComment handWrittenComment) { | 414 doc.DocComment handWrittenComment) { |
415 // Prefer the hand-written comment first. | 415 // Prefer the hand-written comment first. |
416 if (handWrittenComment !== null) return handWrittenComment; | 416 if (handWrittenComment != null) return handWrittenComment; |
417 | 417 |
418 // Otherwise, prefer comment from the (possibly generated) Dart file. | 418 // Otherwise, prefer comment from the (possibly generated) Dart file. |
419 if (fileComment !== null) return fileComment; | 419 if (fileComment != null) return fileComment; |
420 | 420 |
421 // Finally, fallback on MDN if available. | 421 // Finally, fallback on MDN if available. |
422 if (mdnComment !== null) { | 422 if (mdnComment != null) { |
423 mdnUrl = mdnComment.mdnUrl; | 423 mdnUrl = mdnComment.mdnUrl; |
424 return mdnComment; | 424 return mdnComment; |
425 } | 425 } |
426 | 426 |
427 // We got nothing! | 427 // We got nothing! |
428 return null; | 428 return null; |
429 } | 429 } |
430 | 430 |
431 void docType(TypeMirror type) { | 431 void docType(TypeMirror type) { |
432 // Track whether we've inserted MDN content into this page. | 432 // Track whether we've inserted MDN content into this page. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 return ''' | 580 return ''' |
581 <div class="mdn"> | 581 <div class="mdn"> |
582 $mdnComment | 582 $mdnComment |
583 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> | 583 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> |
584 </div> | 584 </div> |
585 '''; | 585 '''; |
586 } | 586 } |
587 | 587 |
588 String toString() => mdnComment; | 588 String toString() => mdnComment; |
589 } | 589 } |
OLD | NEW |