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: https://github.com/nodejs/node/pull/17724
Fixes: https://github.com/nodejs/node/issues/17694
Refs: https://github.com/nodejs/node/pull/17479
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Diego Rodríguez Baquero authored and Gibson Fahnestock committed 2018-01-24 02:45:22 +00:00
1 parent 95cbf081e7
commit 90fe1692e2
1 file changed
+4 -4
+4 -4
View File
@@ -416,15 +416,15 @@ const BSD_ONLY_SYSCALLS = new Set(['lchmod']);
// '<a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>'
function linkManPages(text) {
return text.replace(
/\b([a-z.]+)\((\d)([a-z]?)\)/gm,
(match, name, number, optionalCharacter) => {
/(^|\s)([a-z.]+)\((\d)([a-z]?)\)/gm,
(match, beginning, name, number, optionalCharacter) => {
// name consists of lowercase letters, number is a single digit
const displayAs = `${name}(${number}${optionalCharacter})`;
if (BSD_ONLY_SYSCALLS.has(name)) {
return ` <a href="https://www.freebsd.org/cgi/man.cgi?query=${name}` +
return `${beginning}<a href="https://www.freebsd.org/cgi/man.cgi?query=${name}` +
`&sektion=${number}">${displayAs}</a>`;
} else {
return ` <a href="http://man7.org/linux/man-pages/man${number}` +
return `${beginning}<a href="http://man7.org/linux/man-pages/man${number}` +
`/${name}.${number}${optionalCharacter}.html">${displayAs}</a>`;
}
});