From fa7d96923741ce3ced74138d5068ccf01b3b3473 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 18 Apr 2020 05:22:07 -0700 Subject: [PATCH] tools: remove unused code in doc generation tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tools/doc/html.js includes code that looks for comments with `start-include` and `end-include` for file inclusion. This seems to be legacy code that is no longer used. The code only appears in the table-of-contents generation function. The strings `start-include` and `end-include` appear nowhere else in our tools and nowhere at all in our docs. PR-URL: https://github.com/nodejs/node/pull/32913 Reviewed-By: Franziska Hinkelmann Reviewed-By: Luigi Pinca Reviewed-By: Juan José Arboleda Reviewed-By: Trivikram Kamat Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- tools/doc/html.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index acd62c3e8d0ddb..b58563045def8d 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -313,23 +313,11 @@ function versionSort(a, b) { function buildToc({ filename, apilinks }) { return (tree, file) => { - const startIncludeRefRE = /^\s*\s*$/; - const endIncludeRefRE = /^\s*\s*$/; - const realFilenames = [filename]; const idCounters = Object.create(null); let toc = ''; let depth = 0; visit(tree, null, (node) => { - // Keep track of the current filename for comment wrappers of inclusions. - if (node.type === 'html') { - const [, includedFileName] = node.value.match(startIncludeRefRE) || []; - if (includedFileName !== undefined) - realFilenames.unshift(includedFileName); - else if (endIncludeRefRE.test(node.value)) - realFilenames.shift(); - } - if (node.type !== 'heading') return; if (node.depth - depth > 1) { @@ -339,7 +327,7 @@ function buildToc({ filename, apilinks }) { } depth = node.depth; - const realFilename = path.basename(realFilenames[0], '.md'); + const realFilename = path.basename(filename, '.md'); const headingText = file.contents.slice( node.children[0].position.start.offset, node.position.end.offset).trim();