diff options
author | Alexander Early <alexander.early@gmail.com> | 2016-06-30 17:32:40 -0700 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2016-06-30 17:32:40 -0700 |
commit | 0e1bdc5c86ff20963c0a91ce725101859b0488fd (patch) | |
tree | 70ecf8ddbbafda2a6981300b3ca7fbe5adb8db7e /support | |
parent | 7405cf083e436b3d157ba543f5bc979ada561bee (diff) | |
download | async-0e1bdc5c86ff20963c0a91ce725101859b0488fd.tar.gz |
copy custom navbar into theme
Diffstat (limited to 'support')
-rw-r--r-- | support/jsdoc/jsdoc-fix-html.js | 38 | ||||
-rw-r--r-- | support/jsdoc/navbar.html | 30 | ||||
-rw-r--r-- | support/jsdoc/theme/tmpl/layout.tmpl | 32 |
3 files changed, 44 insertions, 56 deletions
diff --git a/support/jsdoc/jsdoc-fix-html.js b/support/jsdoc/jsdoc-fix-html.js index a7fb920..3d67884 100644 --- a/support/jsdoc/jsdoc-fix-html.js +++ b/support/jsdoc/jsdoc-fix-html.js @@ -96,7 +96,7 @@ function applyPreCheerioFixes(data) { var rIncorrectCFText = />ControlFlow</g; var fixedCFText = '>Control Flow<'; - var rIncorrectModuleText = />module:(\w+)\.(\w+)</g + var rIncorrectModuleText = />module:(\w+)\.(\w+)</g; // the heading needs additional padding at the top so it doesn't get cutoff return data @@ -112,10 +112,6 @@ function applyPreCheerioFixes(data) { }); } -function addStaticHeader($file, $headerContent) { - var $body = $file.find('body'); - $body.prepend($headerContent); -} function fixToc($page, moduleFiles) { // remove `async` listing from toc @@ -153,29 +149,19 @@ function fixFooter($page) { function fixModuleLinks(files, callback) { var moduleFiles = extractModuleFiles(files); - async.map(['navbar.html'], function(filename, fileCallback) { - fs.readFile(path.join(__dirname, filename), 'utf8', function(err, data) { - if (err) return fileCallback(err); - return fileCallback(null, data); - }); - }, function(err, results) { - if (err) return callback(err); - var $headerContent = $(results[0]); - async.each(files, function(file, fileCallback) { - var filePath = path.join(docsDir, file); - fs.readFile(filePath, 'utf8', function(err, fileData) { - if (err) return fileCallback(err); - var $file = $(applyPreCheerioFixes(fileData)); + async.each(files, function(file, fileCallback) { + var filePath = path.join(docsDir, file); + fs.readFile(filePath, 'utf8', function(err, fileData) { + if (err) return fileCallback(err); + var $file = $(applyPreCheerioFixes(fileData)); - addStaticHeader($file, $headerContent); - fixToc($file, moduleFiles); - fixFooter($file); - $file.find('[href="'+mainModuleFile+'"]').attr('href', docFilename); - generateHTMLFile(filePath, $file, fileCallback); - }); - }, callback); - }); + fixToc($file, moduleFiles); + fixFooter($file); + $file.find('[href="'+mainModuleFile+'"]').attr('href', docFilename); + generateHTMLFile(filePath, $file, fileCallback); + }); + }, callback); } fs.copySync(path.join(__dirname, '../../dist/async.js'), path.join(docsDir, 'scripts/async.js'), { clobber: true }); diff --git a/support/jsdoc/navbar.html b/support/jsdoc/navbar.html deleted file mode 100644 index 86e2792..0000000 --- a/support/jsdoc/navbar.html +++ /dev/null @@ -1,30 +0,0 @@ -<div class="navbar navbar-default navbar-fixed-top"> - <div class="navbar-header"> - <a class="navbar-brand" href="#"> - <img src="img/async-logo.svg" alt="Async.js"></img> - </a> - </div> - <ul class="nav navbar-nav"> - <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" - role="button" aria-haspopup="true" aria-expanded="false">v2.0.0 <span class="caret"></span> - </a> - <ul class="dropdown-menu"> - <li><a href="docs.html">v2.0.x</a></li> - <li> - <a href="https://github.com/caolan/async/blob/v1.5.2/README.md">v1.5.x</a> - </li> - </ul> - </li> - <li><a href="./index.html">Home</a></li> - <li><a href="./docs.html">Docs</a></li> - <li><a href="https://github.com/caolan/async"><i class="ion-social-github" aria-hidden="true"></i></a></li> - </ul> - <ul class="nav navbar-nav navbar-right"> - <form class="navbar-form navbar-left" role="search"> - <div class="form-group"> - <input type="text" class="form-control typeahead" id="doc-search" placeholder="Search"> - </div> - </form> - </ul> -</div> diff --git a/support/jsdoc/theme/tmpl/layout.tmpl b/support/jsdoc/theme/tmpl/layout.tmpl index bd199b2..27b0ce4 100644 --- a/support/jsdoc/theme/tmpl/layout.tmpl +++ b/support/jsdoc/theme/tmpl/layout.tmpl @@ -27,6 +27,38 @@ </head> <body> +<div class="navbar navbar-default navbar-fixed-top"> + <div class="navbar-header"> + <a class="navbar-brand" href="#"> + <img src="img/async-logo.svg" alt="Async.js"></img> + </a> + </div> + <ul class="nav navbar-nav"> + <li id="version-dropdown" class="dropdown"> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" + role="button" aria-haspopup="true" aria-expanded="false">v2.0.0 <span class="caret"></span> + </a> + <ul class="dropdown-menu"> + <li><a href="docs.html">v2.0.x</a></li> + <li> + <a href="https://github.com/caolan/async/blob/v1.5.2/README.md">v1.5.x</a> + </li> + </ul> + </li> + <li><a href="./index.html">Home</a></li> + <li><a href="./docs.html">Docs</a></li> + <li><a href="https://github.com/caolan/async"><i class="ion-social-github" aria-hidden="true"></i></a></li> + </ul> + <ul class="nav navbar-nav navbar-right"> + <form class="navbar-form navbar-left" role="search"> + <div class="form-group"> + <input type="text" class="form-control typeahead" id="doc-search" placeholder="Search"> + </div> + </form> + </ul> +</div> + + <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> |