diff options
author | Hubert Argasinski <argasinski.hubert@gmail.com> | 2016-10-07 19:27:56 -0400 |
---|---|---|
committer | Hubert Argasinski <argasinski.hubert@gmail.com> | 2016-10-07 19:27:56 -0400 |
commit | 06b1c9c9f94a4c503426c1377cf89d7cce49f6a5 (patch) | |
tree | d4ccbbfbc0f51972f1aadf1478eb1bf025d1c2bd /support/jsdoc/jsdoc-fix-html.js | |
parent | 0d2dbf74b846aa923b492cd42e4d04e279dd32ec (diff) | |
download | async-06b1c9c9f94a4c503426c1377cf89d7cce49f6a5.tar.gz |
docs: combine toc sublists into one list
Diffstat (limited to 'support/jsdoc/jsdoc-fix-html.js')
-rw-r--r-- | support/jsdoc/jsdoc-fix-html.js | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/support/jsdoc/jsdoc-fix-html.js b/support/jsdoc/jsdoc-fix-html.js index a45b383..b199d2a 100644 --- a/support/jsdoc/jsdoc-fix-html.js +++ b/support/jsdoc/jsdoc-fix-html.js @@ -111,11 +111,32 @@ function applyPreCheerioFixes(data) { function fixToc($page, moduleFiles) { // remove `async` listing from toc - $page.find('li').find('a[href="'+mainModuleFile+'"]').parent().remove(); + $page.find('a[href="'+mainModuleFile+'"]').parent().remove(); // change toc title - $page.find('nav').children('h3').text(pageTitle); - $page.find('nav').children('h2').remove(); + var $nav = $page.find('nav'); + $nav.attr('id', 'toc'); + $nav.children('h3').text(pageTitle); + $nav.children('h2').remove(); + + // move everything into one big ul (for Bootstrap scroll-spy) + var $ul = $nav.children('ul'); + $ul.addClass('nav').addClass('methods'); + $ul.find('.methods').each(function() { + var $methodsList = $(this); + var $methods = $methodsList.find('[data-type="method"]'); + var $parentLi = $methodsList.parent(); + + $methodsList.remove(); + $methods.remove(); + $parentLi.after($methods); + $parentLi.addClass('toc-header'); + + }); + + $page.find('[data-type="method"]').each(function() { + $(this).addClass("toc-method"); + }); // make everything point to the same 'docs.html' page _.each(moduleFiles, function(filename) { |