diff options
author | Karan Thakkar <karanjthakkar@gmail.com> | 2017-02-22 20:12:46 +0530 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-02-24 02:43:25 +0100 |
commit | 6ae159fa35b21c6abb478a99ea1c9e76813dba3b (patch) | |
tree | 5efb1d65c41b4cd41ca1817bcd36025ba2a46c75 /tools | |
parent | f385f77f1d011786cb1c5e80f257fa043f4c608b (diff) | |
download | node-new-6ae159fa35b21c6abb478a99ea1c9e76813dba3b.tar.gz |
doc: change broken fg(1) links to fg(1p)
The fg(1) links in the readline docs have moved
from `http://man7.org/linux/man-pages/man1/fg.1.html`
to `http://man7.org/linux/man-pages/man1/fg.1p.html`.
It also modifies the regex for replacing man page links
in docs by allowing optional character after number.
eg: fg(1) and fg(1p) will both be now parsed and replaced.
Fixes: https://github.com/nodejs/node/issues/11492
PR-URL: https://github.com/nodejs/node/pull/11504
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/doc/html.js | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/tools/doc/html.js b/tools/doc/html.js index bc5d3167f7..10b04a1b98 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -316,17 +316,19 @@ var BSD_ONLY_SYSCALLS = new Set(['lchmod']); // Returns modified text, with such refs replace with HTML links, for example // '<a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>' function linkManPages(text) { - return text.replace(/ ([a-z.]+)\((\d)\)/gm, function(match, name, number) { - // name consists of lowercase letters, number is a single digit - var displayAs = name + '(' + number + ')'; - if (BSD_ONLY_SYSCALLS.has(name)) { - return ' <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 + - '/' + name + '.' + number + '.html">' + displayAs + '</a>'; - } - }); + return text.replace( + / ([a-z.]+)\((\d)([a-z]?)\)/gm, + (match, name, number, optionalCharacter) => { + // name consists of lowercase letters, number is a single digit + var displayAs = `${name}(${number}${optionalCharacter})`; + if (BSD_ONLY_SYSCALLS.has(name)) { + return ` <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}` + + `/${name}.${number}${optionalCharacter}.html">${displayAs}</a>`; + } + }); } function linkJsTypeDocs(text) { |