Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc: addressed misc review comments
Fixes: #10726
  • Loading branch information
Chris Young committed Aug 26, 2017
commit d01c036aeb382b46bf322bd8203e7feb8e8b4485
2 changes: 1 addition & 1 deletion doc/api/addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!--introduced_in=v0.10.0-->

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.
Expand Down
2 changes: 1 addition & 1 deletion doc/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h1>Node.js __VERSION__ Documentation</h1>
<a href="__FILENAME__.json">View as JSON</a> |
</li>
<li class="version-picker">
<a href="#">View another version <span>&#x25bc</span></a>
<a href="#">View another version <span>&#x25bc;</span></a>
__ALTDOCS__
</li>
</ul>
Expand Down
11 changes: 6 additions & 5 deletions tools/doc/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = /<!--introduced_in=v([0-9]+).([0-9]+).([0-9]+)-->/;
const DOC_CREATED_REG_EXP = /<!--introduced_in( )?=( )?v([0-9]+)\.([0-9]+)\.([0-9]+)-->/;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking more like

const DOC_CREATED_REG_EXP = /<!--\s*introduced_in\s*=\s*v([0-9]+)\.([0-9]+)\.([0-9]+)\s*-->/;


// customized heading without id attribute
const renderer = new marked.Renderer();
Expand Down Expand Up @@ -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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String based comparison with v.num is not good enough. Why not split it at dots and the do integer comparison?

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 = [
Expand Down