From d01c036aeb382b46bf322bd8203e7feb8e8b4485 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 26 Aug 2017 12:43:50 -0700 Subject: [PATCH] doc: addressed misc review comments Fixes: https://github.com/nodejs/node/issues/10726 --- doc/api/addons.md | 2 +- doc/template.html | 2 +- tools/doc/html.js | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index d9fb2098a732e6..fda844c5b9e5fa 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -2,7 +2,7 @@ -Node.js Addons are dynamically-linked shared objects, written in C or C++, that +Node.js Addons are dynamically-linked shared objects, written in C++, that can be loaded into Node.js using the [`require()`][require] function, and used just as if they were an ordinary Node.js module. They are used primarily to provide an interface between JavaScript running in Node.js and C/C++ libraries. diff --git a/doc/template.html b/doc/template.html index f30965a9a67ba6..d65b56ca5e80ad 100644 --- a/doc/template.html +++ b/doc/template.html @@ -34,7 +34,7 @@

Node.js __VERSION__ Documentation

View as JSON |
  • - View another version + View another version __ALTDOCS__
  • diff --git a/tools/doc/html.js b/tools/doc/html.js index fd1d5b0658303f..f316bd1114553f 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -31,7 +31,7 @@ const typeParser = require('./type-parser.js'); module.exports = toHTML; const STABILITY_TEXT_REG_EXP = /(.*:)\s*(\d)([\s\S]*)/; -const DOC_CREATED_REG_EXP = //; +const DOC_CREATED_REG_EXP = //; // customized heading without id attribute const renderer = new marked.Renderer(); @@ -199,16 +199,17 @@ function altDocs(filename) { let html = ''; if (!docCreated) { - console.error('Failed to add alternative version links'); + console.error(`Failed to add alternative version links to ${filename}`); return html; } function lte(v) { - if (docCreated[1] > v.num[0]) + const ns = v.num.split('.'); + if (docCreated[1] > +ns[0]) return false; - if (docCreated[1] < v.num[0]) + if (docCreated[1] < +ns[0]) return true; - return docCreated[2] <= v.num.substr(2, 2); + return docCreated[2] <= +ns[1]; } const versions = [