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 * |
11 * This will create a "docs" directory with the docs for your libraries. To | 11 * This will create a "docs" directory with the docs for your libraries. To |
12 * create these beautiful docs, dartdoc parses your library and every library | 12 * create these beautiful docs, dartdoc parses your library and every library |
13 * it imports (recursively). From each library, it parses all classes and | 13 * it imports (recursively). From each library, it parses all classes and |
14 * members, finds the associated doc comments and builds crosslinked docs from | 14 * members, finds the associated doc comments and builds crosslinked docs from |
15 * them. | 15 * them. |
16 */ | 16 */ |
17 library dartdoc; | 17 #library('dartdoc'); |
18 | 18 |
19 import 'dart:io'; | 19 #import('dart:io'); |
20 import 'dart:math'; | 20 #import('dart:math'); |
21 import 'dart:uri'; | 21 #import('dart:uri'); |
22 import 'dart:json'; | 22 #import('dart:json'); |
23 | 23 |
24 // TODO(rnystrom): Use "package:" URL (#4968). | 24 // TODO(rnystrom): Use "package:" URL (#4968). |
25 import 'mirrors.dart'; | 25 #import('mirrors.dart'); |
26 import 'mirrors_util.dart'; | 26 #import('mirrors_util.dart'); |
27 import 'src/mirrors/dart2js_mirror.dart' as dart2js; | 27 #import('src/mirrors/dart2js_mirror.dart', prefix: 'dart2js'); |
28 import 'classify.dart'; | 28 #import('classify.dart'); |
29 import 'markdown.dart' as md; | 29 #import('markdown.dart', prefix: 'md'); |
30 import '../../../lib/compiler/implementation/scanner/scannerlib.dart' as dart2js
; | 30 #import('../../../lib/compiler/implementation/scanner/scannerlib.dart', |
31 import '../../../lib/_internal/libraries.dart'; | 31 prefix: 'dart2js'); |
| 32 #import('../../../lib/_internal/libraries.dart'); |
32 | 33 |
33 // TODO(rnystrom): Use "package:" URL (#4968). | 34 // TODO(rnystrom): Use "package:" URL (#4968). |
34 part 'src/dartdoc/comment_map.dart'; | 35 #source('src/dartdoc/comment_map.dart'); |
35 part 'src/dartdoc/nav.dart'; | 36 #source('src/dartdoc/nav.dart'); |
36 part 'src/dartdoc/utils.dart'; | 37 #source('src/dartdoc/utils.dart'); |
37 | 38 |
38 /** | 39 /** |
39 * Generates completely static HTML containing everything you need to browse | 40 * Generates completely static HTML containing everything you need to browse |
40 * the docs. The only client side behavior is trivial stuff like syntax | 41 * the docs. The only client side behavior is trivial stuff like syntax |
41 * highlighting code. | 42 * highlighting code. |
42 */ | 43 */ |
43 const MODE_STATIC = 0; | 44 const MODE_STATIC = 0; |
44 | 45 |
45 /** | 46 /** |
46 * Generated docs do not include baked HTML navigation. Instead, a single | 47 * Generated docs do not include baked HTML navigation. Instead, a single |
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 final InterfaceMirror inheritedFrom; | 1848 final InterfaceMirror inheritedFrom; |
1848 | 1849 |
1849 DocComment(this.text, [this.inheritedFrom = null]) { | 1850 DocComment(this.text, [this.inheritedFrom = null]) { |
1850 assert(text != null && !text.trim().isEmpty()); | 1851 assert(text != null && !text.trim().isEmpty()); |
1851 } | 1852 } |
1852 | 1853 |
1853 String get html => md.markdownToHtml(text); | 1854 String get html => md.markdownToHtml(text); |
1854 | 1855 |
1855 String toString() => text; | 1856 String toString() => text; |
1856 } | 1857 } |
OLD | NEW |