@@ -10,18 +10,23 @@ module.exports = function categorizer() {
1010 return {
1111 $runBefore : [ 'docs-processed' ] ,
1212 $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 ) ) ;
1414 }
1515 } ;
1616
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 ) {
1823 // Resolve all methods and properties from the classDoc. Includes inherited docs.
1924 classDoc . methods = resolveMethods ( classDoc ) ;
2025 classDoc . properties = resolveProperties ( classDoc ) ;
2126
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 ) ) ;
2530
2631 // Categorize the current visited classDoc into its Angular type.
2732 if ( isDirective ( classDoc ) ) {
@@ -34,14 +39,22 @@ module.exports = function categorizer() {
3439 }
3540 }
3641
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 ) {
3847 normalizeMethodParameters ( methodDoc ) ;
3948
4049 // Mark methods with a `void` return type so we can omit show the return type in the docs.
4150 methodDoc . showReturns = methodDoc . returnType && methodDoc . returnType != 'void' ;
4251 }
4352
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 ) {
4558 propertyDoc . isDirectiveInput = isDirectiveInput ( propertyDoc ) ;
4659 propertyDoc . directiveInputAlias = getDirectiveInputAlias ( propertyDoc ) ;
4760
0 commit comments