awesome-cordova-plugins/scripts/docs/processors/npm-id.js

21 lines
525 B
JavaScript
Raw Normal View History

2017-03-24 10:07:59 +08:00
"use strict";
module.exports = function npmId(renderDocsProcessor) {
return {
name: 'npm-id',
$runAfter: ['paths-computed'],
$runBefore: ['rendering-docs'],
2017-03-24 10:07:59 +08:00
$process: docs => {
// pretty up and sort the docs object for menu generation
docs = docs.filter(function(doc) {
return (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page';
});
2017-03-24 10:07:59 +08:00
docs.forEach(doc => {
doc.npmId = doc.id.match(/plugins\/(.*)\/index/)[1];
});
return docs;
}
};
};