Skip to content

Commit 7d95578

Browse files
authored
Update template descriptions (#3258)
* Update template descriptions Adds support for displaying enum and mixin, instead of just class or extension * Remove unused import
1 parent d558f04 commit 7d95578

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

lib/src/generator/template_data.dart

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'package:analyzer/dart/element/element.dart';
65
import 'package:dartdoc/src/model/model.dart';
76

87
typedef ContainerSidebar = String Function(
@@ -411,21 +410,16 @@ class MethodTemplateData extends TemplateData<Method>
411410
final Container container;
412411
final ContainerSidebar _sidebarForContainer;
413412

414-
final String _containerDescription;
415-
416413
MethodTemplateData(super.htmlOptions, super.packageGraph, this.library,
417-
this.container, this.method, this._sidebarForContainer)
418-
: _containerDescription =
419-
// TODO(srawlins): No mixin? enum?
420-
container is InterfaceElement ? 'class' : 'extension';
414+
this.container, this.method, this._sidebarForContainer);
421415

422416
String get sidebarForContainer => _sidebarForContainer(container, this);
423417

424418
@override
425419
Method get self => method;
426420
@override
427421
String get title =>
428-
'${method.name} method - ${container.name} $_containerDescription - '
422+
'${method.name} method - ${container.name} ${container.kind} - '
429423
'${library.name} library - Dart API';
430424
@override
431425
String get layoutTitle =>
@@ -434,7 +428,7 @@ class MethodTemplateData extends TemplateData<Method>
434428
@override
435429
String get metaDescription =>
436430
'API docs for the ${method.name} method from the ${container.name} '
437-
'$_containerDescription, for the Dart programming language.';
431+
'${container.kind}, for the Dart programming language.';
438432
@override
439433
List<Documentable> get navLinks => [_packageGraph.defaultPackage, library];
440434
@override
@@ -452,12 +446,9 @@ class PropertyTemplateData extends TemplateData<Field>
452446
final Container container;
453447
final Field property;
454448
final ContainerSidebar _sidebarForContainer;
455-
final String _containerDescription;
456449

457450
PropertyTemplateData(super.htmlOptions, super.packageGraph, this.library,
458-
this.container, this.property, this._sidebarForContainer)
459-
: _containerDescription =
460-
container is InterfaceElement ? 'class' : 'extension';
451+
this.container, this.property, this._sidebarForContainer);
461452

462453
String get sidebarForContainer => _sidebarForContainer(container, this);
463454

@@ -466,15 +457,15 @@ class PropertyTemplateData extends TemplateData<Field>
466457

467458
@override
468459
String get title => '${property.name} ${property.kind} - '
469-
'${container.name} $_containerDescription - '
460+
'${container.name} ${container.kind} - '
470461
'${library.name} library - Dart API';
471462
@override
472463
String get layoutTitle => _layoutTitle(property.name, property.fullkind,
473464
isDeprecated: property.isDeprecated);
474465
@override
475466
String get metaDescription =>
476467
'API docs for the ${property.name} ${property.kind} from the '
477-
'${container.name} $_containerDescription, '
468+
'${container.name} ${container.kind}, '
478469
'for the Dart programming language.';
479470
@override
480471
List<Documentable> get navLinks => [_packageGraph.defaultPackage, library];
@@ -506,7 +497,7 @@ class TypedefTemplateData extends TemplateData<Typedef>
506497
isDeprecated: typeDef.isDeprecated);
507498
@override
508499
String get metaDescription =>
509-
'API docs for the ${typeDef.name} property from the '
500+
'API docs for the ${typeDef.name} typedef from the '
510501
'${library.name} library, for the Dart programming language.';
511502
@override
512503
List<Documentable> get navLinks => [_packageGraph.defaultPackage, library];

0 commit comments

Comments
 (0)