[docutils:bugs] #466 Should docutils whine about nesting simple body elements?

"Günter Milde" via Docutils-develop <[email protected]>
Newsgroups gmane.text.docutils.devel
Message-ID </p/docutils/bugs/466/1ae48d967f4e466a89553857ead5c20dccad794e.bugs@docutils.p.sourceforge.net>
Nesting paragraphs in paragraphs is indeed a violation of the Docutils document model [docutils.dtd](https://docutils.sourceforge.io/docs/ref/docutils.dtd).
Unfortunately, this is just one example of an "infinite" number of ways you can build invalid documents -- testing for all sorts of violations by custom code may seriously affect performance.

You may consider exporting a test document to XML and test for validity against the docutils.dtd.


---

** [bugs:#466] Should docutils whine about nesting simple body elements?**

**Status:** open
**Created:** Thu Feb 09, 2023 09:55 AM UTC by Julien Palard
**Last Updated:** Thu Feb 09, 2023 09:55 AM UTC
**Owner:** nobody


Context:

[This](https://github.com/python/cpython/blob/45fa12aec8f508c224a1521cfe3ae597f1026264/Doc/tools/extensions/pyspecific.py#L149) call to `nested_parse` adds a `Paragraph` node to a `Paragraph` node,  this look forbidden by [the doc](https://docutils.sourceforge.io/docs/ref/doctree.html#body-elements), and it also look to misbehave sphinx-side, when translating the document, where we completly loose the nested paragraph once translated.

It renders properly though when **not** translated.

The linked `nested_parse` returns:

```xml
<paragraph classes="availability">
    <pending_xref refdoc="index" refdomain="std" refexplicit="True" reftarget="availability" reftype="ref" refwarn="True">
        <inline classes="xref std std-ref">
            Availability
    : 
    Unix, not Emscripten, not WASI.
    <paragraph>
        Hello world I'm the content of the "availability" directive.
```

If it's really something that should not be done, maybe some kind of warning at build time could help debugging those issues?



---

Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.