Skip to content

Commit 861beeb

Browse files
committed
chore: Add Yore comments above legacy ref stuff
1 parent 5e89cd8 commit 861beeb

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

src/mkdocs_autorefs/plugin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class AutorefsPlugin(BasePlugin[AutorefsConfig]):
7777

7878
scan_toc: bool = True
7979
current_page: str | None = None
80+
# YORE: Bump 2: Remove line.
8081
legacy_refs: bool = True
8182

8283
def __init__(self) -> None:
@@ -349,6 +350,7 @@ def on_post_page(self, output: str, page: Page, **kwargs: Any) -> str: # noqa:
349350

350351
# YORE: Bump 2: Replace `, fallback=self.get_fallback_anchor` with `` within line.
351352
url_mapper = functools.partial(self.get_item_url, from_url=page.url, fallback=self.get_fallback_anchor)
353+
# YORE: Bump 2: Replace `, _legacy_refs=self.legacy_refs` with `` within line.
352354
fixed_output, unmapped = fix_refs(output, url_mapper, _legacy_refs=self.legacy_refs)
353355

354356
if unmapped and log.isEnabledFor(logging.WARNING):

src/mkdocs_autorefs/references.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,12 +434,11 @@ def inner(match: Match) -> str:
434434
return inner
435435

436436

437-
# YORE: Bump 2: Replace `, *, _legacy_refs: bool = True` with `` within line.
438437
def fix_refs(
439438
html: str,
440439
url_mapper: Callable[[str], str],
441-
*,
442-
_legacy_refs: bool = True,
440+
# YORE: Bump 2: Remove line.
441+
_legacy_refs: bool = True, # noqa: FBT001, FBT002
443442
) -> tuple[str, list[tuple[str, AutorefsHookInterface.Context | None]]]:
444443
"""Fix all references in the given HTML text.
445444

tests/test_plugin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def test_warn_multiple_urls(caplog: pytest.LogCaptureFixture) -> None:
101101
plugin.register_anchor(identifier="foo", page="foo.html", primary=True)
102102
plugin.register_anchor(identifier="foo", page="bar.html", primary=True)
103103
url_mapper = functools.partial(plugin.get_item_url, from_url="/hello")
104+
# YORE: Bump 2: Replace `, _legacy_refs=False` with `` within line.
104105
fix_refs('<autoref identifier="foo">Foo</autoref>', url_mapper, _legacy_refs=False)
105106
assert "Multiple primary URLs found for 'foo': ['foo.html#foo', 'bar.html#foo']" in caplog.text
106107

@@ -113,5 +114,6 @@ def test_use_closest_url(caplog: pytest.LogCaptureFixture) -> None:
113114
plugin.register_anchor(identifier="foo", page="foo.html", primary=True)
114115
plugin.register_anchor(identifier="foo", page="bar.html", primary=True)
115116
url_mapper = functools.partial(plugin.get_item_url, from_url="/hello")
117+
# YORE: Bump 2: Replace `, _legacy_refs=False` with `` within line.
116118
fix_refs('<autoref identifier="foo">Foo</autoref>', url_mapper, _legacy_refs=False)
117119
assert "Multiple primary URLs found for 'foo': ['foo.html#foo', 'bar.html#foo']" not in caplog.text

tests/test_references.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def test_reference_with_markup() -> None:
220220
)
221221

222222

223+
# YORE: Bump 2: Remove block.
223224
def test_legacy_custom_required_reference() -> None:
224225
"""Check that external HTML-based references are expanded or reported missing."""
225226
with pytest.warns(DeprecationWarning, match="`span` elements are deprecated"):
@@ -241,6 +242,7 @@ def test_custom_required_reference() -> None:
241242
)
242243

243244

245+
# YORE: Bump 2: Remove block.
244246
def test_legacy_custom_optional_reference() -> None:
245247
"""Check that optional HTML-based references are expanded and never reported missing."""
246248
with pytest.warns(DeprecationWarning, match="`span` elements are deprecated"):
@@ -260,6 +262,7 @@ def test_custom_optional_reference() -> None:
260262
)
261263

262264

265+
# YORE: Bump 2: Remove block.
263266
def test_legacy_custom_optional_hover_reference() -> None:
264267
"""Check that optional-hover HTML-based references are expanded and never reported missing."""
265268
with pytest.warns(DeprecationWarning, match="`span` elements are deprecated"):
@@ -279,6 +282,7 @@ def test_custom_optional_hover_reference() -> None:
279282
)
280283

281284

285+
# YORE: Bump 2: Remove block.
282286
def test_legacy_external_references() -> None:
283287
"""Check that external references are marked as such."""
284288
with pytest.warns(DeprecationWarning, match="`span` elements are deprecated"):
@@ -386,6 +390,7 @@ def test_register_markdown_anchors_with_admonition() -> None:
386390
}
387391

388392

393+
# YORE: Bump 2: Remove block.
389394
def test_legacy_keep_data_attributes() -> None:
390395
"""Keep HTML data attributes from autorefs spans."""
391396
with pytest.warns(DeprecationWarning, match="`span` elements are deprecated"):

0 commit comments

Comments
 (0)