Skip to content

Commit

Permalink
Allow to suppress "duplicated ToC entry found" warnings from epub bui…
Browse files Browse the repository at this point in the history
…lder
  • Loading branch information
graingert committed Oct 5, 2020
1 parent 598b85d commit b394464
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -37,6 +37,8 @@ Features added
* #8070: html search: Support searching for 2characters word
* #7830: Add debug logs for change detection of sources and templates
* #8201: Emit a warning if toctree contains duplicated entries
* Allow to suppress "duplicated ToC entry found" warnings from epub builder using
:confval:`suppress_warnings`.

Bugs fixed
----------
Expand Down
6 changes: 6 additions & 0 deletions doc/usage/configuration.rst
Expand Up @@ -316,6 +316,7 @@ General configuration
* ``toc.circular``
* ``toc.secnum``
* ``epub.unknown_project_files``
* ``epub.duplicated_toc_entry``
* ``autosectionlabel.*``

You can choose from these types.
Expand All @@ -340,6 +341,11 @@ General configuration

Added ``autosectionlabel.*``


.. versionchanged:: 3.2.2

Added ``epub.duplicated_toc_entry``

.. confval:: needs_sphinx

If set to a ``major.minor`` version string like ``'1.1'``, Sphinx will
Expand Down
7 changes: 6 additions & 1 deletion sphinx/builders/_epub_base.py
Expand Up @@ -213,7 +213,12 @@ def check_refnodes(self, nodes: List[Dict[str, Any]]) -> None:
appeared = set() # type: Set[str]
for node in nodes:
if node['refuri'] in appeared:
logger.warning(__('duplicated ToC entry found: %s'), node['refuri'])
logger.warning(
__('duplicated ToC entry found: %s'),
node['refuri'],
type="epub",
subtype="duplicated_toc_entry",
)
else:
appeared.add(node['refuri'])

Expand Down

0 comments on commit b394464

Please sign in to comment.