Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f9f85a0

Browse filesBrowse files
jmmMyles Borins
authored andcommitted
tools: restore change of signatures to opts hashes
These signatures were originally converted to opts hashes in #3888. That change was misinterpreted as the intrinsic cause of a test failure and reverted in #6680. PR-URL: #6690 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
1 parent 3681b9b commit f9f85a0
Copy full SHA for f9f85a0

File tree

Expand file treeCollapse file tree

3 files changed

+41
-19
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+41
-19
lines changed
Open diff view settings
Collapse file

‎test/doctool/test-doctool-html.js‎

Copy file name to clipboardExpand all lines: test/doctool/test-doctool-html.js
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,22 @@ testData.forEach(function(item) {
6161

6262
fs.readFile(item.file, 'utf8', common.mustCall(function(err, input) {
6363
assert.ifError(err);
64-
html(input, 'foo', 'doc/template.html',
64+
html(
65+
{
66+
input: input,
67+
filename: 'foo',
68+
template: 'doc/template.html',
69+
nodeVersion: process.version,
70+
},
71+
6572
common.mustCall(function(err, output) {
6673
assert.ifError(err);
6774

6875
const actual = output.replace(/\s/g, '');
6976
// Assert that the input stripped of all whitespace contains the
7077
// expected list
7178
assert.notEqual(actual.indexOf(expected), -1);
72-
}));
79+
})
80+
);
7381
}));
7482
});
Collapse file

‎tools/doc/generate.js‎

Copy file name to clipboardExpand all lines: tools/doc/generate.js
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,19 @@ function next(er, input) {
4848
break;
4949

5050
case 'html':
51-
require('./html.js')(input, inputFile, template, nodeVersion,
51+
require('./html.js')(
52+
{
53+
input: input,
54+
filename: inputFile,
55+
template: template,
56+
nodeVersion: nodeVersion,
57+
},
58+
5259
function(er, html) {
5360
if (er) throw er;
5461
console.log(html);
55-
});
62+
}
63+
);
5664
break;
5765

5866
default:
Collapse file

‎tools/doc/html.js‎

Copy file name to clipboardExpand all lines: tools/doc/html.js
+21-15Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ var gtocPath = path.resolve(path.join(
3030
var gtocLoading = null;
3131
var gtocData = null;
3232

33-
function toHTML(input, filename, template, nodeVersion, cb) {
34-
if (typeof nodeVersion === 'function') {
35-
cb = nodeVersion;
36-
nodeVersion = null;
37-
}
38-
nodeVersion = nodeVersion || process.version;
33+
/**
34+
* opts: input, filename, template, nodeVersion.
35+
*/
36+
function toHTML(opts, cb) {
37+
var template = opts.template;
38+
var nodeVersion = opts.nodeVersion || process.version;
3939

4040
if (gtocData) {
4141
return onGtocLoaded();
@@ -57,10 +57,15 @@ function toHTML(input, filename, template, nodeVersion, cb) {
5757
}
5858

5959
function onGtocLoaded() {
60-
var lexed = marked.lexer(input);
60+
var lexed = marked.lexer(opts.input);
6161
fs.readFile(template, 'utf8', function(er, template) {
6262
if (er) return cb(er);
63-
render(lexed, filename, template, nodeVersion, cb);
63+
render({
64+
lexed: lexed,
65+
filename: opts.filename,
66+
template: template,
67+
nodeVersion: nodeVersion,
68+
}, cb);
6469
});
6570
}
6671
}
@@ -87,13 +92,14 @@ function toID(filename) {
8792
.replace(/-+/g, '-');
8893
}
8994

90-
function render(lexed, filename, template, nodeVersion, cb) {
91-
if (typeof nodeVersion === 'function') {
92-
cb = nodeVersion;
93-
nodeVersion = null;
94-
}
95-
96-
nodeVersion = nodeVersion || process.version;
95+
/**
96+
* opts: lexed, filename, template, nodeVersion.
97+
*/
98+
function render(opts, cb) {
99+
var lexed = opts.lexed;
100+
var filename = opts.filename;
101+
var template = opts.template;
102+
var nodeVersion = opts.nodeVersion || process.version;
97103

98104
// get the section
99105
var section = getSection(lexed);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.