From 3eecf133d8a8af2f22f6f122d3245a1e2db940eb Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Mon, 5 Oct 2020 09:29:16 +0100 Subject: [PATCH 1/3] Fix #8289: Allow to suppress "duplicated ToC entry found" warnings from epub builder --- CHANGES | 2 ++ doc/usage/configuration.rst | 6 ++++++ sphinx/builders/_epub_base.py | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 600efc4667c..e9a6220bf23 100644 --- a/CHANGES +++ b/CHANGES @@ -26,6 +26,8 @@ Features added just before writing .tex file * #7996: manpage: Add :confval:`man_make_section_directory` to make a section directory on build man page +* #8289: Allow to suppress "duplicated ToC entry found" warnings from epub builder + using :confval:`suppress_warnings`. Bugs fixed ---------- diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst index 270fcbf33fd..1cda6a05512 100644 --- a/doc/usage/configuration.rst +++ b/doc/usage/configuration.rst @@ -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. @@ -340,6 +341,11 @@ General configuration Added ``autosectionlabel.*`` + + .. versionchanged:: 3.3.0 + + Added ``epub.duplicated_toc_entry`` + .. confval:: needs_sphinx If set to a ``major.minor`` version string like ``'1.1'``, Sphinx will diff --git a/sphinx/builders/_epub_base.py b/sphinx/builders/_epub_base.py index 95f9ab8edac..b126182e9f8 100644 --- a/sphinx/builders/_epub_base.py +++ b/sphinx/builders/_epub_base.py @@ -208,7 +208,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']) From 3f26564c283d4800b7fea7402622f9cfd5efbf61 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Mon, 5 Oct 2020 22:10:25 +0100 Subject: [PATCH 2/3] Apply suggestions from code review --- CHANGES | 2 +- doc/usage/configuration.rst | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index e9a6220bf23..2dd31309241 100644 --- a/CHANGES +++ b/CHANGES @@ -26,7 +26,7 @@ Features added just before writing .tex file * #7996: manpage: Add :confval:`man_make_section_directory` to make a section directory on build man page -* #8289: Allow to suppress "duplicated ToC entry found" warnings from epub builder +* #8289: epub: Allow to suppress "duplicated ToC entry found" warnings from epub builder using :confval:`suppress_warnings`. Bugs fixed diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst index 1cda6a05512..4881b86295c 100644 --- a/doc/usage/configuration.rst +++ b/doc/usage/configuration.rst @@ -341,7 +341,6 @@ General configuration Added ``autosectionlabel.*`` - .. versionchanged:: 3.3.0 Added ``epub.duplicated_toc_entry`` From 529d19ff81976a75275082bc34156dd38f97da98 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Mon, 5 Oct 2020 22:12:34 +0100 Subject: [PATCH 3/3] wrap CHANGES at 85 cols --- CHANGES | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 2dd31309241..5f3a17520ce 100644 --- a/CHANGES +++ b/CHANGES @@ -26,8 +26,8 @@ Features added just before writing .tex file * #7996: manpage: Add :confval:`man_make_section_directory` to make a section directory on build man page -* #8289: epub: Allow to suppress "duplicated ToC entry found" warnings from epub builder - using :confval:`suppress_warnings`. +* #8289: epub: Allow to suppress "duplicated ToC entry found" warnings from epub + builder using :confval:`suppress_warnings`. Bugs fixed ----------