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