diff --git a/doc/config.rst b/doc/config.rst index ee3a2ec58..5326387de 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -782,6 +782,12 @@ the `Dublin Core metadata `_. be an integer greater than zero. The default value is 3. Note: A deeply nested table of contents may be difficult to navigate. +.. confval:: epub_tocdup + + This flag determines if a toc entry is inserted again at the beginning of + it's nested toc listing. This allows easier navitation to the top of + a chapter, but can be confusing because it mixes entries of differnet + depth in one list. The default value is ``True``. .. _latex-options: diff --git a/sphinx/builders/epub.py b/sphinx/builders/epub.py index c8dafb5ef..5f16c274a 100644 --- a/sphinx/builders/epub.py +++ b/sphinx/builders/epub.py @@ -406,7 +406,7 @@ class EpubBuilder(StandaloneHTMLBuilder): navstack.append(navlist) navlist = [] level += 1 - if lastnode: + if lastnode and self.config.epub_tocdup: # Insert starting point in subtoc with same playOrder navlist.append(self.new_navpoint(lastnode, level, False)) navlist.append(self.new_navpoint(node, level)) diff --git a/sphinx/config.py b/sphinx/config.py index e1075ff6a..12c2a04ba 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -124,6 +124,7 @@ class Config(object): epub_post_files = ([], 'env'), epub_exclude_files = ([], 'env'), epub_tocdepth = (3, 'env'), + epub_tocdup = (True, 'env'), # LaTeX options latex_documents = ([], None), diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index 28dd3c91d..d07472bc8 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -279,6 +279,9 @@ epub_copyright = u'%(copyright_str)s' # The depth of the table of contents in toc.ncx. #epub_tocdepth = 3 + +# Allow duplicate toc entries. +#epub_tocdup = True ''' INTERSPHINX_CONFIG = '''