From 3b3a7d911b883d4d0f7a494a856e38019375e096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Navr=C3=A1til?= <64248330+onavratil-monetplus@users.noreply.github.com> Date: Thu, 27 Jun 2024 23:34:46 +0200 Subject: [PATCH] [toctree] Adding warning type/subtype `toc.no_title` (#12479) Add warning type and subtype to warning generated in toctree --- doc/usage/configuration.rst | 1 + sphinx/environment/adapters/toctree.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst index 795dc42b1..70dffafdd 100644 --- a/doc/usage/configuration.rst +++ b/doc/usage/configuration.rst @@ -366,6 +366,7 @@ General configuration * ``toc.excluded`` * ``toc.not_readable`` * ``toc.secnum`` + * ``toc.no_title`` Extensions can also define their own warning types. Those defined by the first-party ``sphinx.ext`` extensions are: diff --git a/sphinx/environment/adapters/toctree.py b/sphinx/environment/adapters/toctree.py index cfe717f65..42c0bb495 100644 --- a/sphinx/environment/adapters/toctree.py +++ b/sphinx/environment/adapters/toctree.py @@ -316,7 +316,7 @@ def _toctree_entry( # empty toc means: no titles will show up in the toctree logger.warning(__('toctree contains reference to document %r that ' "doesn't have a title: no link will be generated"), - ref, location=toctreenode) + ref, location=toctreenode, type='toc', subtype='no_title') except KeyError: # this is raised if the included file does not exist ref_path = env.doc2path(ref, False)