Skip to content

Commit d93900c

Browse files
naaajiidevversion
authored andcommitted
build: update dgeni templates to include deprecated tag description
changes how deprecated fields are generated for docs content, before this commit deprecated related text was shown via `title` attribute on hover and the `deprecated` tag description was never shown unless user check it manually via code. this commit exports `deprecated` tag description to reflect it directly in docs using `material/tooltip` on doc site
1 parent ea0d1ba commit d93900c

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

tools/dgeni/common/decorators.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,19 @@ export function getBreakingChange(doc: ApiDoc): string | null {
8585
return breakingChange ? breakingChange.description : null;
8686
}
8787

88+
export function getDeprecationMessage(doc: ApiDoc): string | null {
89+
const deprecatedMessage = findJsDocTag(doc, 'deprecated');
90+
return deprecatedMessage ? deprecatedMessage.description : null;
91+
}
92+
8893
/**
8994
* Decorates public exposed docs. Creates a property on the doc that indicates whether
90-
* the item is deprecated or not.
95+
* the item is deprecated or not and set deprecation message.
9196
*/
9297
export function decorateDeprecatedDoc(doc: ApiDoc & DeprecationInfo) {
9398
doc.isDeprecated = isDeprecatedDoc(doc);
9499
doc.breakingChange = getBreakingChange(doc);
100+
doc.deprecatedMessage = getDeprecationMessage(doc);
95101

96102
if (doc.isDeprecated && !doc.breakingChange) {
97103
console.warn('Warning: There is a deprecated item without a @breaking-change tag.', doc.id);

tools/dgeni/common/dgeni-definitions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {NormalizedFunctionParameters} from './normalize-function-parameters';
1212
export interface DeprecationInfo {
1313
isDeprecated: boolean;
1414
breakingChange: string | null;
15+
deprecatedMessage: string | null;
1516
}
1617

1718
/** Interface that describes Dgeni documents that have decorators. */

tools/dgeni/templates/macros.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% macro deprecationTitle(doc) %}
2-
{%- if doc.breakingChange -%}
3-
title="Will be removed in v{$ doc.breakingChange $} or later"
2+
{%- if doc.breakingChange and doc.deprecatedMessage -%}
3+
deprecated-message="{$ doc.deprecatedMessage $} Will be removed in v{$ doc.breakingChange $} or later."
4+
{% else %}
5+
deprecated-message="{$ doc.deprecatedMessage $}"
46
{%- endif -%}
57
{% endmacro %}

0 commit comments

Comments
 (0)