Skip to content

Adjust hierarchy for correct usage in mustache. #2370

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 2 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
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
11 changes: 7 additions & 4 deletions lib/src/generator/template_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class TemplateData<T extends Documentable> {
String get metaDescription;

List<Documentable> get navLinks;
List<Documentable> get navLinksWithGenerics => [];
List<Container> get navLinksWithGenerics => [];
Documentable get parent {
if (navLinksWithGenerics.isEmpty) {
return navLinks.isNotEmpty ? navLinks.last : null;
Expand All @@ -33,6 +33,8 @@ abstract class TemplateData<T extends Documentable> {

bool get hasHomepage => false;

String get homepage => null;

String get htmlBase;
T get self;
String get version => htmlOptions.toolVersion;
Expand Down Expand Up @@ -73,6 +75,7 @@ class PackageTemplateData extends TemplateData<Package> {

@override
bool get hasHomepage => package.hasHomepage;
@override
String get homepage => package.homepage;

/// empty for packages because they are at the root – not needed
Expand Down Expand Up @@ -235,7 +238,7 @@ class ConstructorTemplateData extends TemplateData<Constructor> {
@override
List<Documentable> get navLinks => [packageGraph.defaultPackage, library];
@override
List<Documentable> get navLinksWithGenerics => [clazz];
List<Container> get navLinksWithGenerics => [clazz];
@override
@override
String get htmlBase => '../../';
Expand Down Expand Up @@ -313,7 +316,7 @@ class MethodTemplateData extends TemplateData<Method> {
@override
List<Documentable> get navLinks => [packageGraph.defaultPackage, library];
@override
List<Documentable> get navLinksWithGenerics => [container];
List<Container> get navLinksWithGenerics => [container];
@override
String get htmlBase => '../../';
}
Expand Down Expand Up @@ -347,7 +350,7 @@ class PropertyTemplateData extends TemplateData<Field> {
@override
List<Documentable> get navLinks => [packageGraph.defaultPackage, library];
@override
List<Documentable> get navLinksWithGenerics => [container];
List<Container> get navLinksWithGenerics => [container];
@override
String get htmlBase => '../../';
}
Expand Down
4 changes: 1 addition & 3 deletions lib/src/model/category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Category extends Nameable
} else if (c is Extension) {
_extensions.add(c);
} else {
throw UnimplementedError('Unrecognized element');
throw UnimplementedError('Unrecognized element: $c (${c.runtimeType})');
}
}

Expand Down Expand Up @@ -147,8 +147,6 @@ class Category extends Nameable
@override
String get href => isCanonical ? '${package.baseHref}$filePath' : null;

@Deprecated(
'Public field is unused; will be removed as early as Dartdoc 1.0.0')
String get categoryLabel => _categoryRenderer.renderCategoryLabel(this);

@Deprecated(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/class.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import 'package:meta/meta.dart';
/// **instance**: As with [Container], but also includes inherited children.
/// **inherited**: Filtered getters giving only inherited children.
class Class extends Container
with TypeParameters, Categorization, ExtensionTarget
with Categorization, ExtensionTarget
implements EnclosedElement {
// TODO(srawlins): To make final, remove public getter, setter, rename to be
// public, and add `final` modifier.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import 'package:meta/meta.dart';
/// **has** : boolean getters indicating whether the underlying getters are
/// empty. Mostly for the templating system.
/// **all** : Referring to all children.
abstract class Container extends ModelElement {
abstract class Container extends ModelElement with TypeParameters {
Container(Element element, Library library, PackageGraph packageGraph)
: super(element, library, packageGraph, null);

Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:dartdoc/src/quiver.dart' as quiver;

/// Extension methods
class Extension extends Container
with TypeParameters, Categorization
with Categorization
implements EnclosedElement {
ElementType extendedType;

Expand Down