@@ -316,17 +316,19 @@ var BSD_ONLY_SYSCALLS = new Set(['lchmod']);
316
316
// Returns modified text, with such refs replace with HTML links, for example
317
317
// '<a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>'
318
318
function linkManPages ( text ) {
319
- return text . replace ( / ( [ a - z . ] + ) \( ( \d ) \) / gm, function ( match , name , number ) {
320
- // name consists of lowercase letters, number is a single digit
321
- var displayAs = name + '(' + number + ')' ;
322
- if ( BSD_ONLY_SYSCALLS . has ( name ) ) {
323
- return ' <a href="https://www.freebsd.org/cgi/man.cgi?query=' + name +
324
- '&sektion=' + number + '">' + displayAs + '</a>' ;
325
- } else {
326
- return ' <a href="http://man7.org/linux/man-pages/man' + number +
327
- '/' + name + '.' + number + '.html">' + displayAs + '</a>' ;
328
- }
329
- } ) ;
319
+ return text . replace (
320
+ / ( [ a - z . ] + ) \( ( \d ) ( [ a - z ] ? ) \) / gm,
321
+ ( match , name , number , optionalCharacter ) => {
322
+ // name consists of lowercase letters, number is a single digit
323
+ var displayAs = `${ name } (${ number } ${ optionalCharacter } )` ;
324
+ if ( BSD_ONLY_SYSCALLS . has ( name ) ) {
325
+ return ` <a href="https://www.freebsd.org/cgi/man.cgi?query=${ name } ` +
326
+ `&sektion=${ number } ">${ displayAs } </a>` ;
327
+ } else {
328
+ return ` <a href="http://man7.org/linux/man-pages/man${ number } ` +
329
+ `/${ name } .${ number } ${ optionalCharacter } .html">${ displayAs } </a>` ;
330
+ }
331
+ } ) ;
330
332
}
331
333
332
334
function linkJsTypeDocs ( text ) {
0 commit comments