GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tools: avoid generating duplicate id attributes · nodejs/node@c12cbf2

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tools/doc
    • allhtml.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tools/doc/allhtml.mjs‎

Copy file name to clipboardExpand all lines: tools/doc/allhtml.mjs
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,32 @@ for (const link of toc.match(/<a.*?>/g)) {
3838
.replace(/[\s\S]*?id="toc"[^>]*>\s*<\w+>.*?<\/\w+>\s*(<ul>\s*)?/, '')
3939
// Prefix TOC links with current module name
4040
.replace(/<a href="#(?!DEP[0-9]{4})([^"]+)"/g, (match, anchor) => {
41-
return `<a href="#${moduleName}_${anchor}"`;
41+
return `<a href="#all_${moduleName}_${anchor}"`;
4242
});
4343

4444
apicontent += '<section>' + data.slice(match.index + match[0].length)
4545
.replace(/<!-- API END -->[\s\S]*/, '</section>')
4646
// Prefix all in-page anchor marks with module name
4747
.replace(/<a class="mark" href="#([^"]+)" id="([^"]+)"/g, (match, anchor, id) => {
4848
if (anchor !== id) throw new Error(`Mark does not match: ${anchor} should match ${id}`);
49-
return `<a class="mark" href="#${moduleName}_${anchor}" id="${moduleName}_${anchor}"`;
49+
return `<a class="mark" href="#all_${moduleName}_${anchor}" id="all_${moduleName}_${anchor}"`;
5050
})
5151
// Prefix all in-page links with current module name
5252
.replace(/<a href="#(?!DEP[0-9]{4})([^"]+)"/g, (match, anchor) => {
53-
return `<a href="#${moduleName}_${anchor}"`;
53+
return `<a href="#all_${moduleName}_${anchor}"`;
5454
})
5555
// Update footnote id attributes on anchors
5656
.replace(/<a href="([^"]+)" id="(user-content-fn[^"]+)"/g, (match, href, id) => {
57-
return `<a href="${href}" id="${moduleName}_${id}"`;
57+
return `<a href="${href}" id="all_${moduleName}_${id}"`;
5858
})
5959
// Update footnote id attributes on list items
60-
.replace(/<(\S+) id="(user-content-fn-\d+)"/g, (match, tagName, id) => {
61-
return `<${tagName} id="${moduleName}_${id}"`;
60+
.replace(/<(\S+) id="(user-content-fn[^"]+)"/g, (match, tagName, id) => {
61+
return `<${tagName} id="all_${moduleName}_${id}"`;
6262
})
6363
// Prefix all links to other docs modules with those module names
6464
.replace(/<a href="((\w[^#"]*)\.html)#/g, (match, href, linkModule) => {
6565
if (!htmlFiles.includes(href)) return match;
66-
return `<a href="#${linkModule}_`;
66+
return `<a href="#all_${linkModule}_`;
6767
})
6868
.trim() + '\n';
6969

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.