@@ -5,7 +5,7 @@ module.exports = preprocess;
55const path = require ( 'path' ) ;
66const fs = require ( 'fs' ) ;
77
8- const includeExpr = / ^ @ i n c l u d e \s + ( [ A - Z a - z 0 - 9 - _ ] + ) (?: \. ) ? ( [ a - z A - Z ] * ) $ / gmi;
8+ const includeExpr = / ^ @ i n c l u d e \s + [ \w - ] + \. ? [ a - z A - Z ] * $ / gmi;
99const includeData = { } ;
1010
1111function preprocess ( inputFile , input , cb ) {
@@ -20,12 +20,12 @@ function stripComments(input) {
2020function processIncludes ( inputFile , input , cb ) {
2121 const includes = input . match ( includeExpr ) ;
2222 if ( includes === null ) return cb ( null , input ) ;
23- var errState = null ;
24- var incCount = includes . length ;
25- if ( incCount === 0 ) cb ( null , input ) ;
26- includes . forEach ( function ( include ) {
27- var fname = include . replace ( / ^ @ i n c l u d e \s + / , '' ) ;
28- if ( ! fname . match ( / \. m d $ / ) ) fname = `${ fname } .md` ;
23+ let errState = null ;
24+ let incCount = includes . length ;
25+
26+ includes . forEach ( ( include ) => {
27+ let fname = include . replace ( / ^ @ i n c l u d e \s + / , '' ) ;
28+ if ( ! / \. m d $ / . test ( fname ) ) fname = `${ fname } .md` ;
2929
3030 if ( includeData . hasOwnProperty ( fname ) ) {
3131 input = input . split ( include ) . join ( includeData [ fname ] ) ;
0 commit comments