| 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 * |
| 11 * Usage: | 11 * Usage: |
| 12 * | 12 * |
| 13 * $ dart apidoc.dart [--out=<output directory>] | 13 * $ dart apidoc.dart [--out=<output directory>] |
| 14 */ | 14 */ |
| 15 library apidoc; | 15 library apidoc; |
| 16 | 16 |
| 17 import 'dart:io'; | 17 import 'dart:io'; |
| 18 import 'dart:json'; | 18 import 'dart:json'; |
| 19 import 'html_diff.dart'; | 19 import 'html_diff.dart'; |
| 20 // TODO(rnystrom): Use "package:" URL (#4968). | 20 // TODO(rnystrom): Use "package:" URL (#4968). |
| 21 import '../../sdk/lib/_internal/dartdoc/lib/mirrors.dart'; | 21 import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'; |
| 22 import '../../sdk/lib/_internal/dartdoc/lib/mirrors_util.dart'; | 22 import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dar
t'; |
| 23 import '../../sdk/lib/_internal/dartdoc/lib/dartdoc.dart' as doc; | 23 import '../../sdk/lib/_internal/dartdoc/lib/dartdoc.dart' as doc; |
| 24 import '../../sdk/lib/_internal/libraries.dart'; | 24 import '../../sdk/lib/_internal/libraries.dart'; |
| 25 | 25 |
| 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'); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 57 } else if (arg.startsWith('--out=')) { | 57 } else if (arg.startsWith('--out=')) { |
| 58 outputDir = new Path.fromNative(arg.substring('--out='.length)); | 58 outputDir = new Path.fromNative(arg.substring('--out='.length)); |
| 59 } else { | 59 } else { |
| 60 print('Unknown option: $arg'); | 60 print('Unknown option: $arg'); |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 break; | 63 break; |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 final libPath = doc.scriptDir.append('../../sdk/lib'); | 67 final libPath = doc.scriptDir.append('../../sdk/'); |
| 68 final pkgPath = doc.scriptDir.append('../../pkg/'); | 68 final pkgPath = doc.scriptDir.append('../../pkg/'); |
| 69 | 69 |
| 70 doc.cleanOutputDirectory(outputDir); | 70 doc.cleanOutputDirectory(outputDir); |
| 71 | 71 |
| 72 // The basic dartdoc-provided static content. | 72 // The basic dartdoc-provided static content. |
| 73 final copiedStatic = doc.copyDirectory( | 73 final copiedStatic = doc.copyDirectory( |
| 74 doc.scriptDir.append('../../sdk/lib/_internal/dartdoc/static'), | 74 doc.scriptDir.append('../../sdk/lib/_internal/dartdoc/static'), |
| 75 outputDir); | 75 outputDir); |
| 76 | 76 |
| 77 // The apidoc-specific static content. | 77 // The apidoc-specific static content. |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 return ''' | 578 return ''' |
| 579 <div class="mdn"> | 579 <div class="mdn"> |
| 580 $mdnComment | 580 $mdnComment |
| 581 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> | 581 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> |
| 582 </div> | 582 </div> |
| 583 '''; | 583 '''; |
| 584 } | 584 } |
| 585 | 585 |
| 586 String toString() => mdnComment; | 586 String toString() => mdnComment; |
| 587 } | 587 } |
| OLD | NEW |