2017-02-21 11:57:19 -05:00
|
|
|
module.exports = function convertToJsonProcessor() {
|
|
|
|
|
|
|
|
return {
|
|
|
|
$runAfter: ['checkUnbalancedBackTicks'],
|
|
|
|
$runBefore: ['writeFilesProcessor'],
|
|
|
|
docTypes: [],
|
|
|
|
$process: function(docs) {
|
|
|
|
const docTypes = this.docTypes
|
|
|
|
docs.forEach((doc) => {
|
|
|
|
if (docTypes.indexOf(doc.docType) !== -1) {
|
|
|
|
const output = {
|
|
|
|
title: doc.title || doc.name,
|
2017-03-01 06:23:12 -05:00
|
|
|
contents: doc.renderedContent
|
2017-02-21 11:57:19 -05:00
|
|
|
};
|
|
|
|
doc.renderedContent = JSON.stringify(output, null, 2);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|