aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-07-12 08:43:26 -0700
committerJohn MacFarlane <[email protected]>2023-07-12 09:13:32 -0700
commit29c5afb305c32129db4e81cd489cd3bd2a14c2e9 (patch)
treef374ef2ee808802dee471d0a218fdfbe91e6fded /test
parent21b51d214d10062fd3f128814832beb12d11e804 (diff)
RST writer: fix figure handling.
This fixes a number of regressions from pandoc 2.x. Properly handle caption, alt attribute in figures. No longer treat a paragraph with a single image in it as a figure (we have a dedicated Figure element now). Closes #8930, closes #8871.
Diffstat (limited to 'test')
-rw-r--r--test/command/4420.md6
-rw-r--r--test/command/6948.md6
-rw-r--r--test/command/figures-rst.md3
-rw-r--r--test/writer.rst2
4 files changed, 10 insertions, 7 deletions
diff --git a/test/command/4420.md b/test/command/4420.md
index 9d809a106..11eaabd81 100644
--- a/test/command/4420.md
+++ b/test/command/4420.md
@@ -2,8 +2,8 @@
% pandoc -f native -t rst
[Para [Image ("",["align-right"],[("width","100px")]) [Str "image"] ("foo.png","fig:test")]]
^D
-.. image:: foo.png
- :alt: image
- :align: right
+|image|
+
+.. |image| image:: foo.png
:width: 100px
```
diff --git a/test/command/6948.md b/test/command/6948.md
index 8803aebe9..844ef7f96 100644
--- a/test/command/6948.md
+++ b/test/command/6948.md
@@ -4,9 +4,9 @@ as an independent image:
% pandoc -f native -t rst
[Para [Image ("",["align-center"],[]) [Str "https://pandoc.org/diagram.jpg"] ("https://pandoc.org/diagram.jpg","")]]
^D
-.. image:: https://pandoc.org/diagram.jpg
- :alt: https://pandoc.org/diagram.jpg
- :align: center
+|https://pandoc.org/diagram.jpg|
+
+.. |https://pandoc.org/diagram.jpg| image:: https://pandoc.org/diagram.jpg
```
Here we just omit the center attribute as it's not valid:
diff --git a/test/command/figures-rst.md b/test/command/figures-rst.md
index fac1145ad..a5f22daa1 100644
--- a/test/command/figures-rst.md
+++ b/test/command/figures-rst.md
@@ -6,5 +6,8 @@ Figure float with caption at the figure level.
^D
.. figure:: foo.png
+ name: fig-id
:alt: fig:
+
+ Caption
```
diff --git a/test/writer.rst b/test/writer.rst
index d4a0f7335..17fa7f419 100644
--- a/test/writer.rst
+++ b/test/writer.rst
@@ -784,7 +784,7 @@ Images
From “Voyage dans la Lune” by Georges Melies (1902):
.. figure:: lalune.jpg
- :alt: Voyage dans la Lune
+ :alt: lalune
lalune