diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-03-28 18:54:10 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-03-28 18:54:10 +0900 |
commit | 8da576cce029dd0b8ecde60b2549e8dcbc71d88b (patch) | |
tree | 0fd43d70997f7c3d94638418e86bf0c5375b6ae8 /sphinx/util/docutils.py | |
parent | 6a90c166008a46de95120ecc974fb16225f7a144 (diff) | |
download | sphinx-git-8da576cce029dd0b8ecde60b2549e8dcbc71d88b.tar.gz |
Fix #6477: Escape first "!" in a cross reference linking no longer possible
Diffstat (limited to 'sphinx/util/docutils.py')
-rw-r--r-- | sphinx/util/docutils.py | 4 |
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 |