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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 void main() { | 28 void main() { |
29 final args = new Options().arguments; | 29 final args = new Options().arguments; |
30 | 30 |
31 int mode = doc.MODE_STATIC; | 31 int mode = doc.MODE_STATIC; |
32 Path outputDir = new Path('docs'); | 32 Path outputDir = new Path('docs'); |
33 bool generateAppCache = false; | 33 bool generateAppCache = false; |
34 | 34 |
35 List<String> excludedLibraries = <String>[]; | 35 List<String> excludedLibraries = <String>[]; |
36 List<String> includedLibraries = <String>[]; | 36 List<String> includedLibraries = <String>[]; |
| 37 var pkgPath; |
37 | 38 |
38 | 39 |
39 // Parse the command-line arguments. | 40 // Parse the command-line arguments. |
40 for (int i = 0; i < args.length; i++) { | 41 for (int i = 0; i < args.length; i++) { |
41 final arg = args[i]; | 42 final arg = args[i]; |
42 | 43 |
43 switch (arg) { | 44 switch (arg) { |
44 case '--mode=static': | 45 case '--mode=static': |
45 mode = doc.MODE_STATIC; | 46 mode = doc.MODE_STATIC; |
46 break; | 47 break; |
47 | 48 |
48 case '--mode=live-nav': | 49 case '--mode=live-nav': |
49 mode = doc.MODE_LIVE_NAV; | 50 mode = doc.MODE_LIVE_NAV; |
50 break; | 51 break; |
51 | 52 |
52 case '--generate-app-cache=true': | 53 case '--generate-app-cache=true': |
53 generateAppCache = true; | 54 generateAppCache = true; |
54 break; | 55 break; |
55 | 56 |
56 default: | 57 default: |
57 if (arg.startsWith('--exclude-lib=')) { | 58 if (arg.startsWith('--exclude-lib=')) { |
58 excludedLibraries.add(arg.substring('--exclude-lib='.length)); | 59 excludedLibraries.add(arg.substring('--exclude-lib='.length)); |
59 } else if (arg.startsWith('--include-lib=')) { | 60 } else if (arg.startsWith('--include-lib=')) { |
60 includedLibraries.add(arg.substring('--include-lib='.length)); | 61 includedLibraries.add(arg.substring('--include-lib='.length)); |
61 } else if (arg.startsWith('--out=')) { | 62 } else if (arg.startsWith('--out=')) { |
62 outputDir = new Path.fromNative(arg.substring('--out='.length)); | 63 outputDir = new Path.fromNative(arg.substring('--out='.length)); |
| 64 } else if (arg.startsWith('--pkg=')) { |
| 65 pkgPath = arg.substring('--pkg='.length); |
63 } else { | 66 } else { |
64 print('Unknown option: $arg'); | 67 print('Unknown option: $arg'); |
65 return; | 68 return; |
66 } | 69 } |
67 break; | 70 break; |
68 } | 71 } |
69 } | 72 } |
70 | 73 |
71 final libPath = doc.scriptDir.append('../../sdk/'); | 74 final libPath = doc.scriptDir.append('../../sdk/'); |
72 final pkgPath = doc.scriptDir.append('../../pkg/'); | |
73 | 75 |
74 doc.cleanOutputDirectory(outputDir); | 76 doc.cleanOutputDirectory(outputDir); |
75 | 77 |
76 // The basic dartdoc-provided static content. | 78 // The basic dartdoc-provided static content. |
77 final copiedStatic = doc.copyDirectory( | 79 final copiedStatic = doc.copyDirectory( |
78 doc.scriptDir.append('../../sdk/lib/_internal/dartdoc/static'), | 80 doc.scriptDir.append('../../sdk/lib/_internal/dartdoc/static'), |
79 outputDir); | 81 outputDir); |
80 | 82 |
81 // The apidoc-specific static content. | 83 // The apidoc-specific static content. |
82 final copiedApiDocStatic = doc.copyDirectory( | 84 final copiedApiDocStatic = doc.copyDirectory( |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 return ''' | 582 return ''' |
581 <div class="mdn"> | 583 <div class="mdn"> |
582 $mdnComment | 584 $mdnComment |
583 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> | 585 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> |
584 </div> | 586 </div> |
585 '''; | 587 '''; |
586 } | 588 } |
587 | 589 |
588 String toString() => mdnComment; | 590 String toString() => mdnComment; |
589 } | 591 } |
OLD | NEW |