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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 600 |
601 void endFile() { | 601 void endFile() { |
602 final outPath = path.join(outputDir, _filePath); | 602 final outPath = path.join(outputDir, _filePath); |
603 final dir = new Directory(path.dirname(outPath)); | 603 final dir = new Directory(path.dirname(outPath)); |
604 if (!dir.existsSync()) { | 604 if (!dir.existsSync()) { |
605 // TODO(3914): Hack to avoid 'file already exists' exception | 605 // TODO(3914): Hack to avoid 'file already exists' exception |
606 // thrown due to invalid result from dir.existsSync() (probably due to | 606 // thrown due to invalid result from dir.existsSync() (probably due to |
607 // race conditions). | 607 // race conditions). |
608 try { | 608 try { |
609 dir.createSync(); | 609 dir.createSync(); |
610 } on DirectoryException catch (e) { | 610 } on FileSystemException catch (e) { |
611 // Ignore. | 611 // Ignore. |
612 } | 612 } |
613 } | 613 } |
614 | 614 |
615 writeString(new File(outPath), _file.toString()); | 615 writeString(new File(outPath), _file.toString()); |
616 _filePath = null; | 616 _filePath = null; |
617 _file = null; | 617 _file = null; |
618 } | 618 } |
619 | 619 |
620 void write(String s) { | 620 void write(String s) { |
(...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 return ''' | 2312 return ''' |
2313 <div class="mdn"> | 2313 <div class="mdn"> |
2314 $mdnComment | 2314 $mdnComment |
2315 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> | 2315 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> |
2316 </div> | 2316 </div> |
2317 '''; | 2317 '''; |
2318 } | 2318 } |
2319 | 2319 |
2320 String toString() => mdnComment; | 2320 String toString() => mdnComment; |
2321 } | 2321 } |
OLD | NEW |