From 5392b7bdbdce207f9bb9969cb74b4230c2cd677d Mon Sep 17 00:00:00 2001 From: Anthony Johnson Date: Fri, 17 Jul 2015 00:18:02 -0700 Subject: [PATCH] Fix issue with toctree :titlesonly: and nav menu This fixes #196 by filtering nav ul elements that have empty ul siblings --- demo_docs/source/index.rst | 5 +++++ demo_docs/source/toc.rst | 12 ++++++++++++ sphinx_rtd_theme/static/js/theme.js | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 demo_docs/source/toc.rst diff --git a/demo_docs/source/index.rst b/demo_docs/source/index.rst index 4436c48f..47e7c5f4 100644 --- a/demo_docs/source/index.rst +++ b/demo_docs/source/index.rst @@ -19,6 +19,11 @@ Contents: demo list +.. toctree:: + :titlesonly: + + toc + .. toctree:: :maxdepth: 2 :caption: This is an incredibly long caption for a long menu diff --git a/demo_docs/source/toc.rst b/demo_docs/source/toc.rst new file mode 100644 index 00000000..286b50c9 --- /dev/null +++ b/demo_docs/source/toc.rst @@ -0,0 +1,12 @@ +========= +TOC Tests +========= + +One +=== + +Two +--- + +Three +````` diff --git a/sphinx_rtd_theme/static/js/theme.js b/sphinx_rtd_theme/static/js/theme.js index 749e58f4..d7e59d26 100644 --- a/sphinx_rtd_theme/static/js/theme.js +++ b/sphinx_rtd_theme/static/js/theme.js @@ -31,7 +31,7 @@ $(document).ready(function() { $("table.docutils:not(.field-list)").wrap("
"); // Add expand links to all parents of nested ul - $('.wy-menu-vertical ul').siblings('a').each(function () { + $('.wy-menu-vertical ul').not('.simple').siblings('a').each(function () { var link = $(this); expand = $(''); expand.on('click', function (ev) {