Skip to content

Commit e422990

Browse files
committed
chore: Add YORE comments
1 parent 2916eb2 commit e422990

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/mkdocs_autorefs/references.py

+8
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
log = logging.getLogger(f"mkdocs.plugins.{__name__}") # type: ignore[assignment]
3434

3535

36+
# YORE: Bump 2: Remove block.
3637
def __getattr__(name: str) -> Any:
3738
if name == "AutoRefInlineProcessor":
3839
warnings.warn("AutoRefInlineProcessor was renamed AutorefsInlineProcessor", DeprecationWarning, stacklevel=2)
@@ -41,6 +42,8 @@ def __getattr__(name: str) -> Any:
4142

4243

4344
_ATTR_VALUE = r'"[^"<>]+"|[^"<> ]+' # Possibly with double quotes around
45+
46+
# YORE: Bump 2: Remove block.
4447
AUTO_REF_RE = re.compile(
4548
rf"<span data-(?P<kind>autorefs-(?:identifier|optional|optional-hover))=(?P<identifier>{_ATTR_VALUE})"
4649
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:
174177
return f"{relative}#{anchor}"
175178

176179

180+
# YORE: Bump 2: Remove block.
177181
def _legacy_fix_ref(url_mapper: Callable[[str], str], unmapped: list[str]) -> Callable:
178182
"""Return a `repl` function for [`re.sub`](https://docs.python.org/3/library/re.html#re.sub).
179183
@@ -300,6 +304,7 @@ def inner(match: Match) -> str:
300304
return inner
301305

302306

307+
# YORE: Bump 2: Replace `, *, _legacy_refs: bool = True` with `` within line.
303308
def fix_refs(html: str, url_mapper: Callable[[str], str], *, _legacy_refs: bool = True) -> tuple[str, list[str]]:
304309
"""Fix all references in the given HTML text.
305310
@@ -313,8 +318,11 @@ def fix_refs(html: str, url_mapper: Callable[[str], str], *, _legacy_refs: bool
313318
"""
314319
unmapped: list[str] = []
315320
html = AUTOREF_RE.sub(fix_ref(url_mapper, unmapped), html)
321+
322+
# YORE: Bump 2: Remove block.
316323
if _legacy_refs:
317324
html = AUTO_REF_RE.sub(_legacy_fix_ref(url_mapper, unmapped), html)
325+
318326
return html, unmapped
319327

320328

0 commit comments

Comments
 (0)