Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sphinx_needs/functions/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ def find_and_replace_node_content(
new_child = find_and_replace_node_content(child, env, need)
new_children.append(new_child)
node.children = new_children
for subchild in node.children:
node.setup_child(subchild)
else:
node = nodes.Text(new_text)
return node
Expand All @@ -269,6 +271,8 @@ def find_and_replace_node_content(
new_child = find_and_replace_node_content(child, env, need)
new_children.append(new_child)
node.children = new_children
for subchild in node.children:
node.setup_child(subchild)
return node


Expand Down
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ def sphinx_test_tempdir(request) -> path:
return sphinx_test_tempdir


def test_check_parent_child(app: Sphinx, doctree: document, docname: str):
for idx, node in enumerate(doctree.findall()):
if idx == 0:
continue
assert node.parent


@pytest.fixture(scope="function")
def test_app(make_app, sphinx_test_tempdir, request):
"""
Expand Down Expand Up @@ -330,6 +337,8 @@ def test_app(make_app, sphinx_test_tempdir, request):
# ``test_js`` behaves like a method.
app.test_js = test_js.__get__(app, Sphinx)

app.connect("doctree-resolved", test_check_parent_child, priority=999)

yield app

app.cleanup()
Expand Down