Skip to content

Commit f0134c9

Browse files
committed
chore(docs): show extends clauses for classes
Classes like `MatAnchor` in the button docs should indicate that those are extending the `MatButton` class. Clauses without any related Dgeni doc can be ignored, because no information for this is available (right now; e.g. `MatSlideToggleBase` with mixins)
1 parent 4efb70c commit f0134c9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tools/dgeni/processors/categorizer.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
isProperty,
2020
isService
2121
} from '../common/decorators';
22+
import {ClassLikeExportDoc} from 'dgeni-packages/typescript/api-doc-types/ClassLikeExportDoc';
2223
import {MethodMemberDoc} from 'dgeni-packages/typescript/api-doc-types/MethodMemberDoc';
2324
import {sortCategorizedMembers} from '../common/sort-members';
2425

@@ -31,6 +32,7 @@ export interface CategorizedClassDoc extends ClassExportDoc {
3132
isDeprecated: boolean;
3233
directiveExportAs?: string | null;
3334
directiveSelectors?: string[];
35+
extendedDocs: ClassLikeExportDoc[];
3436
}
3537

3638
export interface CategorizedPropertyMemberDoc extends PropertyMemberDoc {
@@ -88,6 +90,12 @@ export class Categorizer implements Processor {
8890
classDoc.methods.sort(sortCategorizedMembers);
8991
classDoc.properties.sort(sortCategorizedMembers);
9092

93+
// Filter the extends clauses for clauses with an associated Dgeni document. Clauses without
94+
// a document are unknown and should not be mentioned in the documentation for this class.
95+
classDoc.extendedDocs = classDoc.extendsClauses
96+
.filter(clause => clause.doc)
97+
.map(clause => clause.doc!);
98+
9199
// Categorize the current visited classDoc into its Angular type.
92100
if (isDirective(classDoc)) {
93101
classDoc.isDirective = true;

tools/dgeni/templates/class.template.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ <h4 class="docs-api-h4 docs-api-class-name">
66
<p class="docs-api-class-description">{$ class.description | safe $}</p>
77
{%- endif -%}
88

9+
{% if class.extendedDocs.length %}
10+
<p class="docs-api-class-extends-clauses">
11+
<span class="docs-api-class-extends-label">Extends:</span>
12+
{% for extendedDoc in class.extendedDocs %}
13+
<span class="docs-api-class-extends-type">{$ extendedDoc.name $}</span>
14+
{% endfor %}
15+
</p>
16+
{% endif %}
17+
918
{%- if class.directiveSelectors -%}
1019
<p class="docs-api-directive-selectors">
1120
<span class="docs-api-class-selector-label">Selector:</span>

0 commit comments

Comments
 (0)