Skip to content
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
17 changes: 17 additions & 0 deletions tools/dgeni/processors/categorizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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';
Expand All @@ -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. */
Expand Down Expand Up @@ -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] : '';
}
Expand Down
4 changes: 4 additions & 0 deletions tools/dgeni/templates/class.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ <h4 class="docs-api-h4 docs-api-class-name">
<span class="docs-api-class-export-name">{$ class.directiveExportAs $}</span>
{%- endif -%}

{%- if class.isDeprecated -%}
<div class="docs-api-class-deprecated-marker">Deprecated</div>
{%- endif -%}

{$ propertyList(class.properties) $}

{$ methodList(class.methods) $}
7 changes: 6 additions & 1 deletion tools/dgeni/templates/method.template.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<table class="docs-api-method-table">
<thead>
<tr class="docs-api-method-name-row">
<th colspan="2" class="docs-api-method-name-cell">{$ method.name $}</th>
<th colspan="2" class="docs-api-method-name-cell">
{%- if method.isDeprecated -%}
<div class="docs-api-deprecated-marker">Deprecated</div>
{%- endif -%}
{$ method.name $}
</th>
</tr>
</thead>
<tr class="docs-api-method-description-row">
Expand Down
3 changes: 3 additions & 0 deletions tools/dgeni/templates/property.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
{%- endif -%}
</div>
{%- endif -%}
{%- if property.isDeprecated -%}
<div class="docs-api-deprecated-marker">Deprecated</div>
{%- endif -%}

<p class="docs-api-property-name">
{$ property.name $}
Expand Down