Skip to content

Commit

Permalink
Merge pull request #8345 from sphinx-doc/8342_warning_for_unknown_domain
Browse files Browse the repository at this point in the history
Fix #8342: Emit a warning if a unknown domain is given for directive or role
  • Loading branch information
tk0miya authored Nov 3, 2020
2 parents 93f6ffb + 9cd3e1a commit b93aa31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Features added
Bugs fixed
----------

* #8342: Emit a warning if a unknown domain is given for directive or role (ex.
``:unknown:doc:``)

Testing
--------

Expand Down
3 changes: 3 additions & 0 deletions sphinx/util/docutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
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

Expand Down Expand Up @@ -208,6 +209,8 @@ def lookup_domain_element(self, type: str, name: str) -> Any:
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')
Expand Down

0 comments on commit b93aa31

Please sign in to comment.