|
From: Günter M. <mi...@us...> - 2024-07-28 10:52:55
|
Commit [r9780] announces the change to mandatory labels for footnote and label in Docutils 1.0.
Commit [r9781] implements a rST parser warning for empty footnotes and labels.
TODO: allow figures without caption/legend?
---
**[bugs:#489] Issues with the Docutils Doctree**
**Status:** open
**Created:** Tue Jun 11, 2024 12:13 PM UTC by Günter Milde
**Last Updated:** Tue Jun 11, 2024 12:13 PM UTC
**Owner:** nobody
There are a number of discrepancies between the [Docutils Generic DTD][docutils.dtd]
and the implementation in Docutils code.
footnote
--------
[docutils.dtd][docutils.dtd]: `(label?, (%body.elements;)+)`
→ Label **optional**, content **required**; (not changed since 2002-04-20).
[reStructureText Markup Specification][rST spec]:
> Each footnote consists of an explicit markup start (".. "), a left
> square bracket, **the footnote label**, a right square bracket, and
> whitespace, followed by indented body elements.
The `footnote` class in [docutils.nodes](https://docutils.sourceforge.io/docutils/nodes.py) is a subclass of `Labeled`,
whose docstring says: "**Contains a label** as its first element."
The rST parser **requires** a label but allows **empty footnotes**
(cf. `test/test_writers/test_latex2e.py`).
citation
--------
[docutils.dtd][docutils.dtd]: `(label, (%body.elements;)+)`
→ Label **required**, content **required**; (not changed since 2002-04-20).
[reStructureText Markup Specification][rST spec]:
> Citations are **identical to footnotes** except that they use only
> non-numeric labels …
The rST parser allows **empty citations** (cf. test_rst/test_citations.py).
figure
------
[docutils.dtd][docutils.dtd]: `(image, ((caption, legend?) | legend))`
→ caption or legend **required**; (not changed since 2002-04-20).
[reStructuredText Directives](https://docutils.sourceforge.io/docs/ref/rst/directives.html#figure)
> A "figure" consists of image data (including image options), an **optional
> caption** (a single paragraph), and an **optional legend** (arbitrary body
> elements). For page-based output media, figures might float to a different
> position if this helps the page layout.
The rST parser allows **figures without caption or legend**.
Docutils HTML and LaTeX writers use a different layout for figures vs.
images. They can handle figures without caption/legend.
Suggestion
----------
* Make *footnote label compulsory`*.
* Let rST report a *warning for empty footnote and citation*.
Remove tests with empty footnote and citation.
* Allow *figures without caption/legend* in the Docutils Generic DTD.
(Change in Docutils 1.0, announce in 0.22.)
Questions
---------
Are there a use cases for
* footnotes without label,
* footnotes without content,
* citations without content?
[docutils.dtd]: https://docutils.sourceforge.io/docs/ref/docutils.dtd
[rST spec]: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html
---
Sent from sourceforge.net because doc...@li... 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. |