| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 var footerItems = []; | 357 var footerItems = []; |
| 358 if (!omitGenerationTime) { | 358 if (!omitGenerationTime) { |
| 359 footerItems.add("This page was generated at ${new DateTime.now()}"); | 359 footerItems.add("This page was generated at ${new DateTime.now()}"); |
| 360 } | 360 } |
| 361 if (footerText != null) { | 361 if (footerText != null) { |
| 362 footerItems.add(footerText); | 362 footerItems.add(footerText); |
| 363 } | 363 } |
| 364 var content = ''; | 364 var content = ''; |
| 365 for (int i = 0; i < footerItems.length; i++) { | 365 for (int i = 0; i < footerItems.length; i++) { |
| 366 if (i > 0) { | 366 if (i > 0) { |
| 367 content = content.concat('\n'); | 367 content += '\n'; |
| 368 } | 368 } |
| 369 content = content.concat('<div>${footerItems[i]}</div>'); | 369 content += '<div>${footerItems[i]}</div>'; |
| 370 } | 370 } |
| 371 return content; | 371 return content; |
| 372 } | 372 } |
| 373 | 373 |
| 374 void documentEntryPoint(Path entrypoint, Path libPath, Path pkgPath) { | 374 void documentEntryPoint(Path entrypoint, Path libPath, Path pkgPath) { |
| 375 final compilation = new Compilation(entrypoint, libPath, pkgPath, | 375 final compilation = new Compilation(entrypoint, libPath, pkgPath, |
| 376 COMPILER_OPTIONS); | 376 COMPILER_OPTIONS); |
| 377 _document(compilation); | 377 _document(compilation); |
| 378 } | 378 } |
| 379 | 379 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 write(json_serializer.serialize(packageManifest)); | 436 write(json_serializer.serialize(packageManifest)); |
| 437 endFile(); | 437 endFile(); |
| 438 | 438 |
| 439 // Write out top level json file with a relative path to the library json | 439 // Write out top level json file with a relative path to the library json |
| 440 // files. | 440 // files. |
| 441 startFile("apidoc.json"); | 441 startFile("apidoc.json"); |
| 442 packageManifest.location = revision; | 442 packageManifest.location = revision; |
| 443 write(json_serializer.serialize(packageManifest)); | 443 write(json_serializer.serialize(packageManifest)); |
| 444 endFile(); | 444 endFile(); |
| 445 } | 445 } |
| 446 | 446 |
| 447 MdnComment lookupMdnComment(Mirror mirror) => null; | 447 MdnComment lookupMdnComment(Mirror mirror) => null; |
| 448 | 448 |
| 449 void startFile(String path) { | 449 void startFile(String path) { |
| 450 _filePath = new Path(path); | 450 _filePath = new Path(path); |
| 451 _file = new StringBuffer(); | 451 _file = new StringBuffer(); |
| 452 } | 452 } |
| 453 | 453 |
| 454 void endFile() { | 454 void endFile() { |
| 455 final outPath = outputDir.join(_filePath); | 455 final outPath = outputDir.join(_filePath); |
| 456 final dir = new Directory.fromPath(outPath.directoryPath); | 456 final dir = new Directory.fromPath(outPath.directoryPath); |
| (...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 return ''' | 2017 return ''' |
| 2018 <div class="mdn"> | 2018 <div class="mdn"> |
| 2019 $mdnComment | 2019 $mdnComment |
| 2020 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> | 2020 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> |
| 2021 </div> | 2021 </div> |
| 2022 '''; | 2022 '''; |
| 2023 } | 2023 } |
| 2024 | 2024 |
| 2025 String toString() => mdnComment; | 2025 String toString() => mdnComment; |
| 2026 } | 2026 } |
| OLD | NEW |