From 0f4273899766ceabe0f314a7b0340e5e48d5003e Mon Sep 17 00:00:00 2001 From: Luis Michaelis Date: Tue, 13 Dec 2022 11:36:08 +0100 Subject: [PATCH] fix: Fix broken Sphinx inventory item regex As mentioned in #496, some Sphinx inventories don't match the `sphinx_item_regex` defined in `InventoryItem`. Allowing any number of whitespace characters at the end instead of requiring at least one fixes this issue. Fixes #496. --- src/mkdocstrings/inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mkdocstrings/inventory.py b/src/mkdocstrings/inventory.py index 6c1b8558..9108d91d 100644 --- a/src/mkdocstrings/inventory.py +++ b/src/mkdocstrings/inventory.py @@ -46,7 +46,7 @@ def format_sphinx(self) -> str: uri = uri[: -len(self.name)] + "$" return f"{self.name} {self.domain}:{self.role} {self.priority} {uri} {dispname}" - sphinx_item_regex = re.compile(r"^(.+?)\s+(\S+):(\S+)\s+(-?\d+)\s+(\S+)\s+(.*)$") + sphinx_item_regex = re.compile(r"^(.+?)\s+(\S+):(\S+)\s+(-?\d+)\s+(\S+)\s*(.*)$") @classmethod def parse_sphinx(cls, line: str) -> "InventoryItem":