diff options
Diffstat (limited to 'support/jsdoc/jsdoc-fix-html.js')
-rw-r--r-- | support/jsdoc/jsdoc-fix-html.js | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/support/jsdoc/jsdoc-fix-html.js b/support/jsdoc/jsdoc-fix-html.js index 15234a0..3741a18 100644 --- a/support/jsdoc/jsdoc-fix-html.js +++ b/support/jsdoc/jsdoc-fix-html.js @@ -37,7 +37,7 @@ function generateHTMLFile(filename, $page, callback) { } function extractModuleFiles(files) { - return _.filter(files, function(file) { + return _.filter(files, (file) => { return _.startsWith(file, 'module') && file !== mainModuleFile; }); } @@ -45,15 +45,15 @@ function extractModuleFiles(files) { function combineFakeModules(files, callback) { var moduleFiles = extractModuleFiles(files); - fs.readFile(path.join(docsDir, mainModuleFile), 'utf8', function(err, mainModuleData) { + fs.readFile(path.join(docsDir, mainModuleFile), 'utf8', (err, mainModuleData) => { if (err) return callback(err); var $mainPage = $(mainModuleData); // each 'module' (category) has a separate page, with all of the // important information in a 'main' div. Combine all of these divs into // one on the actual module page (async) - async.eachSeries(moduleFiles, function(file, fileCallback) { - fs.readFile(path.join(docsDir, file), 'utf8', function(err, moduleData) { + async.eachSeries(moduleFiles, (file, fileCallback) => { + fs.readFile(path.join(docsDir, file), 'utf8', (err, moduleData) => { if (err) return fileCallback(err); var $modulePage = $(moduleData); var moduleName = $modulePage.find(sectionTitleClass).text(); @@ -61,7 +61,7 @@ function combineFakeModules(files, callback) { $mainPage.find(mainScrollableSection).append($modulePage.find(mainScrollableSection).html()); return fileCallback(); }); - }, function(err) { + }, (err) => { if (err) return callback(err); generateHTMLFile(path.join(docsDir, docFilename), $mainPage, callback); }); @@ -83,7 +83,7 @@ function applyPreCheerioFixes(data) { .replace(rIncorrectCFText, fixedCFText) // for return types, JSDoc doesn't allow replacing the link text, so it // needs to be done here - .replace(rIncorrectModuleText, function(match, moduleName, methodName) { + .replace(rIncorrectModuleText, (match, moduleName, methodName) => { return '>'+methodName+'<'; }); } @@ -128,7 +128,7 @@ function fixToc(file, $page, moduleFiles) { var prependFilename = (file === docFilename) ? '' : docFilename; // make everything point to the same 'docs.html' page - _.each(moduleFiles, function(filename) { + _.each(moduleFiles, (filename) => { $page.find('[href^="'+filename+'"]').each(function() { var $ele = $(this); var href = $ele.attr('href'); @@ -156,9 +156,9 @@ function fixModuleLinks(files, callback) { var moduleFiles = extractModuleFiles(files); - async.each(files, function(file, fileCallback) { + async.each(files, (file, fileCallback) => { var filePath = path.join(docsDir, file); - fs.readFile(filePath, 'utf8', function(err, fileData) { + fs.readFile(filePath, 'utf8', (err, fileData) => { if (err) return fileCallback(err); var $file = $(applyPreCheerioFixes(fileData)); @@ -179,18 +179,18 @@ fs.copySync(path.join(__dirname, './jsdoc-custom.js'), path.join(docsDir, 'scrip fs.copySync(path.join(__dirname, '..', '..', 'logo', 'favicon.ico'), path.join(docsDir, 'favicon.ico'), { clobber: true }); fs.copySync(path.join(__dirname, '..', '..', 'logo', 'async-logo.svg'), path.join(docsDir, 'img', 'async-logo.svg'), { clobber: true }); -fs.readdir(docsDir, function(err, files) { +fs.readdir(docsDir, (err, files) => { if (err) { throw err; } - var HTMLFiles = _.filter(files, function(file) { + var HTMLFiles = _.filter(files, (file) => { return path.extname(file) === '.html'; }); async.waterfall([ function(callback) { - combineFakeModules(HTMLFiles, function(err) { + combineFakeModules(HTMLFiles, (err) => { if (err) return callback(err); HTMLFiles.push(docFilename); return callback(null); @@ -199,7 +199,7 @@ fs.readdir(docsDir, function(err, files) { function(callback) { fixModuleLinks(HTMLFiles, callback); } - ], function(err) { + ], (err) => { if (err) throw err; console.log('Docs generated successfully'); }); |