summaryrefslogtreecommitdiff
path: root/sphinx/util/docutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/docutils.py')
-rw-r--r--sphinx/util/docutils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py
index 7069189e3..972db3520 100644
--- a/sphinx/util/docutils.py
+++ b/sphinx/util/docutils.py
@@ -409,6 +409,7 @@ class ReferenceRole(SphinxRole):
``self.title`` and ``self.target``.
"""
has_explicit_title = None #: A boolean indicates the role has explicit title or not.
+ disabled = False #: A boolean indicates the reference is disabled.
title = None #: The link title for the interpreted text.
target = None #: The link target for the interpreted text.
@@ -418,6 +419,9 @@ class ReferenceRole(SphinxRole):
def __call__(self, name: str, rawtext: str, text: str, lineno: int,
inliner: Inliner, options: Dict = {}, content: List[str] = []
) -> Tuple[List[Node], List[system_message]]:
+ # if the first character is a bang, don't cross-reference at all
+ self.disabled = text.startswith('!')
+
matched = self.explicit_title_re.match(text)
if matched:
self.has_explicit_title = True