Re: closing a header block
Guenter Milde via Docutils-users <[email protected]> Thu, 27 May 2021 11:25:45 -0000 (UTC)
| Newsgroups | gmane.text.docutils.user |
|---|---|
| Message-ID | <[email protected]> |
On 2021-05-26, Sidney Cadot wrote: > I am using docutils through Sphinx, and I am running into an issue there, > which I think should best be solved in the RsT parsing stage. ... > ... if I want to "pop" a heading level to the next higher (or any > higher) level without introducing a new header, I am stuck. ... > So I want my parse tree to be (again in pseudo-xml): > *<section level="1">* > * <p>First lorem ipsum etc. etc.</p>* > * <section level="2">* > * <p>Second lorem ipsum etc. etc.</p>* > * </section>* > * <p>Alea iacta est!</p>* > *</section>* > I have a few questions.... > First, is this already somehow possible? Is there some syntax that directs > the parser to produce the second parse tree? This is not only impossible (with standard rST syntax), it is also an invalid Doctils document tree. https://docutils.sourceforge.io/docs/ref/docutils.dtd https://docutils.sourceforge.io/docs/ref/doctree.html#element-hierarchy > Second, if not: is there a fundamental reason why the second parse-tree > would be incompatible with the document model of RsT? (If that's the case, > why?) See the link below. > Third, if it is possible in principle, but not yet in practice, is there a > way to implement this without touching the parser; say, by adding a > docutils Directive? E.g. something that would work like this? A similar request was filed to the issue tracker. https://sourceforge.net/p/docutils/feature-requests/74 It turned out to be about an intermediate structure (adding sections by a directive). In this case, the resulting doctree would be valid but telling the section-adding-directive where to add these sections seems a better solution than changing rST syntax or adding a section-closing directive in Docutils. Günter _______________________________________________ Docutils-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/docutils-users Please use "Reply All" to reply to the list.