@@ -28,6 +28,8 @@ module.exports = function categorizer() {
28
28
classDoc . methods . forEach ( doc => decorateMethodDoc ( doc ) ) ;
29
29
classDoc . properties . forEach ( doc => decoratePropertyDoc ( doc ) ) ;
30
30
31
+ decoratePublicDoc ( classDoc ) ;
32
+
31
33
// Categorize the current visited classDoc into its Angular type.
32
34
if ( isDirective ( classDoc ) ) {
33
35
classDoc . isDirective = true ;
@@ -45,6 +47,7 @@ module.exports = function categorizer() {
45
47
**/
46
48
function decorateMethodDoc ( methodDoc ) {
47
49
normalizeMethodParameters ( methodDoc ) ;
50
+ decoratePublicDoc ( methodDoc ) ;
48
51
49
52
// Mark methods with a `void` return type so we can omit show the return type in the docs.
50
53
methodDoc . showReturns = methodDoc . returnType && methodDoc . returnType != 'void' ;
@@ -55,12 +58,25 @@ module.exports = function categorizer() {
55
58
* outputs will be marked. Aliases for the inputs or outputs will be stored as well.
56
59
**/
57
60
function decoratePropertyDoc ( propertyDoc ) {
61
+ decoratePublicDoc ( propertyDoc ) ;
62
+
58
63
propertyDoc . isDirectiveInput = isDirectiveInput ( propertyDoc ) ;
59
64
propertyDoc . directiveInputAlias = getDirectiveInputAlias ( propertyDoc ) ;
60
65
61
66
propertyDoc . isDirectiveOutput = isDirectiveOutput ( propertyDoc ) ;
62
67
propertyDoc . directiveOutputAlias = getDirectiveOutputAlias ( propertyDoc ) ;
63
68
}
69
+
70
+ /**
71
+ * Decorates public exposed docs. Creates a property with CSS classes that will be
72
+ * added to the template.
73
+ **/
74
+ function decoratePublicDoc ( doc ) {
75
+ // Specific classes that will can added to the Dgeni doc template.
76
+ doc . docClasses = [
77
+ isDeprecatedDoc ( doc ) ? 'docs-api-deprecated' : ''
78
+ ] . join ( ' ' ) ;
79
+ }
64
80
} ;
65
81
66
82
/** Function that walks through all inherited docs and collects public methods. */
@@ -146,6 +162,10 @@ function isDirectiveInput(doc) {
146
162
return hasMemberDecorator ( doc , 'Input' ) ;
147
163
}
148
164
165
+ function isDeprecatedDoc ( doc ) {
166
+ return ( doc . tags && doc . tags . tags || [ ] ) . some ( tag => tag . tagName === 'deprecated' ) ;
167
+ }
168
+
149
169
function getDirectiveInputAlias ( doc ) {
150
170
return isDirectiveInput ( doc ) ? doc . decorators . find ( d => d . name == 'Input' ) . arguments [ 0 ] : '' ;
151
171
}
0 commit comments