@@ -10,18 +10,23 @@ module.exports = function categorizer() {
10
10
return {
11
11
$runBefore : [ 'docs-processed' ] ,
12
12
$process : function ( docs ) {
13
- docs . filter ( doc => doc . docType === 'class' ) . forEach ( doc => visitClassDoc ( doc ) ) ;
13
+ docs . filter ( doc => doc . docType === 'class' ) . forEach ( doc => decorateClassDoc ( doc ) ) ;
14
14
}
15
15
} ;
16
16
17
- function visitClassDoc ( classDoc ) {
17
+ /**
18
+ * Decorates all class docs inside of the dgeni pipeline.
19
+ * - Methods and properties of a class-doc will be extracted into separate variables.
20
+ * - Identifies directives, services or NgModules and marks them them in class-doc.
21
+ **/
22
+ function decorateClassDoc ( classDoc ) {
18
23
// Resolve all methods and properties from the classDoc. Includes inherited docs.
19
24
classDoc . methods = resolveMethods ( classDoc ) ;
20
25
classDoc . properties = resolveProperties ( classDoc ) ;
21
26
22
- // Call visit hooks that can modify the method and property docs.
23
- classDoc . methods . forEach ( doc => visitMethodDoc ( doc ) ) ;
24
- classDoc . properties . forEach ( doc => visitPropertyDoc ( doc ) ) ;
27
+ // Call decorate hooks that can modify the method and property docs.
28
+ classDoc . methods . forEach ( doc => decorateMethodDoc ( doc ) ) ;
29
+ classDoc . properties . forEach ( doc => decoratePropertyDoc ( doc ) ) ;
25
30
26
31
// Categorize the current visited classDoc into its Angular type.
27
32
if ( isDirective ( classDoc ) ) {
@@ -34,14 +39,22 @@ module.exports = function categorizer() {
34
39
}
35
40
}
36
41
37
- function visitMethodDoc ( methodDoc ) {
42
+ /**
43
+ * Method that will be called for each method doc. The parameters for the method-docs
44
+ * will be normalized, so that they can be easily used inside of dgeni templates.
45
+ **/
46
+ function decorateMethodDoc ( methodDoc ) {
38
47
normalizeMethodParameters ( methodDoc ) ;
39
48
40
49
// Mark methods with a `void` return type so we can omit show the return type in the docs.
41
50
methodDoc . showReturns = methodDoc . returnType && methodDoc . returnType != 'void' ;
42
51
}
43
52
44
- function visitPropertyDoc ( propertyDoc ) {
53
+ /**
54
+ * Method that will be called for each property doc. Properties that are Angular inputs or
55
+ * outputs will be marked. Aliases for the inputs or outputs will be stored as well.
56
+ **/
57
+ function decoratePropertyDoc ( propertyDoc ) {
45
58
propertyDoc . isDirectiveInput = isDirectiveInput ( propertyDoc ) ;
46
59
propertyDoc . directiveInputAlias = getDirectiveInputAlias ( propertyDoc ) ;
47
60
0 commit comments