Skip to content

Commit 7ef876d

Browse files
DiegoRBaqueroMylesBorins
authored andcommitted
tools: fix man pages linking regex
The change to word boundary was breaking many doc pages. This reverts the word boundary back to space. PR-URL: #17724 Fixes: #17694 Refs: #17479 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 8f3b2d7 commit 7ef876d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/doc/html.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -416,15 +416,15 @@ const BSD_ONLY_SYSCALLS = new Set(['lchmod']);
416416
// '<a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>'
417417
function linkManPages(text) {
418418
return text.replace(
419-
/\b([a-z.]+)\((\d)([a-z]?)\)/gm,
420-
(match, name, number, optionalCharacter) => {
419+
/(^|\s)([a-z.]+)\((\d)([a-z]?)\)/gm,
420+
(match, beginning, name, number, optionalCharacter) => {
421421
// name consists of lowercase letters, number is a single digit
422422
const displayAs = `${name}(${number}${optionalCharacter})`;
423423
if (BSD_ONLY_SYSCALLS.has(name)) {
424-
return ` <a href="https://www.freebsd.org/cgi/man.cgi?query=${name}` +
424+
return `${beginning}<a href="https://www.freebsd.org/cgi/man.cgi?query=${name}` +
425425
`&sektion=${number}">${displayAs}</a>`;
426426
} else {
427-
return ` <a href="http://man7.org/linux/man-pages/man${number}` +
427+
return `${beginning}<a href="http://man7.org/linux/man-pages/man${number}` +
428428
`/${name}.${number}${optionalCharacter}.html">${displayAs}</a>`;
429429
}
430430
});

0 commit comments

Comments
 (0)