Skip to content

Commit

Permalink
tools: fix man pages linking regex
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
DiegoRBaquero authored and maclover7 committed Dec 22, 2017
1 parent 4d1baf8 commit 66e6aff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/doc/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>`;
}
});
Expand Down

0 comments on commit 66e6aff

Please sign in to comment.