Files
angular.js/docs/config/processors/index-page.js
T
Michał Gołębiowski b1bc25169e chore(*): switch from JSHint/JSCS to ESLint
Partially cherry-picked from c3220325a0

Ref #14952

Closes #14993
2016-08-08 13:53:52 +03:00

43 lines
988 B
JavaScript

"use strict";
var _ = require('lodash');
/**
* @dgProcessor generateIndexPagesProcessor
* @description
* This processor creates docs that will be rendered as the index page for the app
*/
module.exports = function generateIndexPagesProcessor() {
return {
deployments: [],
$validate: {
deployments: { presence: true }
},
$runAfter: ['adding-extra-docs'],
$runBefore: ['extra-docs-added'],
$process: function(docs) {
// Collect up all the areas in the docs
var areas = {};
docs.forEach(function(doc) {
if (doc.area) {
areas[doc.area] = doc.area;
}
});
areas = _.keys(areas);
this.deployments.forEach(function(deployment) {
var indexDoc = _.defaults({
docType: 'indexPage',
areas: areas
}, deployment);
indexDoc.id = 'index' + (deployment.name === 'default' ? '' : '-' + deployment.name);
docs.push(indexDoc);
});
}
};
};