tools,doc: fix 404 broken links in docs · nodejs/node@964174e (original) (raw)
`@@ -120,6 +120,8 @@ function preprocessText() {
`
120
120
``
121
121
`// Syscalls which appear in the docs, but which only exist in BSD / macOS.
`
122
122
`const BSD_ONLY_SYSCALLS = new Set(['lchmod']);
`
``
123
`+
const LINUX_DIE_ONLY_SYSCALLS = new Set(['uname']);
`
``
124
`+
const HAXX_ONLY_SYSCALLS = new Set(['curl']);
`
123
125
`const MAN_PAGE = /(^|\s)([a-z.]+)((\d)([a-z]?))/gm;
`
124
126
``
125
127
`// Handle references to man pages, eg "open(2)" or "lchmod(2)".
`
`@@ -136,6 +138,14 @@ function linkManPages(text) {
`
136
138
`` return ${beginning}<a href="https://www.freebsd.org/cgi/man.cgi
+
``
137
139
`` ?query=${name}&sektion=${number}">${displayAs}</a>
;
``
138
140
`}
`
``
141
`+
if (LINUX_DIE_ONLY_SYSCALLS.has(name)) {
`
``
142
`` +
return ${beginning}<a href="https://linux.die.net/man/
+
``
``
143
`` +
${number}/${name}">${displayAs}</a>
;
``
``
144
`+
}
`
``
145
`+
if (HAXX_ONLY_SYSCALLS.has(name)) {
`
``
146
`` +
return ${beginning}<a href="https://${name}.haxx.se/docs/manpage.html">${displayAs}</a>
;
``
``
147
`+
}
`
``
148
+
139
149
`` return ${beginning}<a href="http://man7.org/linux/man-pages/man${number}
+
``
140
150
`` /${name}.${number}${optionalCharacter}.html">${displayAs}</a>
;
``
141
151
`});
`