From 348bdd5e930f3cf7a8e27835189794ec940ae1b7 Mon Sep 17 00:00:00 2001 From: Luis Michaelis Date: Tue, 13 Dec 2022 13:20:31 +0100 Subject: [PATCH] fix: Fix regular expression for Sphinx inventory parsing 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. Co-authored-by: Luis Michaelis Issue #496: https://github.com/mkdocstrings/mkdocstrings/issues/496 PR #497: https://github.com/mkdocstrings/mkdocstrings/pull/497 --- 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":