diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-10-28 01:44:18 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-10-28 01:44:19 +0900 |
commit | 9cd3e1a38925ee4db4b787ad81a2e3605aa5b15d (patch) | |
tree | aadf5113a3fd8515b67c97f06743a18c36025f04 /sphinx/util/docutils.py | |
parent | f1af7dc84fed8143e8bf7a51edb1338e21e6f901 (diff) | |
download | sphinx-git-8342_warning_for_unknown_domain.tar.gz |
Fix #8342: Emit a warning if a unknown domain is given for directive or role8342_warning_for_unknown_domain
Currently, Sphinx mention nothing if users use unknown domain in their
documents (ex. `.. unknown:directive::`, `:unknown:role` and so on).
This starts to warn them to be clear non acceptable mark-ups.
refs: #8342
Diffstat (limited to 'sphinx/util/docutils.py')
-rw-r--r-- | sphinx/util/docutils.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py index 161575cbd..8ca38bac2 100644 --- a/sphinx/util/docutils.py +++ b/sphinx/util/docutils.py @@ -28,6 +28,7 @@ from docutils.statemachine import StateMachine, State, StringList from docutils.utils import Reporter, unescape from sphinx.errors import SphinxError +from sphinx.locale import _ from sphinx.util import logging from sphinx.util.typing import RoleFunction @@ -208,6 +209,8 @@ class sphinx_domains: element = getattr(domain, type)(name) if element is not None: return element, [] + else: + logger.warning(_('unknown directive or role name: %s:%s'), domain_name, name) # else look in the default domain else: def_domain = self.env.temp_data.get('default_domain') |