| 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 15 matching lines...) Expand all Loading... |
| 26 HtmlDiff _diff; | 26 HtmlDiff _diff; |
| 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>[]; |
| 37 |
| 36 | 38 |
| 37 // Parse the command-line arguments. | 39 // Parse the command-line arguments. |
| 38 for (int i = 0; i < args.length; i++) { | 40 for (int i = 0; i < args.length; i++) { |
| 39 final arg = args[i]; | 41 final arg = args[i]; |
| 40 | 42 |
| 41 switch (arg) { | 43 switch (arg) { |
| 42 case '--mode=static': | 44 case '--mode=static': |
| 43 mode = doc.MODE_STATIC; | 45 mode = doc.MODE_STATIC; |
| 44 break; | 46 break; |
| 45 | 47 |
| 46 case '--mode=live-nav': | 48 case '--mode=live-nav': |
| 47 mode = doc.MODE_LIVE_NAV; | 49 mode = doc.MODE_LIVE_NAV; |
| 48 break; | 50 break; |
| 49 | 51 |
| 50 case '--generate-app-cache=true': | 52 case '--generate-app-cache=true': |
| 51 generateAppCache = true; | 53 generateAppCache = true; |
| 52 break; | 54 break; |
| 53 | 55 |
| 54 default: | 56 default: |
| 55 if (arg.startsWith('--exclude-lib=')) { | 57 if (arg.startsWith('--exclude-lib=')) { |
| 56 excludedLibraries.add(arg.substring('--exclude-lib='.length)); | 58 excludedLibraries.add(arg.substring('--exclude-lib='.length)); |
| 59 } else if (arg.startsWith('--include-lib=')) { |
| 60 includedLibraries.add(arg.substring('--include-lib='.length)); |
| 57 } else if (arg.startsWith('--out=')) { | 61 } else if (arg.startsWith('--out=')) { |
| 58 outputDir = new Path.fromNative(arg.substring('--out='.length)); | 62 outputDir = new Path.fromNative(arg.substring('--out='.length)); |
| 59 } else { | 63 } else { |
| 60 print('Unknown option: $arg'); | 64 print('Unknown option: $arg'); |
| 61 return; | 65 return; |
| 62 } | 66 } |
| 63 break; | 67 break; |
| 64 } | 68 } |
| 65 } | 69 } |
| 66 | 70 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // TODO(johnniwinther): Libraries for the compilation seem to be more like | 105 // TODO(johnniwinther): Libraries for the compilation seem to be more like |
| 102 // URIs. Perhaps Path should have a toURI() method. | 106 // URIs. Perhaps Path should have a toURI() method. |
| 103 // Add all of the core libraries. | 107 // Add all of the core libraries. |
| 104 final apidocLibraries = <Path>[]; | 108 final apidocLibraries = <Path>[]; |
| 105 LIBRARIES.forEach((String name, LibraryInfo info) { | 109 LIBRARIES.forEach((String name, LibraryInfo info) { |
| 106 if (info.documented) { | 110 if (info.documented) { |
| 107 apidocLibraries.add(new Path('dart:$name')); | 111 apidocLibraries.add(new Path('dart:$name')); |
| 108 } | 112 } |
| 109 }); | 113 }); |
| 110 | 114 |
| 111 final includedLibraries = <String>[]; | |
| 112 | |
| 113 var lister = new Directory.fromPath(doc.scriptDir.append('../../pkg')).list(); | 115 var lister = new Directory.fromPath(doc.scriptDir.append('../../pkg')).list(); |
| 114 lister.onDir = (dirPath) { | 116 lister.onDir = (dirPath) { |
| 115 var path = new Path.fromNative(dirPath); | 117 var path = new Path.fromNative(dirPath); |
| 116 var libName = path.filename; | 118 var libName = path.filename; |
| 117 | 119 |
| 118 // TODO(rnystrom): Get rid of oldStylePath support when all packages are | 120 // TODO(rnystrom): Get rid of oldStylePath support when all packages are |
| 119 // using new layout. See #5106. | 121 // using new layout. See #5106. |
| 120 var oldStylePath = path.append('${libName}.dart'); | 122 var oldStylePath = path.append('${libName}.dart'); |
| 121 var newStylePath = path.append('lib/${libName}.dart'); | 123 var newStylePath = path.append('lib/${libName}.dart'); |
| 122 | 124 |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 return ''' | 580 return ''' |
| 579 <div class="mdn"> | 581 <div class="mdn"> |
| 580 $mdnComment | 582 $mdnComment |
| 581 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> | 583 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> |
| 582 </div> | 584 </div> |
| 583 '''; | 585 '''; |
| 584 } | 586 } |
| 585 | 587 |
| 586 String toString() => mdnComment; | 588 String toString() => mdnComment; |
| 587 } | 589 } |
| OLD | NEW |