Skip to content

Commit fa7d969

Browse files
TrottBethGriggs
authored andcommitted
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: #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>
1 parent 95e897e commit fa7d969

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

tools/doc/html.js

+1-13
Original file line numberDiff line numberDiff line change
@@ -313,23 +313,11 @@ function versionSort(a, b) {
313313

314314
function buildToc({ filename, apilinks }) {
315315
return (tree, file) => {
316-
const startIncludeRefRE = /^\s*<!-- \[start-include:(.+)\] -->\s*$/;
317-
const endIncludeRefRE = /^\s*<!-- \[end-include:.+\] -->\s*$/;
318-
const realFilenames = [filename];
319316
const idCounters = Object.create(null);
320317
let toc = '';
321318
let depth = 0;
322319

323320
visit(tree, null, (node) => {
324-
// Keep track of the current filename for comment wrappers of inclusions.
325-
if (node.type === 'html') {
326-
const [, includedFileName] = node.value.match(startIncludeRefRE) || [];
327-
if (includedFileName !== undefined)
328-
realFilenames.unshift(includedFileName);
329-
else if (endIncludeRefRE.test(node.value))
330-
realFilenames.shift();
331-
}
332-
333321
if (node.type !== 'heading') return;
334322

335323
if (node.depth - depth > 1) {
@@ -339,7 +327,7 @@ function buildToc({ filename, apilinks }) {
339327
}
340328

341329
depth = node.depth;
342-
const realFilename = path.basename(realFilenames[0], '.md');
330+
const realFilename = path.basename(filename, '.md');
343331
const headingText = file.contents.slice(
344332
node.children[0].position.start.offset,
345333
node.position.end.offset).trim();

0 commit comments

Comments
 (0)