tools: remove unused code in doc generation tool

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 <franziska.hinkelmann@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Rich Trott 2020-04-18 05:22:07 -07:00 committed by Ruben Bridgewater
parent 015f33cf55
commit c402edd60f

View File

@ -313,23 +313,11 @@ function versionSort(a, b) {
function buildToc({ filename, apilinks }) {
return (tree, file) => {
const startIncludeRefRE = /^\s*<!-- \[start-include:(.+)\] -->\s*$/;
const endIncludeRefRE = /^\s*<!-- \[end-include:.+\] -->\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();