Menu ▾ ▴

Commit [r10206]  Maximize  Restore  History

rST parser: ensure that nested parsing only appends to the provided base node.

* Always start a new title style hierarchy for nested parsing.
* Append sections to the base node also if it is not a `<document>`
or `<section>` (revert [r10203]).

This change makes the behaviour of nested parsing more uniform and predictable
(independent of type and possible parents of the base node).

It prevents problems with silently dropped higher level sections
in Docutils < 0.22 (because the legacy "raise error and retry" algorithm
of section parsing fails with nested parsing).
It also prevents a wrong node order for sections in Docutils 0.22
(because the calling parser has no means to know the new "insertion point"
and continues where it left before the nested parsing).

milde 2025-08-19

changed /trunk/docutils/HISTORY.rst
changed /trunk/docutils/RELEASE-NOTES.rst
changed /trunk/docutils/docs/ref/rst/directives.rst
changed /trunk/docutils/docs/ref/rst/restructuredtext.rst
changed /trunk/docutils/docutils/parsers/rst/states.py
changed /trunk/docutils/test/test_parsers/test_rst/test_nested_parsing.py
/trunk/docutils/HISTORY.rst Diff Switch to side-by-side view
Loading...
/trunk/docutils/RELEASE-NOTES.rst Diff Switch to side-by-side view
Loading...
/trunk/docutils/docs/ref/rst/directives.rst Diff Switch to side-by-side view
Loading...
/trunk/docutils/docs/ref/rst/restructuredtext.rst Diff Switch to side-by-side view
Loading...
/trunk/docutils/docutils/parsers/rst/states.py Diff Switch to side-by-side view
Loading...
/trunk/docutils/test/test_parsers/test_rst/test_nested_parsing.py Diff Switch to side-by-side view
Loading...