[go: up one dir, main page]

Menu

Commit [r9950]  Maximize  Restore  History

Allow transient elements `<target>` and `<pending>` before a figure `<caption>`.

In rST, the "figure" directive's content must start with a paragraph (that
becomes the caption) or an empty comment (to get a legend without caption).

The change allows passing a "classes" or "names" attribute value to the
figure caption via the "class" directive rsp. an internal hyperlink target.

Change the `references.PropagateTargets` transform to remove a `<target>`
element followed by a `<caption>` (after propagating ids and names)
to keep the doctree valid.

Fix the HTML5 writer, to apply the attributes to the `<figcaption>` element,
(instead of the included `<p>`).

Fix LaTeX writer to handle "classes" and "ids" attributes of a `<caption>`
element.

Add test cases.
Remove misleading test case. Figures without caption are invalid and won't get
a "Figure 1."-style caption with the Docutils writers.

milde 2024-10-15

changed /trunk/docutils/docutils/parsers/rst/directives/images.py
changed /trunk/docutils/docutils/transforms/references.py
changed /trunk/docutils/docutils/writers/html5_polyglot/__init__.py
changed /trunk/docutils/docutils/writers/latex2e/__init__.py
changed /trunk/docutils/test/functional/expected/latex_memoir.tex
changed /trunk/docutils/test/functional/expected/standalone_rst_docutils_xml.xml
changed /trunk/docutils/test/functional/expected/standalone_rst_html4css1.html
changed /trunk/docutils/test/functional/expected/standalone_rst_html5.html
changed /trunk/docutils/test/functional/expected/standalone_rst_latex.tex
changed /trunk/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
changed /trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
changed /trunk/docutils/test/functional/input/data/standard.rst
changed /trunk/docutils/test/functional/tests/standalone_rst_docutils_xml.py
changed /trunk/docutils/test/test_parsers/test_rst/test_directives/test_figures.py