diff options
author | Myles Borins <mborins@us.ibm.com> | 2016-05-10 11:56:56 -0700 |
---|---|---|
committer | Myles Borins <mborins@us.ibm.com> | 2016-05-10 14:11:49 -0700 |
commit | 572e28efa2e3cde78b5e7984b7760fd4c270f619 (patch) | |
tree | 932425188f990496916b77609242a9ce95c3e2b8 /tools/doc | |
parent | 0912b8832050042fdf7098e6fecfae97c71b27de (diff) | |
download | android-node-v8-572e28efa2e3cde78b5e7984b7760fd4c270f619.tar.gz android-node-v8-572e28efa2e3cde78b5e7984b7760fd4c270f619.tar.bz2 android-node-v8-572e28efa2e3cde78b5e7984b7760fd4c270f619.zip |
tools: fix regression in doctool
101dd1e introduced a regression in the doctool. This commit reverts
the changes that were made to the function signature of the various
doctool functions while maintaining support for passing in specific
node versions.
Refs: https://github.com/nodejs/node/commit/101dd1e
PR-URL: https://github.com/nodejs/node/pull/6680
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Robert Lindstaedt <robert.lindstaedt@gmail.com>
Diffstat (limited to 'tools/doc')
-rw-r--r-- | tools/doc/generate.js | 16 | ||||
-rw-r--r-- | tools/doc/html.js | 36 |
2 files changed, 23 insertions, 29 deletions
diff --git a/tools/doc/generate.js b/tools/doc/generate.js index 94c0905468..7df987e1cf 100644 --- a/tools/doc/generate.js +++ b/tools/doc/generate.js @@ -24,6 +24,8 @@ args.forEach(function(arg) { } }); +nodeVersion = nodeVersion || process.version; + if (!inputFile) { throw new Error('No input file specified'); } @@ -46,15 +48,11 @@ function next(er, input) { break; case 'html': - require('./html.js')({ - input: input, - filename: inputFile, - template: template, - nodeVersion: nodeVersion, - }, function(er, html) { - if (er) throw er; - console.log(html); - }); + require('./html.js')(input, inputFile, template, nodeVersion, + function(er, html) { + if (er) throw er; + console.log(html); + }); break; default: diff --git a/tools/doc/html.js b/tools/doc/html.js index 45d0a80914..ef7d78d5b7 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -30,11 +30,12 @@ var gtocPath = path.resolve(path.join( var gtocLoading = null; var gtocData = null; -/** - * opts: input, filename, template, nodeVersion. - */ -function toHTML(opts, cb) { - var template = opts.template; +function toHTML(input, filename, template, nodeVersion, cb) { + if (typeof nodeVersion === 'function') { + cb = nodeVersion; + nodeVersion = null; + } + nodeVersion = nodeVersion || process.version; if (gtocData) { return onGtocLoaded(); @@ -56,15 +57,10 @@ function toHTML(opts, cb) { } function onGtocLoaded() { - var lexed = marked.lexer(opts.input); + var lexed = marked.lexer(input); fs.readFile(template, 'utf8', function(er, template) { if (er) return cb(er); - render({ - lexed: lexed, - filename: opts.filename, - template: template, - nodeVersion: opts.nodeVersion, - }, cb); + render(lexed, filename, template, nodeVersion, cb); }); } } @@ -91,13 +87,13 @@ function toID(filename) { .replace(/-+/g, '-'); } -/** - * opts: lexed, filename, template, nodeVersion. - */ -function render(opts, cb) { - var lexed = opts.lexed; - var filename = opts.filename; - var template = opts.template; +function render(lexed, filename, template, nodeVersion, cb) { + if (typeof nodeVersion === 'function') { + cb = nodeVersion; + nodeVersion = null; + } + + nodeVersion = nodeVersion || process.version; // get the section var section = getSection(lexed); @@ -117,7 +113,7 @@ function render(opts, cb) { template = template.replace(/__ID__/g, id); template = template.replace(/__FILENAME__/g, filename); template = template.replace(/__SECTION__/g, section); - template = template.replace(/__VERSION__/g, opts.nodeVersion); + template = template.replace(/__VERSION__/g, nodeVersion); template = template.replace(/__TOC__/g, toc); template = template.replace( /__GTOC__/g, |