Skip to content

Commit 2fb47a5

Browse files
vsemozhetbytMylesBorins
authored andcommitted
tools: fix nits in tools/doc/preprocess.js
PR-URL: #19473 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent e1c28b6 commit 2fb47a5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎tools/doc/preprocess.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = preprocess;
55
constpath=require('path');
66
constfs=require('fs');
77

8-
constincludeExpr=/^@include\s+([A-Za-z0-9-_]+)(?:\.)?([a-zA-Z]*)$/gmi;
8+
constincludeExpr=/^@include\s+[\w-]+\.?[a-zA-Z]*$/gmi;
99
constincludeData={};
1010

1111
functionpreprocess(inputFile,input,cb){
@@ -20,12 +20,12 @@ function stripComments(input){
2020
functionprocessIncludes(inputFile,input,cb){
2121
constincludes=input.match(includeExpr);
2222
if(includes===null)returncb(null,input);
23-
varerrState=null;
24-
varincCount=includes.length;
25-
if(incCount===0)cb(null,input);
26-
includes.forEach(function(include){
27-
varfname=include.replace(/^@include\s+/,'');
28-
if(!fname.match(/\.md$/))fname=`${fname}.md`;
23+
leterrState=null;
24+
letincCount=includes.length;
25+
26+
includes.forEach((include)=>{
27+
letfname=include.replace(/^@include\s+/,'');
28+
if(!/\.md$/.test(fname))fname=`${fname}.md`;
2929

3030
if(includeData.hasOwnProperty(fname)){
3131
input=input.split(include).join(includeData[fname]);

0 commit comments

Comments
(0)