Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMattia Pontonio <44380480+mattiapontonio@users.noreply.github.com>2021-01-12 18:29:21 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-01-22 01:48:04 +0300
commitf99b38fedd62e4eb088c2fb089d16a1c87cd8101 (patch)
treefc4dcf9904faba371ea7efab2d7bd770f136dd17 /tools
parent1149af626578fbaf16c5ddf7cd06ee5ba57bff99 (diff)
doc: wrap TOC in a <details> tag
PR-URL: https://github.com/nodejs/node/pull/36896 Fixes: https://github.com/nodejs/node/issues/36885 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/doc/allhtml.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/doc/allhtml.js b/tools/doc/allhtml.js
index c038b1f57a9..5a24cee4292 100644
--- a/tools/doc/allhtml.js
+++ b/tools/doc/allhtml.js
@@ -31,10 +31,10 @@ for (const link of toc.match(/<a.*?>/g)) {
const data = fs.readFileSync(source + '/' + href, 'utf8');
// Split the doc.
- const match = /(<\/ul>\s*)?<\/div>\s*<div id="apicontent">/.exec(data);
+ const match = /(<\/ul>\s*)?<\/\w+>\s*<\w+ id="apicontent">/.exec(data);
contents += data.slice(0, match.index)
- .replace(/[\s\S]*?<div id="toc">\s*<h2>.*?<\/h2>\s*(<ul>\s*)?/, '');
+ .replace(/[\s\S]*?id="toc"[^>]*>\s*<\w+>.*?<\/\w+>\s*(<ul>\s*)?/, '');
apicontent += data.slice(match.index + match[0].length)
.replace(/<!-- API END -->[\s\S]*/, '')
@@ -59,13 +59,13 @@ let all = toc.replace(/index\.html/g, 'all.html')
all = all.replace(/<title>.*?\| /, '<title>');
// Insert the combined table of contents.
-const tocStart = /<div id="toc">\s*<h2>.*?<\/h2>\s*/.exec(all);
+const tocStart = /<\w+ id="toc"[^>]*>\s*<\w+>.*?<\/\w+>\s*/.exec(all);
all = all.slice(0, tocStart.index + tocStart[0].length) +
'<ul>\n' + contents + '</ul>\n' +
all.slice(tocStart.index + tocStart[0].length);
// Replace apicontent with the concatenated set of apicontents from each source.
-const apiStart = /<div id="apicontent">\s*/.exec(all);
+const apiStart = /<\w+ id="apicontent">\s*/.exec(all);
const apiEnd = all.lastIndexOf('<!-- API END -->');
all = all.slice(0, apiStart.index + apiStart[0].length) +
apicontent +