Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: remove unused code in doc generation tool #32913

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions tools/doc/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand Down