2017-01-26 09:03:53 -05:00
|
|
|
var path = require('canonical-path');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dgService
|
|
|
|
* @description
|
|
|
|
* This file reader will pull the contents from a text file (by default .md)
|
|
|
|
*
|
|
|
|
* The doc will initially have the form:
|
|
|
|
* ```
|
|
|
|
* {
|
|
|
|
* content: 'the content of the file',
|
|
|
|
* startingLine: 1
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
module.exports = function contentFileReader() {
|
|
|
|
return {
|
|
|
|
name: 'contentFileReader',
|
|
|
|
defaultPattern: /\.md$/,
|
|
|
|
getDocs: function(fileInfo) {
|
|
|
|
|
|
|
|
// We return a single element array because content files only contain one document
|
2017-02-02 03:19:20 -05:00
|
|
|
return [{docType: 'content', content: fileInfo.content, startingLine: 1}];
|
2017-01-26 09:03:53 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|