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

26 lines
858 B
JavaScript
Raw Normal View History

module.exports = function npmId(renderDocsProcessor) {
return {
name: 'npm-id',
$runAfter: ['paths-computed'],
2017-03-24 03:18:35 +08:00
$runBefore: ['jekyll'],
$process: function(docs) {
var currentVersion = renderDocsProcessor.extraData.version.current.name;
// pretty up and sort the docs object for menu generation
docs = docs.filter(function(doc) {
return (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page';
});
docs.forEach(function(doc, i) {
doc.npmId = doc.outputPath.replace('/README.md', '') // for readmes
.replace('@ionic-native/plugins/','') // for readmes
.replace('content/docs/v2/native/', '') // for docs
.replace('/index.md', ''); // for docs
});
// returning docs will replace docs object in the next process
return docs;
}
};
};