| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5e562fd commit 5e71d63
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -73,3 +73,16 @@ all = all.slice(0, apiStart.index + apiStart[0].length) + | |||
| 73 | 73 | ||
| 74 | 74 | // Write results. | |
| 75 | 75 | 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 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments