summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Lykke Andersen <jakobandersen@users.noreply.github.com>2022-01-15 21:52:25 +0100
committerJakob Lykke Andersen <Jakob@caput.dk>2022-01-16 09:48:39 +0100
commit5d595ec0c4294f45f3138c4c581b84c39cae5e29 (patch)
tree62a6d49f90460cbc9f6254102af58d7388a94df3
parent6ee0ecbe40ab8a3251538409cf35ffcc04765bfa (diff)
downloadsphinx-git-5d595ec0c4294f45f3138c4c581b84c39cae5e29.tar.gz
intersphinx role, simplify role_name check
Co-authored-by: Takeshi KOMIYA <i.tkomiya@gmail.com>
-rw-r--r--sphinx/ext/intersphinx.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py
index f19f5fa15..2f8ab2588 100644
--- a/sphinx/ext/intersphinx.py
+++ b/sphinx/ext/intersphinx.py
@@ -479,7 +479,7 @@ class IntersphinxDispatcher(CustomReSTDispatcher):
def role(self, role_name: str, language_module: ModuleType, lineno: int, reporter: Reporter
) -> Tuple[RoleFunction, List[system_message]]:
- if len(role_name) > 9 and role_name.startswith('external') and role_name[8] in ':+':
+ if len(role_name) > 9 and role_name.startswith(('external:', 'external+')):
return IntersphinxRole(role_name), []
else:
return super().role(role_name, language_module, lineno, reporter)
@@ -525,7 +525,8 @@ class IntersphinxRole(SphinxRole):
# or we look in all inventories, i.e.,
# :external:role: or
# :external:domain:role:
- return IntersphinxRole._re_inv_ref.fullmatch(name, 8).group(2, 3)
+ inv, suffix = IntersphinxRole._re_inv_ref.fullmatch(name, 8).group(2, 3)
+ return inv, suffix
def get_role_name(self, name: str) -> Optional[Tuple[str, str]]:
names = name.split(':')