mirror of https://github.com/django/django.git
[3.1.x] Made default_role_error use logger.
This prevents raising errors for translated docs, see https://github.com/django/djangoproject.com/issues/997 Follow up to1cdfe8d912
. Backport of36a2e9607e
from master
This commit is contained in:
parent
d193aa8da6
commit
e260dec258
|
@ -12,9 +12,9 @@ from sphinx import addnodes
|
||||||
from sphinx.builders.html import StandaloneHTMLBuilder
|
from sphinx.builders.html import StandaloneHTMLBuilder
|
||||||
from sphinx.directives.code import CodeBlock
|
from sphinx.directives.code import CodeBlock
|
||||||
from sphinx.domains.std import Cmdoption
|
from sphinx.domains.std import Cmdoption
|
||||||
from sphinx.errors import ExtensionError, SphinxError
|
from sphinx.errors import ExtensionError
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util.console import bold, red
|
from sphinx.util.console import bold
|
||||||
from sphinx.writers.html import HTMLTranslator
|
from sphinx.writers.html import HTMLTranslator
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -378,8 +378,9 @@ def default_role_error(
|
||||||
name, rawtext, text, lineno, inliner, options=None, content=None
|
name, rawtext, text, lineno, inliner, options=None, content=None
|
||||||
):
|
):
|
||||||
msg = (
|
msg = (
|
||||||
"Default role used (`single backticks`) at line %s: %s. Did you mean "
|
"Default role used (`single backticks`): %s. Did you mean to use two "
|
||||||
"to use two backticks for ``code``, or miss an underscore for a "
|
"backticks for ``code``, or miss an underscore for a `link`_ ?"
|
||||||
"`link`_ ?" % (lineno, rawtext)
|
% rawtext
|
||||||
)
|
)
|
||||||
raise SphinxError(red(msg))
|
logger.warning(msg, location=(inliner.document.current_source, lineno))
|
||||||
|
return [nodes.Text(text)], []
|
||||||
|
|
Loading…
Reference in New Issue