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>
This commit is contained in:
Karan Thakkar 2017-02-22 20:12:46 +05:30 committed by Anna Henningsen
parent f385f77f1d
commit 6ae159fa35
No known key found for this signature in database
GPG Key ID: D8B9F5AEAE84E4CF
5 changed files with 24 additions and 19 deletions

View File

@ -124,7 +124,7 @@ added: v0.7.5
The `'SIGCONT'` event is emitted when a Node.js process previously moved into The `'SIGCONT'` event is emitted when a Node.js process previously moved into
the background using `<ctrl>-Z` (i.e. `SIGTSTP`) is then brought back to the the background using `<ctrl>-Z` (i.e. `SIGTSTP`) is then brought back to the
foreground using fg(1). foreground using fg(1p).
If the `input` stream was paused *before* the `SIGTSTP` request, this event will If the `input` stream was paused *before* the `SIGTSTP` request, this event will
not be emitted. not be emitted.
@ -174,7 +174,7 @@ input, typically known as `SIGTSTP`. If there are no `SIGTSTP` event listeners
registered when the `input` stream receives a `SIGTSTP`, the Node.js process registered when the `input` stream receives a `SIGTSTP`, the Node.js process
will be sent to the background. will be sent to the background.
When the program is resumed using fg(1), the `'pause'` and `SIGCONT` events When the program is resumed using fg(1p), the `'pause'` and `SIGCONT` events
will be emitted. These can be used to resume the `input` stream. will be emitted. These can be used to resume the `input` stream.
The `'pause'` and `'SIGCONT'` events will not be emitted if the `input` was The `'pause'` and `'SIGCONT'` events will not be emitted if the `input` was

View File

@ -56,13 +56,16 @@ const testData = [
'<tr><td>v4.2.0</td><td><p>The <code>error</code> parameter can now be' + '<tr><td>v4.2.0</td><td><p>The <code>error</code> parameter can now be' +
'an arrow function.</p></td></tr></table></details>' + 'an arrow function.</p></td></tr></table></details>' +
'</div> ' + '</div> ' +
'<p>Describe <code>Foobar II</code> in more detail here.</p>' + '<p>Describe <code>Foobar II</code> in more detail here.' +
'<a href="http://man7.org/linux/man-pages/man1/fg.1.html">fg(1)</a></p>' +
'<h2>Deprecated thingy<span><a class="mark" ' + '<h2>Deprecated thingy<span><a class="mark" ' +
'href="#foo_deprecated_thingy" id="foo_deprecated_thingy">#</a>' + 'href="#foo_deprecated_thingy" id="foo_deprecated_thingy">#</a>' +
'</span></h2>' + '</span></h2>' +
'<div class="api_metadata"><span>Added in: v1.0.0</span>' + '<div class="api_metadata"><span>Added in: v1.0.0</span>' +
'<span>Deprecated since: v2.0.0</span></div><p>Describe ' + '<span>Deprecated since: v2.0.0</span></div><p>Describe ' +
'<code>Deprecated thingy</code> in more detail here.</p>' + '<code>Deprecated thingy</code> in more detail here.' +
'<a href="http://man7.org/linux/man-pages/man1/fg.1p.html">fg(1p)</a>' +
'</p>' +
'<h2>Something<span><a class="mark" href="#foo_something" ' + '<h2>Something<span><a class="mark" href="#foo_something" ' +
'id="foo_something">#</a></span></h2> ' + 'id="foo_something">#</a></span></h2> ' +
'<!-- This is not a metadata comment --> ' + '<!-- This is not a metadata comment --> ' +

View File

@ -111,7 +111,7 @@ const testData = [
] ]
}, },
desc: '<p>Describe <code>Foobar II</code> in more detail ' + desc: '<p>Describe <code>Foobar II</code> in more detail ' +
'here.</p>\n', 'here. fg(1)</p>\n',
type: 'module', type: 'module',
displayName: 'Foobar II' displayName: 'Foobar II'
}, },
@ -124,7 +124,7 @@ const testData = [
changes: [] changes: []
}, },
desc: '<p>Describe <code>Deprecated thingy</code> in more ' + desc: '<p>Describe <code>Deprecated thingy</code> in more ' +
'detail here.</p>\n', 'detail here. fg(1p)</p>\n',
type: 'module', type: 'module',
displayName: 'Deprecated thingy' displayName: 'Deprecated thingy'
}, },

View File

@ -18,7 +18,7 @@ changes:
description: The `error` parameter can now be an arrow function. description: The `error` parameter can now be an arrow function.
--> -->
Describe `Foobar II` in more detail here. Describe `Foobar II` in more detail here. fg(1)
## Deprecated thingy ## Deprecated thingy
<!-- YAML <!-- YAML
@ -26,7 +26,7 @@ added: v1.0.0
deprecated: v2.0.0 deprecated: v2.0.0
--> -->
Describe `Deprecated thingy` in more detail here. Describe `Deprecated thingy` in more detail here. fg(1p)
## Something ## Something
<!-- This is not a metadata comment --> <!-- This is not a metadata comment -->

View File

@ -316,17 +316,19 @@ var BSD_ONLY_SYSCALLS = new Set(['lchmod']);
// Returns modified text, with such refs replace with HTML links, for example // 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>' // '<a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>'
function linkManPages(text) { function linkManPages(text) {
return text.replace(/ ([a-z.]+)\((\d)\)/gm, function(match, name, number) { return text.replace(
// name consists of lowercase letters, number is a single digit / ([a-z.]+)\((\d)([a-z]?)\)/gm,
var displayAs = name + '(' + number + ')'; (match, name, number, optionalCharacter) => {
if (BSD_ONLY_SYSCALLS.has(name)) { // name consists of lowercase letters, number is a single digit
return ' <a href="https://www.freebsd.org/cgi/man.cgi?query=' + name + var displayAs = `${name}(${number}${optionalCharacter})`;
'&sektion=' + number + '">' + displayAs + '</a>'; if (BSD_ONLY_SYSCALLS.has(name)) {
} else { return ` <a href="https://www.freebsd.org/cgi/man.cgi?query=${name}` +
return ' <a href="http://man7.org/linux/man-pages/man' + number + `&sektion=${number}">${displayAs}</a>`;
'/' + name + '.' + number + '.html">' + displayAs + '</a>'; } else {
} return ` <a href="http://man7.org/linux/man-pages/man${number}` +
}); `/${name}.${number}${optionalCharacter}.html">${displayAs}</a>`;
}
});
} }
function linkJsTypeDocs(text) { function linkJsTypeDocs(text) {