Skip to content

Update template descriptions #3258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions lib/src/generator/template_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:analyzer/dart/element/element.dart';
import 'package:dartdoc/src/model/model.dart';

typedef ContainerSidebar = String Function(
Expand Down Expand Up @@ -411,21 +410,16 @@ class MethodTemplateData extends TemplateData<Method>
final Container container;
final ContainerSidebar _sidebarForContainer;

final String _containerDescription;

MethodTemplateData(super.htmlOptions, super.packageGraph, this.library,
this.container, this.method, this._sidebarForContainer)
: _containerDescription =
// TODO(srawlins): No mixin? enum?
container is InterfaceElement ? 'class' : 'extension';
this.container, this.method, this._sidebarForContainer);

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

@override
Method get self => method;
@override
String get title =>
'${method.name} method - ${container.name} $_containerDescription - '
'${method.name} method - ${container.name} ${container.kind} - '
'${library.name} library - Dart API';
@override
String get layoutTitle =>
Expand All @@ -434,7 +428,7 @@ class MethodTemplateData extends TemplateData<Method>
@override
String get metaDescription =>
'API docs for the ${method.name} method from the ${container.name} '
'$_containerDescription, for the Dart programming language.';
'${container.kind}, for the Dart programming language.';
@override
List<Documentable> get navLinks => [_packageGraph.defaultPackage, library];
@override
Expand All @@ -452,12 +446,9 @@ class PropertyTemplateData extends TemplateData<Field>
final Container container;
final Field property;
final ContainerSidebar _sidebarForContainer;
final String _containerDescription;

PropertyTemplateData(super.htmlOptions, super.packageGraph, this.library,
this.container, this.property, this._sidebarForContainer)
: _containerDescription =
container is InterfaceElement ? 'class' : 'extension';
this.container, this.property, this._sidebarForContainer);

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

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

@override
String get title => '${property.name} ${property.kind} - '
'${container.name} $_containerDescription - '
'${container.name} ${container.kind} - '
'${library.name} library - Dart API';
@override
String get layoutTitle => _layoutTitle(property.name, property.fullkind,
isDeprecated: property.isDeprecated);
@override
String get metaDescription =>
'API docs for the ${property.name} ${property.kind} from the '
'${container.name} $_containerDescription, '
'${container.name} ${container.kind}, '
'for the Dart programming language.';
@override
List<Documentable> get navLinks => [_packageGraph.defaultPackage, library];
Expand Down Expand Up @@ -506,7 +497,7 @@ class TypedefTemplateData extends TemplateData<Typedef>
isDeprecated: typeDef.isDeprecated);
@override
String get metaDescription =>
'API docs for the ${typeDef.name} property from the '
'API docs for the ${typeDef.name} typedef from the '
'${library.name} library, for the Dart programming language.';
@override
List<Documentable> get navLinks => [_packageGraph.defaultPackage, library];
Expand Down