33
33
log = logging .getLogger (f"mkdocs.plugins.{ __name__ } " ) # type: ignore[assignment]
34
34
35
35
36
+ # YORE: Bump 2: Remove block.
36
37
def __getattr__ (name : str ) -> Any :
37
38
if name == "AutoRefInlineProcessor" :
38
39
warnings .warn ("AutoRefInlineProcessor was renamed AutorefsInlineProcessor" , DeprecationWarning , stacklevel = 2 )
@@ -41,6 +42,8 @@ def __getattr__(name: str) -> Any:
41
42
42
43
43
44
_ATTR_VALUE = r'"[^"<>]+"|[^"<> ]+' # Possibly with double quotes around
45
+
46
+ # YORE: Bump 2: Remove block.
44
47
AUTO_REF_RE = re .compile (
45
48
rf"<span data-(?P<kind>autorefs-(?:identifier|optional|optional-hover))=(?P<identifier>{ _ATTR_VALUE } )"
46
49
rf"(?: class=(?P<class>{ _ATTR_VALUE } ))?(?P<attrs> [^<>]+)?>(?P<title>.*?)</span>" ,
@@ -174,6 +177,7 @@ def relative_url(url_a: str, url_b: str) -> str:
174
177
return f"{ relative } #{ anchor } "
175
178
176
179
180
+ # YORE: Bump 2: Remove block.
177
181
def _legacy_fix_ref (url_mapper : Callable [[str ], str ], unmapped : list [str ]) -> Callable :
178
182
"""Return a `repl` function for [`re.sub`](https://docs.python.org/3/library/re.html#re.sub).
179
183
@@ -300,6 +304,7 @@ def inner(match: Match) -> str:
300
304
return inner
301
305
302
306
307
+ # YORE: Bump 2: Replace `, *, _legacy_refs: bool = True` with `` within line.
303
308
def fix_refs (html : str , url_mapper : Callable [[str ], str ], * , _legacy_refs : bool = True ) -> tuple [str , list [str ]]:
304
309
"""Fix all references in the given HTML text.
305
310
@@ -313,8 +318,11 @@ def fix_refs(html: str, url_mapper: Callable[[str], str], *, _legacy_refs: bool
313
318
"""
314
319
unmapped : list [str ] = []
315
320
html = AUTOREF_RE .sub (fix_ref (url_mapper , unmapped ), html )
321
+
322
+ # YORE: Bump 2: Remove block.
316
323
if _legacy_refs :
317
324
html = AUTO_REF_RE .sub (_legacy_fix_ref (url_mapper , unmapped ), html )
325
+
318
326
return html , unmapped
319
327
320
328
0 commit comments