From fba89be4b1cd3425b5434725b324e4ce260de373 Mon Sep 17 00:00:00 2001 From: mb21 Date: Wed, 22 May 2019 17:35:50 +0200 Subject: [PATCH] HTML writer: emit empty alt tag in figures The same text is already in the
and screen-readers would read it twice, see #4737 --- src/Text/Pandoc/Writers/HTML.hs | 2 +- test/command/3577.md | 6 +++--- test/command/4677.md | 2 +- test/command/5121.md | 2 +- test/writer.html4 | 2 +- test/writer.html5 | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 2c386b465087..5004f4111e34 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -681,7 +681,7 @@ figure :: PandocMonad m => WriterOptions -> Attr -> [Inline] -> (String, String) -> StateT WriterState m Html figure opts attr txt (s,tit) = do - img <- inlineToHtml opts (Image attr txt (s,tit)) + img <- inlineToHtml opts (Image attr [Str ""] (s,tit)) html5 <- gets stHtml5 let tocapt = if html5 then H5.figcaption diff --git a/test/command/3577.md b/test/command/3577.md index dc88937e9438..d1df1610ddd6 100644 --- a/test/command/3577.md +++ b/test/command/3577.md @@ -16,10 +16,10 @@ \end{figure} ^D
-Caption 1
Caption 1
+
Caption 1
-Caption 2
Caption 2
+
Caption 2
``` ``` @@ -30,6 +30,6 @@ \end{figure} ^D
-Caption 3
Caption 3
+
Caption 3
``` diff --git a/test/command/4677.md b/test/command/4677.md index 0343cf42a248..11a62fd08257 100644 --- a/test/command/4677.md +++ b/test/command/4677.md @@ -3,6 +3,6 @@ ![Caption](img.png){#img:1} ^D
-Caption
Caption
+
Caption
``` diff --git a/test/command/5121.md b/test/command/5121.md index 9003cdfec9f2..0f45c4afe984 100644 --- a/test/command/5121.md +++ b/test/command/5121.md @@ -5,7 +5,7 @@ ## Header 2 ^D
-My caption
My caption
+
My caption
Header 2 diff --git a/test/writer.html4 b/test/writer.html4 index 6d15f239ed73..96e8a7979e0b 100644 --- a/test/writer.html4 +++ b/test/writer.html4 @@ -518,7 +518,7 @@ Blah

Images

From “Voyage dans la Lune” by Georges Melies (1902):

-lalune +

lalune

Here is a movie movie icon.

diff --git a/test/writer.html5 b/test/writer.html5 index 88b382ed2906..d26b83d9bf80 100644 --- a/test/writer.html5 +++ b/test/writer.html5 @@ -521,7 +521,7 @@ Blah

Images

From “Voyage dans la Lune” by Georges Melies (1902):

-lalune
lalune
+
lalune

Here is a movie movie icon.