Skip to content

Commit 989989b

Browse files
committed
conditionally monkey patch nested_parse_with_titles
See sphinx-doc/sphinx#12492
1 parent b62dbaa commit 989989b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sphinx_immaterial/apidoc/fix_sphinx_issue_11147.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sphinx.directives
66
import sphinx.util.nodes
77
import sphinx.util.docutils
8+
import sphinx
89

910

1011
def _monkey_patch_nested_parse_with_titles():
@@ -28,7 +29,8 @@ def nested_parse_with_titles(state, content, node):
2829
return orig_nested_parse_with_titles(state, content, node)
2930

3031
sphinx.util.nodes.nested_parse_with_titles = nested_parse_with_titles # type: ignore[assignment]
31-
sphinx.directives.nested_parse_with_titles = nested_parse_with_titles # type: ignore[assignment]
32+
if sphinx.version_info < (7, 4):
33+
sphinx.directives.nested_parse_with_titles = nested_parse_with_titles # type: ignore[assignment,attr-defined]
3234

3335

3436
_monkey_patch_nested_parse_with_titles()

0 commit comments

Comments
 (0)