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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 // Only print setters if the getter doesn't exist. | 447 // Only print setters if the getter doesn't exist. |
448 return members.filter((m) { | 448 return members.filter((m) { |
449 if (!m.name.startsWith('set:')) return true; | 449 if (!m.name.startsWith('set:')) return true; |
450 var getName = m.name.replaceFirst('set:', 'get:'); | 450 var getName = m.name.replaceFirst('set:', 'get:'); |
451 return !members.some((maybeGet) => maybeGet.name == getName); | 451 return !members.some((maybeGet) => maybeGet.name == getName); |
452 }); | 452 }); |
453 } | 453 } |
454 | 454 |
455 /** | 455 /** |
456 * Returns additional documentation for [member], linking it to the | 456 * Returns additional documentation for [member], linking it to the |
457 * corresponding `dart:html` or `dart:dom` [Member](s). If [member] is not in | 457 * corresponding `dart:html` or `dart:dom_deprecated` [Member](s). If [member]
is not in |
458 * `dart:html` or `dart:dom`, returns no additional documentation. | 458 * `dart:html` or `dart:dom_deprecated`, returns no additional documentation. |
459 */ | 459 */ |
460 String getMemberDoc(Member member) { | 460 String getMemberDoc(Member member) { |
461 if (_diff.domToHtml.containsKey(member)) { | 461 if (_diff.domToHtml.containsKey(member)) { |
462 final htmlMemberSet = _unifyProperties(_diff.domToHtml[member]); | 462 final htmlMemberSet = _unifyProperties(_diff.domToHtml[member]); |
463 final allSameName = htmlMemberSet.every((m) => _diff.sameName(member, m)); | 463 final allSameName = htmlMemberSet.every((m) => _diff.sameName(member, m)); |
464 final phrase = allSameName ? 'available as' : 'renamed to'; | 464 final phrase = allSameName ? 'available as' : 'renamed to'; |
465 final htmlMembers = doc.joinWithCommas(map(htmlMemberSet, _linkMember)); | 465 final htmlMembers = doc.joinWithCommas(map(htmlMemberSet, _linkMember)); |
466 return | 466 return |
467 '''<p class="correspond">This is $phrase $htmlMembers in the | 467 '''<p class="correspond">This is $phrase $htmlMembers in the |
468 ${a("html.html", "dart:html")} library.</p> | 468 ${a("html.html", "dart:html")} library.</p> |
469 '''; | 469 '''; |
470 } else if (_diff.htmlToDom.containsKey(member)) { | 470 } else if (_diff.htmlToDom.containsKey(member)) { |
471 final domMemberSet = _unifyProperties(_diff.htmlToDom[member]); | 471 final domMemberSet = _unifyProperties(_diff.htmlToDom[member]); |
472 final allSameName = domMemberSet.every((m) => _diff.sameName(m, member)); | 472 final allSameName = domMemberSet.every((m) => _diff.sameName(m, member)); |
473 final phrase = allSameName ? 'is the same as' : 'renames'; | 473 final phrase = allSameName ? 'is the same as' : 'renames'; |
474 final domMembers = doc.joinWithCommas(map(domMemberSet, _linkMember)); | 474 final domMembers = doc.joinWithCommas(map(domMemberSet, _linkMember)); |
475 return | 475 return |
476 ''' | 476 ''' |
477 <p class="correspond">This $phrase $domMembers in the | 477 <p class="correspond">This $phrase $domMembers in the |
478 ${a("dom.html", "dart:dom")} library.</p> | 478 ${a("dom.html", "dart:dom_deprecated")} library.</p> |
479 '''; | 479 '''; |
480 } else { | 480 } else { |
481 return ''; | 481 return ''; |
482 } | 482 } |
483 } | 483 } |
484 | 484 |
485 /** | 485 /** |
486 * Returns additional Markdown-formatted documentation for [type], linking it | 486 * Returns additional Markdown-formatted documentation for [type], linking it |
487 * to the corresponding `dart:html` or `dart:dom` [Type](s). If [type] is not | 487 * to the corresponding `dart:html` or `dart:dom_deprecated` [Type](s). If [ty
pe] is not |
488 * in `dart:html` or `dart:dom`, returns no additional documentation. | 488 * in `dart:html` or `dart:dom_deprecated`, returns no additional documentatio
n. |
489 */ | 489 */ |
490 String getTypeDoc(Type type) { | 490 String getTypeDoc(Type type) { |
491 final htmlTypes = _diff.domTypesToHtml[type]; | 491 final htmlTypes = _diff.domTypesToHtml[type]; |
492 if ((htmlTypes != null) && (htmlTypes.length > 0)) { | 492 if ((htmlTypes != null) && (htmlTypes.length > 0)) { |
493 var htmlTypesText = doc.joinWithCommas(map(htmlTypes, typeReference)); | 493 var htmlTypesText = doc.joinWithCommas(map(htmlTypes, typeReference)); |
494 return | 494 return |
495 ''' | 495 ''' |
496 <p class="correspond">This corresponds to $htmlTypesText in the | 496 <p class="correspond">This corresponds to $htmlTypesText in the |
497 ${a("html.html", "dart:html")} library.</p> | 497 ${a("html.html", "dart:html")} library.</p> |
498 '''; | 498 '''; |
499 } | 499 } |
500 | 500 |
501 final domTypes = _diff.htmlTypesToDom[type]; | 501 final domTypes = _diff.htmlTypesToDom[type]; |
502 if ((domTypes != null) && (domTypes.length > 0)) { | 502 if ((domTypes != null) && (domTypes.length > 0)) { |
503 var domTypesText = doc.joinWithCommas(map(domTypes, typeReference)); | 503 var domTypesText = doc.joinWithCommas(map(domTypes, typeReference)); |
504 return | 504 return |
505 ''' | 505 ''' |
506 <p class="correspond">This corresponds to $domTypesText in the | 506 <p class="correspond">This corresponds to $domTypesText in the |
507 ${a("dom.html", "dart:dom")} library.</p> | 507 ${a("dom.html", "dart:dom_deprecated")} library.</p> |
508 '''; | 508 '''; |
509 } | 509 } |
510 | 510 |
511 return ''; | 511 return ''; |
512 } | 512 } |
513 | 513 |
514 } | 514 } |
OLD | NEW |