We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 76fc551 commit d6e1178Copy full SHA for d6e1178
src/mkdocs_autorefs/plugin.py
@@ -10,6 +10,7 @@
10
and fixes them using the previously stored identifier-URL mapping.
11
"""
12
13
+import contextlib
14
import functools
15
import logging
16
from typing import Callable, Dict, Optional
@@ -90,10 +91,12 @@ def get_item_url(
90
91
return self._abs_url_map[identifier]
92
93
if fallback:
- new_identifier = fallback(identifier)
94
- if new_identifier:
95
- return self.get_item_url(new_identifier, from_url)
96
-
+ new_identifiers = fallback(identifier)
+ for new_identifier in new_identifiers:
+ with contextlib.suppress(KeyError):
97
+ url = self.get_item_url(new_identifier, from_url)
98
+ self._url_map[identifier] = url # update the map to avoid doing all this again
99
+ return url
100
raise
101
102
if from_url is not None:
0 commit comments