mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Improve lookup in `Project.path2doc()
`
This commit is contained in:
parent
2ccbc3209a
commit
6f0c8f75ac
@ -96,10 +96,10 @@ class Project:
|
||||
|
||||
*filename* should be absolute or relative to the source directory.
|
||||
"""
|
||||
path = Path(filename)
|
||||
try:
|
||||
return self._path_to_docname[filename] # type: ignore[index]
|
||||
return self._path_to_docname[path]
|
||||
except KeyError:
|
||||
path = Path(filename)
|
||||
if path.is_absolute():
|
||||
with contextlib.suppress(ValueError):
|
||||
path = path.relative_to(self.srcdir)
|
||||
|
Loading…
Reference in New Issue
Block a user