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 18 matching lines...) Expand all Loading... |
29 prefix: 'dart2js'); | 29 prefix: 'dart2js'); |
30 #import('../../lib/_internal/libraries.dart'); | 30 #import('../../lib/_internal/libraries.dart'); |
31 | 31 |
32 #source('comment_map.dart'); | 32 #source('comment_map.dart'); |
33 #source('nav.dart'); | 33 #source('nav.dart'); |
34 #source('utils.dart'); | 34 #source('utils.dart'); |
35 | 35 |
36 // TODO(johnniwinther): Note that [IN_SDK] gets initialized to true when this | 36 // TODO(johnniwinther): Note that [IN_SDK] gets initialized to true when this |
37 // file is modified by the SDK deployment script. If you change, be sure to test | 37 // file is modified by the SDK deployment script. If you change, be sure to test |
38 // that dartdoc still works when run from the built SDK directory. | 38 // that dartdoc still works when run from the built SDK directory. |
39 final bool IN_SDK = false; | 39 const bool IN_SDK = false; |
40 | 40 |
41 /** | 41 /** |
42 * Generates completely static HTML containing everything you need to browse | 42 * Generates completely static HTML containing everything you need to browse |
43 * the docs. The only client side behavior is trivial stuff like syntax | 43 * the docs. The only client side behavior is trivial stuff like syntax |
44 * highlighting code. | 44 * highlighting code. |
45 */ | 45 */ |
46 final MODE_STATIC = 0; | 46 const MODE_STATIC = 0; |
47 | 47 |
48 /** | 48 /** |
49 * Generated docs do not include baked HTML navigation. Instead, a single | 49 * Generated docs do not include baked HTML navigation. Instead, a single |
50 * `nav.json` file is created and the appropriate navigation is generated | 50 * `nav.json` file is created and the appropriate navigation is generated |
51 * client-side by parsing that and building HTML. | 51 * client-side by parsing that and building HTML. |
52 * | 52 * |
53 * This dramatically reduces the generated size of the HTML since a large | 53 * This dramatically reduces the generated size of the HTML since a large |
54 * fraction of each static page is just redundant navigation links. | 54 * fraction of each static page is just redundant navigation links. |
55 * | 55 * |
56 * In this mode, the browser will do a XHR for nav.json which means that to | 56 * In this mode, the browser will do a XHR for nav.json which means that to |
57 * preview docs locally, you will need to enable requesting file:// links in | 57 * preview docs locally, you will need to enable requesting file:// links in |
58 * your browser or run a little local server like `python -m SimpleHTTPServer`. | 58 * your browser or run a little local server like `python -m SimpleHTTPServer`. |
59 */ | 59 */ |
60 final MODE_LIVE_NAV = 1; | 60 const MODE_LIVE_NAV = 1; |
61 | 61 |
62 final API_LOCATION = 'http://api.dartlang.org/'; | 62 const API_LOCATION = 'http://api.dartlang.org/'; |
63 | 63 |
64 /** | 64 /** |
65 * Run this from the `pkg/dartdoc` directory. | 65 * Run this from the `pkg/dartdoc` directory. |
66 */ | 66 */ |
67 void main() { | 67 void main() { |
68 final args = new Options().arguments; | 68 final args = new Options().arguments; |
69 | 69 |
70 final dartdoc = new Dartdoc(); | 70 final dartdoc = new Dartdoc(); |
71 | 71 |
72 if (args.isEmpty()) { | 72 if (args.isEmpty()) { |
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 } | 1720 } |
1721 | 1721 |
1722 /** | 1722 /** |
1723 * Returns [:true:] if [type] should be regarded as an exception. | 1723 * Returns [:true:] if [type] should be regarded as an exception. |
1724 */ | 1724 */ |
1725 bool isException(TypeMirror type) { | 1725 bool isException(TypeMirror type) { |
1726 return type.simpleName.endsWith('Exception'); | 1726 return type.simpleName.endsWith('Exception'); |
1727 } | 1727 } |
1728 } | 1728 } |
1729 | 1729 |
OLD | NEW |