Skip to content

Commit

Permalink
Restored html_default_sidebars setting; added JS TOC to modules sidebar
Browse files Browse the repository at this point in the history
Using JavaScript to generate a local table of contents for the modules
is less than ideal but this isn't easily accomplished with autosummary
(see 87c1000) and we badly need this.
  • Loading branch information
whiteinge committed Feb 28, 2013
1 parent 81fd7b2 commit f300e75
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
30 changes: 30 additions & 0 deletions doc/_templates/modules-sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<div id="module-funcs"></div>

<script>
jQuery.fn.local_toc = function(tgt_sel) {
var tgt = jQuery(tgt_sel);

tgt.append('<h4>Table of Contents</h4>');

jQuery('dt .headerlink').each(function(idx, elem) {

var i = [
'<li><a href="', elem.href, '">',
last(elem.href.split('.')),
'</a></li>']
.join('');

tgt.append(i);
});

function last(list) {
return list[list.length - 1];
}
};
</script>

<script>
;(function($) {
$.fn.local_toc('#module-funcs');
})(jQuery);
</script>
9 changes: 8 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,15 @@ def __getattr__(self, name):
'404': '404.html',
}

html_default_sidebars = [
'localtoc.html',
'relations.html',
'sourcelink.html',
'searchbox.html',
]
html_sidebars = {
'**': [
'ref/**/all/salt.*': [
'modules-sidebar.html',
'localtoc.html',
'relations.html',
'sourcelink.html',
Expand Down

0 comments on commit f300e75

Please sign in to comment.