★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/5e71d63bfeNouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files

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>
  • Loading branch information...
rubys authored and targos committed Jul 19, 2018
1 parent 5e562fd commit 5e71d63bfeb0bad179d6c2e18c66b3a3a21df2e4
Showing with 13 additions and 0 deletions.
  1. +13 −0 tools/doc/allhtml.js
@@ -73,3 +73,16 @@ all = all.slice(0, apiStart.index + apiStart[0].length) +

// Write results.
fs.writeFileSync(source + '/all.html', all, 'utf8');

// Validate all hrefs have a target.
const ids = new Set();
const idRe = / id="(\w+)"/g;
let match;
while (match = idRe.exec(all)) {
ids.add(match[1]);
}

const hrefRe = / href=/old?u=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fcommit%2F%26quot%23%28%3Cspan&y=1999 class="pl-c1">\w+)"/g;
while (match = hrefRe.exec(all)) {
if (!ids.has(match[1])) throw new Error(`link not found: ${match[1]}`);
}

0 comments on commit 5e71d63

Please sign in to comment.
You can’t perform that action at this time.