| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after 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/'); | 67 final libPath = doc.scriptDir.append('../../sdk/lib'); |
| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 return new MdnComment(mdnMember['help'], mdnType['srcUrl']); | 546 return new MdnComment(mdnMember['help'], mdnType['srcUrl']); |
| 547 } | 547 } |
| 548 | 548 |
| 549 /** | 549 /** |
| 550 * Returns a link to [member], relative to a type page that may be in a | 550 * Returns a link to [member], relative to a type page that may be in a |
| 551 * different library than [member]. | 551 * different library than [member]. |
| 552 */ | 552 */ |
| 553 String _linkMember(MemberMirror member) { | 553 String _linkMember(MemberMirror member) { |
| 554 final typeName = member.owner.simpleName; | 554 final typeName = member.owner.simpleName; |
| 555 var memberName = '$typeName.${member.simpleName}'; | 555 var memberName = '$typeName.${member.simpleName}'; |
| 556 if (member is MethodMirror && member.isConstructor) { | 556 if (member is MethodMirror && (member.isConstructor || member.isFactory)) { |
| 557 final separator = member.constructorName == '' ? '' : '.'; | 557 final separator = member.constructorName == '' ? '' : '.'; |
| 558 memberName = 'new $typeName$separator${member.constructorName}'; | 558 memberName = 'new $typeName$separator${member.constructorName}'; |
| 559 } | 559 } |
| 560 | 560 |
| 561 return a(memberUrl(member), memberName); | 561 return a(memberUrl(member), memberName); |
| 562 } | 562 } |
| 563 } | 563 } |
| 564 | 564 |
| 565 class MdnComment implements doc.DocComment { | 565 class MdnComment implements doc.DocComment { |
| 566 final String mdnComment; | 566 final String mdnComment; |
| (...skipping 11 matching lines...) Expand all 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 |