Browse Source

tools: use better regexp for manpage references

In practice, manpage names may contain dots (e.g. `resolv.conf(5)`).

PR-URL: https://github.com/nodejs/node/pull/9632
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
v6
Anna Henningsen 8 years ago
parent
commit
79c382787f
No known key found for this signature in database GPG Key ID: D8B9F5AEAE84E4CF
  1. 2
      tools/doc/html.js

2
tools/doc/html.js

@ -263,7 +263,7 @@ 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(/ ([a-z.]+)\((\d)\)/gm, function(match, name, number) {
// name consists of lowercase letters, number is a single digit // name consists of lowercase letters, number is a single digit
var displayAs = name + '(' + number + ')'; var displayAs = name + '(' + number + ')';
if (BSD_ONLY_SYSCALLS.has(name)) { if (BSD_ONLY_SYSCALLS.has(name)) {

Loading…
Cancel
Save