mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
tools: fix nits in tools/doc/preprocess.js
PR-URL: https://github.com/nodejs/node/pull/19473 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
1 parent
e1c28b6f46
commit
2fb47a5cbf
1 file changed
+7
-7
@@ -5,7 +5,7 @@ module.exports = preprocess;
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const includeExpr = /^@include\s+([A-Za-z0-9-_]+)(?:\.)?([a-zA-Z]*)$/gmi;
|
||||
const includeExpr = /^@include\s+[\w-]+\.?[a-zA-Z]*$/gmi;
|
||||
const includeData = {};
|
||||
|
||||
function preprocess(inputFile, input, cb) {
|
||||
@@ -20,12 +20,12 @@ function stripComments(input) {
|
||||
function processIncludes(inputFile, input, cb) {
|
||||
const includes = input.match(includeExpr);
|
||||
if (includes === null) return cb(null, input);
|
||||
var errState = null;
|
||||
var incCount = includes.length;
|
||||
if (incCount === 0) cb(null, input);
|
||||
includes.forEach(function(include) {
|
||||
var fname = include.replace(/^@include\s+/, '');
|
||||
if (!fname.match(/\.md$/)) fname = `${fname}.md`;
|
||||
let errState = null;
|
||||
let incCount = includes.length;
|
||||
|
||||
includes.forEach((include) => {
|
||||
let fname = include.replace(/^@include\s+/, '');
|
||||
if (!/\.md$/.test(fname)) fname = `${fname}.md`;
|
||||
|
||||
if (includeData.hasOwnProperty(fname)) {
|
||||
input = input.split(include).join(includeData[fname]);
|
||||
|
||||
Reference in new issue
Block a user