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