Skip to content

Commit

Permalink
fix: Fix regular expression for Sphinx inventory parsing
Browse files Browse the repository at this point in the history
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 <luis.michaelis@iee.fraunhofer.de>
Issue #496: #496
PR #497: #497
  • Loading branch information
lmichaelis committed Dec 13, 2022
1 parent a5ed211 commit 348bdd5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/mkdocstrings/inventory.py
Expand Up @@ -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":
Expand Down

0 comments on commit 348bdd5

Please sign in to comment.