From eecc04cc24207120035baa26cc93b8cb3b2d8279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerson=20Ni=C3=B1o?= Date: Tue, 9 Apr 2019 22:30:03 -0500 Subject: [PATCH 1/3] tools,doc: fix 404 broken links in docs Change the linkManPages function to catch the uname and curl correct websites on the docs page. Fixes: https://github.com/nodejs/node/issues/26074 --- tools/doc/html.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index c7ffb392e05ad2..9db4d01f9b070b 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -120,6 +120,8 @@ function preprocessText() { // Syscalls which appear in the docs, but which only exist in BSD / macOS. const BSD_ONLY_SYSCALLS = new Set(['lchmod']); +const LINUX_DIE_ONLY_SYSCALLS = new Set(['uname']); +const HAXX_ONLY_SYSCALLS = new Set(['curl']); const MAN_PAGE = /(^|\s)([a-z.]+)\((\d)([a-z]?)\)/gm; // Handle references to man pages, eg "open(2)" or "lchmod(2)". @@ -135,9 +137,15 @@ function linkManPages(text) { if (BSD_ONLY_SYSCALLS.has(name)) { return `${beginning}${displayAs}`; + } else if (LINUX_DIE_ONLY_SYSCALLS.has(name)) { + return `${beginning}${displayAs}`; + } else if (HAXX_ONLY_SYSCALLS.has(name)) { + return `${beginning}${displayAs}`; + } else { + return `${beginning}${displayAs}`; } - return `${beginning}${displayAs}`; }); } From fdd3d16576c6f64cbcdb5e1f689884ebd122a6ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerson=20Ni=C3=B1o=20D=C3=ADaz?= Date: Mon, 15 Apr 2019 14:21:57 -0500 Subject: [PATCH 2/3] Remove last else if --- tools/doc/html.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index 9db4d01f9b070b..c6774576ef21b8 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -142,11 +142,11 @@ function linkManPages(text) { `${number}/${name}">${displayAs}`; } else if (HAXX_ONLY_SYSCALLS.has(name)) { return `${beginning}${displayAs}`; - } else { - return `${beginning}${displayAs}`; - } - }); + } + + return `${beginning}${displayAs}`; + }); } const TYPE_SIGNATURE = /\{[^}]+\}/g; From b6744e874b067317c03365d6ec56f3bf6f18a5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerson=20Ni=C3=B1o=20D=C3=ADaz?= Date: Tue, 16 Apr 2019 09:12:32 -0500 Subject: [PATCH 3/3] tools,doc: Fix lint and remove elses --- tools/doc/html.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index c6774576ef21b8..510e2b08d22370 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -137,16 +137,18 @@ function linkManPages(text) { if (BSD_ONLY_SYSCALLS.has(name)) { return `${beginning}${displayAs}`; - } else if (LINUX_DIE_ONLY_SYSCALLS.has(name)) { + } + if (LINUX_DIE_ONLY_SYSCALLS.has(name)) { return `${beginning}${displayAs}`; - } else if (HAXX_ONLY_SYSCALLS.has(name)) { + } + if (HAXX_ONLY_SYSCALLS.has(name)) { return `${beginning}${displayAs}`; - } - + } + return `${beginning}${displayAs}`; - }); + }); } const TYPE_SIGNATURE = /\{[^}]+\}/g;