mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-14 01:12:10 -05:00
Improve lookup in `Project.path2doc()`
This commit is contained in:
1 parent
2ccbc3209a
commit
6f0c8f75ac
1 file changed
+2
-2
+2
-2
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user