| 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 * To generate docs for a library, run this script with the path to an | 6 * To generate docs for a library, run this script with the path to an |
| 7 * entrypoint .dart file, like: | 7 * entrypoint .dart file, like: |
| 8 * | 8 * |
| 9 * $ dart dartdoc.dart foo.dart | 9 * $ dart dartdoc.dart foo.dart |
| 10 * | 10 * |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 /** Gets the URL for the documentation for [type]. */ | 1527 /** Gets the URL for the documentation for [type]. */ |
| 1528 String typeUrl(ObjectMirror type) { | 1528 String typeUrl(ObjectMirror type) { |
| 1529 if (type is LibraryMirror) { | 1529 if (type is LibraryMirror) { |
| 1530 return '${sanitize(type.simpleName)}.html'; | 1530 return '${sanitize(type.simpleName)}.html'; |
| 1531 } | 1531 } |
| 1532 assert (type is TypeMirror); | 1532 assert (type is TypeMirror); |
| 1533 // Always get the generic type to strip off any type parameters or | 1533 // Always get the generic type to strip off any type parameters or |
| 1534 // arguments. If the type isn't generic, genericType returns `this`, so it | 1534 // arguments. If the type isn't generic, genericType returns `this`, so it |
| 1535 // works for non-generic types too. | 1535 // works for non-generic types too. |
| 1536 return '${sanitize(displayName(type.library))}/' | 1536 return '${sanitize(displayName(type.library))}/' |
| 1537 '${type.declaration.simpleName}.html'; | 1537 '${type.originalDeclaration.simpleName}.html'; |
| 1538 } | 1538 } |
| 1539 | 1539 |
| 1540 /** Gets the URL for the documentation for [member]. */ | 1540 /** Gets the URL for the documentation for [member]. */ |
| 1541 String memberUrl(MemberMirror member) { | 1541 String memberUrl(MemberMirror member) { |
| 1542 String url = typeUrl(member.owner); | 1542 String url = typeUrl(member.owner); |
| 1543 return '$url#${memberAnchor(member)}'; | 1543 return '$url#${memberAnchor(member)}'; |
| 1544 } | 1544 } |
| 1545 | 1545 |
| 1546 /** Gets the anchor id for the document for [member]. */ | 1546 /** Gets the anchor id for the document for [member]. */ |
| 1547 String memberAnchor(MemberMirror member) { | 1547 String memberAnchor(MemberMirror member) { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1857 final ClassMirror inheritedFrom; | 1857 final ClassMirror inheritedFrom; |
| 1858 | 1858 |
| 1859 DocComment(this.text, [this.inheritedFrom = null]) { | 1859 DocComment(this.text, [this.inheritedFrom = null]) { |
| 1860 assert(text != null && !text.trim().isEmpty); | 1860 assert(text != null && !text.trim().isEmpty); |
| 1861 } | 1861 } |
| 1862 | 1862 |
| 1863 String get html => md.markdownToHtml(text); | 1863 String get html => md.markdownToHtml(text); |
| 1864 | 1864 |
| 1865 String toString() => text; | 1865 String toString() => text; |
| 1866 } | 1866 } |
| OLD | NEW |