Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5e71d63

Browse filesBrowse files
rubystargos
authored andcommitted
tools: validate apidoc links
PR-URL: #21889 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 5e562fd commit 5e71d63
Copy full SHA for 5e71d63

File tree

Expand file treeCollapse file tree

1 file changed

+13
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-0
lines changed
Open diff view settings
Collapse file

‎tools/doc/allhtml.js‎

Copy file name to clipboardExpand all lines: tools/doc/allhtml.js
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,16 @@ all = all.slice(0, apiStart.index + apiStart[0].length) +
7373

7474
// Write results.
7575
fs.writeFileSync(source + '/all.html', all, 'utf8');
76+
77+
// Validate all hrefs have a target.
78+
const ids = new Set();
79+
const idRe = / id="(\w+)"/g;
80+
let match;
81+
while (match = idRe.exec(all)) {
82+
ids.add(match[1]);
83+
}
84+
85+
const hrefRe = / href="#(\w+)"/g;
86+
while (match = hrefRe.exec(all)) {
87+
if (!ids.has(match[1])) throw new Error(`link not found: ${match[1]}`);
88+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.