Skip to content

Commit 5d595ec

Browse files
intersphinx role, simplify role_name check
Co-authored-by: Takeshi KOMIYA <[email protected]>
1 parent 6ee0ecb commit 5d595ec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sphinx/ext/intersphinx.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ class IntersphinxDispatcher(CustomReSTDispatcher):
479479

480480
def role(self, role_name: str, language_module: ModuleType, lineno: int, reporter: Reporter
481481
) -> Tuple[RoleFunction, List[system_message]]:
482-
if len(role_name) > 9 and role_name.startswith('external') and role_name[8] in ':+':
482+
if len(role_name) > 9 and role_name.startswith(('external:', 'external+')):
483483
return IntersphinxRole(role_name), []
484484
else:
485485
return super().role(role_name, language_module, lineno, reporter)
@@ -525,7 +525,8 @@ def get_inventory_and_name_suffix(self, name: str) -> Tuple[Optional[str], str]:
525525
# or we look in all inventories, i.e.,
526526
# :external:role: or
527527
# :external:domain:role:
528-
return IntersphinxRole._re_inv_ref.fullmatch(name, 8).group(2, 3)
528+
inv, suffix = IntersphinxRole._re_inv_ref.fullmatch(name, 8).group(2, 3)
529+
return inv, suffix
529530

530531
def get_role_name(self, name: str) -> Optional[Tuple[str, str]]:
531532
names = name.split(':')

0 commit comments

Comments
 (0)