2015-08-03 20:45:58 -04:00
|
|
|
/**
|
2015-11-04 05:47:05 -05:00
|
|
|
* dgProcessor
|
2015-08-03 20:45:58 -04:00
|
|
|
* @description
|
|
|
|
*
|
|
|
|
*/
|
2015-11-04 05:47:05 -05:00
|
|
|
module.exports = function renderAsMarkdownProcessor() {
|
2015-08-03 20:45:58 -04:00
|
|
|
return {
|
|
|
|
$runAfter: ['readFilesProcessor'],
|
|
|
|
$runBefore: ['writing-files'],
|
|
|
|
$process: function(docs) {
|
|
|
|
return docs.map(function(doc) {
|
|
|
|
var fileInfo = doc.fileInfo;
|
|
|
|
doc.renderedContent = '```\n' + doc.content + '\n```';
|
|
|
|
var regionSuffix = (doc.regionName && doc.regionName.length) ? "-" + doc.regionName.trim() : "";
|
|
|
|
var origName = fileInfo.baseName + "." + fileInfo.extension;
|
|
|
|
|
|
|
|
var newName = fileInfo.baseName + regionSuffix + "." + fileInfo.extension + ".md";
|
|
|
|
doc.outputPath = fileInfo.relativePath.replace(origName, newName);
|
|
|
|
return doc;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|