@@ -5,7 +5,7 @@ module.exports = preprocess;
5
5
const path = require ( 'path' ) ;
6
6
const fs = require ( 'fs' ) ;
7
7
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;
9
9
const includeData = { } ;
10
10
11
11
function preprocess ( inputFile , input , cb ) {
@@ -20,12 +20,12 @@ function stripComments(input) {
20
20
function processIncludes ( inputFile , input , cb ) {
21
21
const includes = input . match ( includeExpr ) ;
22
22
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` ;
29
29
30
30
if ( includeData . hasOwnProperty ( fname ) ) {
31
31
input = input . split ( include ) . join ( includeData [ fname ] ) ;
0 commit comments