Skip to content

Commit 47034e1

Browse files
karanjthakkaraddaleax
authored andcommitted
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: #11492 PR-URL: #11504 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent 47dc566 commit 47034e1

File tree

5 files changed

+24
-19
lines changed

5 files changed

+24
-19
lines changed

doc/api/readline.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ added: v0.7.5
124124

125125
The `'SIGCONT'` event is emitted when a Node.js process previously moved into
126126
the background using `<ctrl>-Z` (i.e. `SIGTSTP`) is then brought back to the
127-
foreground using fg(1).
127+
foreground using fg(1p).
128128

129129
If the `input` stream was paused *before* the `SIGTSTP` request, this event will
130130
not be emitted.
@@ -174,7 +174,7 @@ input, typically known as `SIGTSTP`. If there are no `SIGTSTP` event listeners
174174
registered when the `input` stream receives a `SIGTSTP`, the Node.js process
175175
will be sent to the background.
176176

177-
When the program is resumed using fg(1), the `'pause'` and `SIGCONT` events
177+
When the program is resumed using fg(1p), the `'pause'` and `SIGCONT` events
178178
will be emitted. These can be used to resume the `input` stream.
179179

180180
The `'pause'` and `'SIGCONT'` events will not be emitted if the `input` was

test/doctool/test-doctool-html.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,16 @@ const testData = [
5656
'<tr><td>v4.2.0</td><td><p>The <code>error</code> parameter can now be' +
5757
'an arrow function.</p></td></tr></table></details>' +
5858
'</div> ' +
59-
'<p>Describe <code>Foobar II</code> in more detail here.</p>' +
59+
'<p>Describe <code>Foobar II</code> in more detail here.' +
60+
'<a href="http://man7.org/linux/man-pages/man1/fg.1.html">fg(1)</a></p>' +
6061
'<h2>Deprecated thingy<span><a class="mark" ' +
6162
'href="#foo_deprecated_thingy" id="foo_deprecated_thingy">#</a>' +
6263
'</span></h2>' +
6364
'<div class="api_metadata"><span>Added in: v1.0.0</span>' +
6465
'<span>Deprecated since: v2.0.0</span></div><p>Describe ' +
65-
'<code>Deprecated thingy</code> in more detail here.</p>' +
66+
'<code>Deprecated thingy</code> in more detail here.' +
67+
'<a href="http://man7.org/linux/man-pages/man1/fg.1p.html">fg(1p)</a>' +
68+
'</p>' +
6669
'<h2>Something<span><a class="mark" href="#foo_something" ' +
6770
'id="foo_something">#</a></span></h2> ' +
6871
'<!-- This is not a metadata comment --> ' +

test/doctool/test-doctool-json.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const testData = [
111111
]
112112
},
113113
desc: '<p>Describe <code>Foobar II</code> in more detail ' +
114-
'here.</p>\n',
114+
'here. fg(1)</p>\n',
115115
type: 'module',
116116
displayName: 'Foobar II'
117117
},
@@ -124,7 +124,7 @@ const testData = [
124124
changes: []
125125
},
126126
desc: '<p>Describe <code>Deprecated thingy</code> in more ' +
127-
'detail here.</p>\n',
127+
'detail here. fg(1p)</p>\n',
128128
type: 'module',
129129
displayName: 'Deprecated thingy'
130130
},

test/fixtures/doc_with_yaml.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ changes:
1818
description: The `error` parameter can now be an arrow function.
1919
-->
2020

21-
Describe `Foobar II` in more detail here.
21+
Describe `Foobar II` in more detail here. fg(1)
2222

2323
## Deprecated thingy
2424
<!-- YAML
2525
added: v1.0.0
2626
deprecated: v2.0.0
2727
-->
2828

29-
Describe `Deprecated thingy` in more detail here.
29+
Describe `Deprecated thingy` in more detail here. fg(1p)
3030

3131
## Something
3232
<!-- This is not a metadata comment -->

tools/doc/html.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -316,17 +316,19 @@ var BSD_ONLY_SYSCALLS = new Set(['lchmod']);
316316
// Returns modified text, with such refs replace with HTML links, for example
317317
// '<a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>'
318318
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+
});
330332
}
331333

332334
function linkJsTypeDocs(text) {

0 commit comments

Comments
 (0)