Skip to content

Commit

Permalink
doc: simplify linkModule parsing by moving into regex
Browse files Browse the repository at this point in the history
  • Loading branch information
foxxyz committed Jul 31, 2021
1 parent 91ee128 commit 849213e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tools/doc/allhtml.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ for (const link of toc.match(/<a.*?>/g)) {
return `<a href="#${moduleName}_${anchor}"`;
})
// Prefix all links to other docs modules with those module names
.replace(/<a href="(\w[^#"]*)#/g, (match, href) => {
.replace(/<a href="((\w[^#"]*)\.html)#/g, (match, href, linkModule) => {
if (!htmlFiles.includes(href)) return match;
const linkModule = href.replace(/\.html$/, '');
return `<a href="#${linkModule}_`;
})
.trim() + '\n';
Expand Down

0 comments on commit 849213e

Please sign in to comment.