diff options
author | Alex Early <alexander.early@gmail.com> | 2019-05-26 17:44:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-26 17:44:59 -0700 |
commit | 4ee4422bab93949e05a106be5b24a893dddfd2e0 (patch) | |
tree | 0fe7bfc45894aab317883c9b050673096513e653 /support/jsdoc/jsdoc-fix-html.js | |
parent | fca2be85041a95c35d27877ca0eba36f4b2fb4e3 (diff) | |
download | async-4ee4422bab93949e05a106be5b24a893dddfd2e0.tar.gz |
docs: use `docs/` folder, include links for every major version (#1648)
* publish docs to docs folder
* disable jekyll
* dont clean docs folder
* add v2 docs
* move docs to v3
* fix nav links, remove pointless footer text
* fix scripts/footer
* make doc generation idempotent
* css tweak
* fix path between v2 and v3
* fix logo link
Diffstat (limited to 'support/jsdoc/jsdoc-fix-html.js')
-rw-r--r-- | support/jsdoc/jsdoc-fix-html.js | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/support/jsdoc/jsdoc-fix-html.js b/support/jsdoc/jsdoc-fix-html.js index 2cc8991..b004ba7 100644 --- a/support/jsdoc/jsdoc-fix-html.js +++ b/support/jsdoc/jsdoc-fix-html.js @@ -6,7 +6,7 @@ var $ = require('cheerio'); var _ = require('lodash'); var VERSION = require('../../package.json').version; -var docsDir = path.join(__dirname, '../../docs'); +var docsDir = path.join(__dirname, '../../docs/v3'); var pageTitle = 'Methods:'; var docFilename = 'docs.html'; @@ -18,9 +18,6 @@ var HTMLFileBegin = '<!DOCTYPE html>\n<html lang="en">\n<head>\n'; var HTMLFileHeadBodyJoin = '</head>\n<body>'; var HTMLFileEnd = '</body>'; -var additionalFooterText = ' Documentation has been modified from the original. ' + - ' For more information, please see the <a href="https://github.com/caolan/async">async</a> repository.'; - function generateHTMLFile(filename, $page, callback) { var methodName = filename.match(/\/(\w+)\.js\.html$/); if (methodName) { @@ -125,8 +122,8 @@ function fixToc(file, $page, moduleFiles) { $nav.children('h2').remove(); scrollSpyFix($page, $nav); - - var prependFilename = (file === docFilename) ? '' : docFilename; + var isDocsFile = file === docFilename + var prependFilename = isDocsFile ? '' : docFilename; // make everything point to the same 'docs.html' page _.each(moduleFiles, (filename) => { $page.find('[href^="'+filename+'"]').each(function() { @@ -146,9 +143,7 @@ function fixToc(file, $page, moduleFiles) { } function fixFooter($page) { - // add a note to the footer that the documentation has been modified var $footer = $page.find('footer'); - $footer.append(additionalFooterText); $page.find(mainScrollableSection).append($footer); } @@ -182,18 +177,14 @@ fs.copySync(path.join(__dirname, '..', '..', 'logo', 'async-logo.svg'), path.joi fs.readdir(docsDir, (readErr, files) => { if (readErr) { throw readErr; } - var HTMLFiles = _.filter(files, (file) => { - return path.extname(file) === '.html'; - }); + var HTMLFiles = files + .filter(file => path.extname(file) === '.html') + .filter(file => file !== 'docs.html') + async.waterfall([ - function(callback) { - combineFakeModules(HTMLFiles, (err) => { - if (err) return callback(err); - HTMLFiles.push(docFilename); - return callback(null); - }); - }, + async.constant(HTMLFiles), + combineFakeModules, async.asyncify(() => { HTMLFiles.push(docFilename) }), |