| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 373 |
| 374 void docLibrary(LibraryMirror library) { | 374 void docLibrary(LibraryMirror library) { |
| 375 // TODO(rnystrom): Hackish. The IO libraries reference this but we don't | 375 // TODO(rnystrom): Hackish. The IO libraries reference this but we don't |
| 376 // want it in the docs. | 376 // want it in the docs. |
| 377 if (doc.displayName(library) == 'dart:nativewrappers') return; | 377 if (doc.displayName(library) == 'dart:nativewrappers') return; |
| 378 super.docLibrary(library); | 378 super.docLibrary(library); |
| 379 } | 379 } |
| 380 | 380 |
| 381 /** Override definition from parent class to strip out annotation tags. */ | 381 /** Override definition from parent class to strip out annotation tags. */ |
| 382 doc.DocComment createDocComment(String text, | 382 doc.DocComment createDocComment(String text, |
| 383 [InterfaceMirror inheritedFrom]) { | 383 [ClassMirror inheritedFrom]) { |
| 384 String strippedText = | 384 String strippedText = |
| 385 text.replaceAll(const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"), | 385 text.replaceAll(const RegExp("@([a-zA-Z]+) ([^;]+)(?:;|\$)"), |
| 386 '').trim(); | 386 '').trim(); |
| 387 if (strippedText.isEmpty) return null; | 387 if (strippedText.isEmpty) return null; |
| 388 return super.createDocComment(strippedText, inheritedFrom); | 388 return super.createDocComment(strippedText, inheritedFrom); |
| 389 } | 389 } |
| 390 | 390 |
| 391 doc.DocComment getLibraryComment(LibraryMirror library) { | 391 doc.DocComment getLibraryComment(LibraryMirror library) { |
| 392 if (doc.displayName(library) == HTML_LIBRARY_NAME) { | 392 if (doc.displayName(library) == HTML_LIBRARY_NAME) { |
| 393 return htmldoc.libraryComment; | 393 return htmldoc.libraryComment; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 } | 563 } |
| 564 | 564 |
| 565 class MdnComment implements doc.DocComment { | 565 class MdnComment implements doc.DocComment { |
| 566 final String mdnComment; | 566 final String mdnComment; |
| 567 final String mdnUrl; | 567 final String mdnUrl; |
| 568 | 568 |
| 569 MdnComment(String this.mdnComment, String this.mdnUrl); | 569 MdnComment(String this.mdnComment, String this.mdnUrl); |
| 570 | 570 |
| 571 String get text => mdnComment; | 571 String get text => mdnComment; |
| 572 | 572 |
| 573 InterfaceMirror get inheritedFrom => null; | 573 ClassMirror get inheritedFrom => null; |
| 574 | 574 |
| 575 String get html { | 575 String get html { |
| 576 // Wrap the mdn comment so we can highlight it and so we handle MDN scraped | 576 // Wrap the mdn comment so we can highlight it and so we handle MDN scraped |
| 577 // content that lacks a top-level block tag. | 577 // content that lacks a top-level block tag. |
| 578 return ''' | 578 return ''' |
| 579 <div class="mdn"> | 579 <div class="mdn"> |
| 580 $mdnComment | 580 $mdnComment |
| 581 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> | 581 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> |
| 582 </div> | 582 </div> |
| 583 '''; | 583 '''; |
| 584 } | 584 } |
| 585 | 585 |
| 586 String toString() => mdnComment; | 586 String toString() => mdnComment; |
| 587 } | 587 } |
| OLD | NEW |