Skip to content

Commit 383b35d

Browse files
committed
fix(directives): Guard against duplicate deprecated CSS class on multi-fixture pages
why: transform_content() walks all desc nodes in the document and appends spf-deprecated without checking if already present. On a page with multiple deprecated fixtures, each call re-appends to every already-matched parent. what: - Add membership check before appending _CSS.DEPRECATED to parent classes
1 parent d39dc62 commit 383b35d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • packages/sphinx-autodoc-pytest-fixtures/src/sphinx_autodoc_pytest_fixtures

packages/sphinx-autodoc-pytest-fixtures/src/sphinx_autodoc_pytest_fixtures/_directives.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ def transform_content(
298298
for parent in self.state.document.findall(addnodes.desc):
299299
for sig in parent.findall(addnodes.desc_signature):
300300
if sig.get("spf_deprecated"):
301-
parent["classes"].append(_CSS.DEPRECATED)
301+
if _CSS.DEPRECATED not in parent["classes"]:
302+
parent["classes"].append(_CSS.DEPRECATED)
302303
break
303304

304305
# --- Lifecycle callouts (session note + override hook tip) ---

0 commit comments

Comments
 (0)