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: https://github.com/nodejs/node/pull/6690 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com>
This commit is contained in:
parent
9cac8c894e
commit
c1ffb9ff9b
@ -61,7 +61,14 @@ testData.forEach(function(item) {
|
||||
|
||||
fs.readFile(item.file, 'utf8', common.mustCall(function(err, input) {
|
||||
assert.ifError(err);
|
||||
html(input, 'foo', 'doc/template.html',
|
||||
html(
|
||||
{
|
||||
input: input,
|
||||
filename: 'foo',
|
||||
template: 'doc/template.html',
|
||||
nodeVersion: process.version,
|
||||
},
|
||||
|
||||
common.mustCall(function(err, output) {
|
||||
assert.ifError(err);
|
||||
|
||||
@ -69,6 +76,7 @@ testData.forEach(function(item) {
|
||||
// Assert that the input stripped of all whitespace contains the
|
||||
// expected list
|
||||
assert.notEqual(actual.indexOf(expected), -1);
|
||||
}));
|
||||
})
|
||||
);
|
||||
}));
|
||||
});
|
||||
|
@ -48,11 +48,19 @@ function next(er, input) {
|
||||
break;
|
||||
|
||||
case 'html':
|
||||
require('./html.js')(input, inputFile, template, nodeVersion,
|
||||
require('./html.js')(
|
||||
{
|
||||
input: input,
|
||||
filename: inputFile,
|
||||
template: template,
|
||||
nodeVersion: nodeVersion,
|
||||
},
|
||||
|
||||
function(er, html) {
|
||||
if (er) throw er;
|
||||
console.log(html);
|
||||
});
|
||||
}
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -30,12 +30,12 @@ var gtocPath = path.resolve(path.join(
|
||||
var gtocLoading = null;
|
||||
var gtocData = null;
|
||||
|
||||
function toHTML(input, filename, template, nodeVersion, cb) {
|
||||
if (typeof nodeVersion === 'function') {
|
||||
cb = nodeVersion;
|
||||
nodeVersion = null;
|
||||
}
|
||||
nodeVersion = nodeVersion || process.version;
|
||||
/**
|
||||
* opts: input, filename, template, nodeVersion.
|
||||
*/
|
||||
function toHTML(opts, cb) {
|
||||
var template = opts.template;
|
||||
var nodeVersion = opts.nodeVersion || process.version;
|
||||
|
||||
if (gtocData) {
|
||||
return onGtocLoaded();
|
||||
@ -57,10 +57,15 @@ function toHTML(input, filename, template, nodeVersion, cb) {
|
||||
}
|
||||
|
||||
function onGtocLoaded() {
|
||||
var lexed = marked.lexer(input);
|
||||
var lexed = marked.lexer(opts.input);
|
||||
fs.readFile(template, 'utf8', function(er, template) {
|
||||
if (er) return cb(er);
|
||||
render(lexed, filename, template, nodeVersion, cb);
|
||||
render({
|
||||
lexed: lexed,
|
||||
filename: opts.filename,
|
||||
template: template,
|
||||
nodeVersion: nodeVersion,
|
||||
}, cb);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -87,13 +92,14 @@ function toID(filename) {
|
||||
.replace(/-+/g, '-');
|
||||
}
|
||||
|
||||
function render(lexed, filename, template, nodeVersion, cb) {
|
||||
if (typeof nodeVersion === 'function') {
|
||||
cb = nodeVersion;
|
||||
nodeVersion = null;
|
||||
}
|
||||
|
||||
nodeVersion = nodeVersion || process.version;
|
||||
/**
|
||||
* opts: lexed, filename, template, nodeVersion.
|
||||
*/
|
||||
function render(opts, cb) {
|
||||
var lexed = opts.lexed;
|
||||
var filename = opts.filename;
|
||||
var template = opts.template;
|
||||
var nodeVersion = opts.nodeVersion || process.version;
|
||||
|
||||
// get the section
|
||||
var section = getSection(lexed);
|
||||
|
Loading…
x
Reference in New Issue
Block a user