diff --git a/tools/dgeni/processors/categorizer.js b/tools/dgeni/processors/categorizer.js index 1644f29158f4..b515e5a026c5 100644 --- a/tools/dgeni/processors/categorizer.js +++ b/tools/dgeni/processors/categorizer.js @@ -28,6 +28,8 @@ module.exports = function categorizer() { classDoc.methods.forEach(doc => decorateMethodDoc(doc)); classDoc.properties.forEach(doc => decoratePropertyDoc(doc)); + decoratePublicDoc(classDoc); + // Categorize the current visited classDoc into its Angular type. if (isDirective(classDoc)) { classDoc.isDirective = true; @@ -45,6 +47,7 @@ module.exports = function categorizer() { */ function decorateMethodDoc(methodDoc) { normalizeMethodParameters(methodDoc); + decoratePublicDoc(methodDoc); // Mark methods with a `void` return type so we can omit show the return type in the docs. methodDoc.showReturns = methodDoc.returnType && methodDoc.returnType != 'void'; @@ -55,12 +58,22 @@ module.exports = function categorizer() { * outputs will be marked. Aliases for the inputs or outputs will be stored as well. */ function decoratePropertyDoc(propertyDoc) { + decoratePublicDoc(propertyDoc); + propertyDoc.isDirectiveInput = isDirectiveInput(propertyDoc); propertyDoc.directiveInputAlias = getDirectiveInputAlias(propertyDoc); propertyDoc.isDirectiveOutput = isDirectiveOutput(propertyDoc); propertyDoc.directiveOutputAlias = getDirectiveOutputAlias(propertyDoc); } + + /** + * Decorates public exposed docs. Creates a property on the doc that indicates whether + * the item is deprecated or not. + **/ + function decoratePublicDoc(doc) { + doc.isDeprecated = isDeprecatedDoc(doc); + } }; /** Function that walks through all inherited docs and collects public methods. */ @@ -146,6 +159,10 @@ function isDirectiveInput(doc) { return hasMemberDecorator(doc, 'Input'); } +function isDeprecatedDoc(doc) { + return (doc.tags && doc.tags.tags || []).some(tag => tag.tagName === 'deprecated'); +} + function getDirectiveInputAlias(doc) { return isDirectiveInput(doc) ? doc.decorators.find(d => d.name == 'Input').arguments[0] : ''; } diff --git a/tools/dgeni/templates/class.template.html b/tools/dgeni/templates/class.template.html index 5ad1b3979f36..f23c5d4e4d86 100644 --- a/tools/dgeni/templates/class.template.html +++ b/tools/dgeni/templates/class.template.html @@ -8,6 +8,10 @@

{$ class.directiveExportAs $} {%- endif -%} +{%- if class.isDeprecated -%} +
Deprecated
+{%- endif -%} + {$ propertyList(class.properties) $} {$ methodList(class.methods) $} diff --git a/tools/dgeni/templates/method.template.html b/tools/dgeni/templates/method.template.html index 5bad88f5a22a..eeb7373d0852 100644 --- a/tools/dgeni/templates/method.template.html +++ b/tools/dgeni/templates/method.template.html @@ -1,7 +1,12 @@ - + diff --git a/tools/dgeni/templates/property.template.html b/tools/dgeni/templates/property.template.html index eecb2019b35f..2d17ace86d83 100644 --- a/tools/dgeni/templates/property.template.html +++ b/tools/dgeni/templates/property.template.html @@ -18,6 +18,9 @@ {%- endif -%} {%- endif -%} + {%- if property.isDeprecated -%} +
Deprecated
+ {%- endif -%}

{$ property.name $}

{$ method.name $} + {%- if method.isDeprecated -%} +
Deprecated
+ {%- endif -%} + {$ method.name $} +