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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 docIndex(); | 350 docIndex(); |
351 for (final library in _sortedLibraries) { | 351 for (final library in _sortedLibraries) { |
352 docLibrary(library); | 352 docLibrary(library); |
353 } | 353 } |
354 | 354 |
355 if (generateAppCache) { | 355 if (generateAppCache) { |
356 generateAppCacheManifest(); | 356 generateAppCacheManifest(); |
357 } | 357 } |
358 | 358 |
359 startFile("apidoc.json"); | 359 startFile("apidoc.json"); |
360 var libraries = _sortedLibraries.mappedBy( | 360 var libraries = _sortedLibraries.map( |
361 (lib) => new LibraryElement(lib.qualifiedName, lib)) | 361 (lib) => new LibraryElement(lib.qualifiedName, lib)) |
362 .toList(); | 362 .toList(); |
363 write(json_serializer.serialize(libraries)); | 363 write(json_serializer.serialize(libraries)); |
364 endFile(); | 364 endFile(); |
365 } | 365 } |
366 | 366 |
367 void startFile(String path) { | 367 void startFile(String path) { |
368 _filePath = new Path(path); | 368 _filePath = new Path(path); |
369 _file = new StringBuffer(); | 369 _file = new StringBuffer(); |
370 } | 370 } |
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 return type.simpleName; | 1693 return type.simpleName; |
1694 } | 1694 } |
1695 final params = Strings.join(typeParams, ', '); | 1695 final params = Strings.join(typeParams, ', '); |
1696 return '${type.simpleName}<$params>'; | 1696 return '${type.simpleName}<$params>'; |
1697 } | 1697 } |
1698 | 1698 |
1699 // See if it's an instantiation of a generic type. | 1699 // See if it's an instantiation of a generic type. |
1700 final typeArgs = type.typeArguments; | 1700 final typeArgs = type.typeArguments; |
1701 if (typeArgs.length > 0) { | 1701 if (typeArgs.length > 0) { |
1702 final args = | 1702 final args = |
1703 Strings.join(typeArgs.mappedBy((arg) => typeName(arg)), ', '); | 1703 Strings.join(typeArgs.map((arg) => typeName(arg)), ', '); |
1704 return '${type.originalDeclaration.simpleName}<$args>'; | 1704 return '${type.originalDeclaration.simpleName}<$args>'; |
1705 } | 1705 } |
1706 | 1706 |
1707 // Regular type. | 1707 // Regular type. |
1708 return type.simpleName; | 1708 return type.simpleName; |
1709 } | 1709 } |
1710 | 1710 |
1711 /** | 1711 /** |
1712 * Remove leading indentation to line up with first line. | 1712 * Remove leading indentation to line up with first line. |
1713 */ | 1713 */ |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 final ClassMirror inheritedFrom; | 1906 final ClassMirror inheritedFrom; |
1907 | 1907 |
1908 DocComment(this.text, [this.inheritedFrom = null]) { | 1908 DocComment(this.text, [this.inheritedFrom = null]) { |
1909 assert(text != null && !text.trim().isEmpty); | 1909 assert(text != null && !text.trim().isEmpty); |
1910 } | 1910 } |
1911 | 1911 |
1912 String get html => md.markdownToHtml(text); | 1912 String get html => md.markdownToHtml(text); |
1913 | 1913 |
1914 String toString() => text; | 1914 String toString() => text; |
1915 } | 1915 } |
OLD | NEW |