git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: emit empty alt tag in figures (#5518)

The same text is already in the <figcaption> and screen-readers would read it twice, see #4737

commit3f57f49033d78fab158af77983611ffcb5cac4bc authorMauro Bieg <mb21@users.noreply.github.com> dateTue 28 May 2019, 18:31 (7 years ago) parent0e2d656
6 files changed+8−8
src/Text/Pandoc/Writers/HTML.hs+1−1 test/command/3577.md+3−3 test/command/4677.md+1−1 test/command/5121.md+1−1 test/writer.html4+1−1 test/writer.html5+1−1
src/Text/Pandoc/Writers/HTML.hs+1−1
@@ -681,7 +681,7 @@ figure :: PandocMonad m
681681 => WriterOptions -> Attr -> [Inline] -> (String, String)
682682 -> StateT WriterState m Html
683683figure opts attr txt (s,tit) = do
684− img <- inlineToHtml opts (Image attr txt (s,tit))
684+ img <- inlineToHtml opts (Image attr [Str ""] (s,tit))
685685 html5 <- gets stHtml5
686686 let tocapt = if html5
687687 then H5.figcaption
test/command/3577.md+3−3
@@ -16,10 +16,10 @@
1616\end{figure}
1717^D
1818<figure>
19−<img src="img1.jpg" alt="Caption 1" /><figcaption>Caption 1</figcaption>
19+<img src="img1.jpg" alt="" /><figcaption>Caption 1</figcaption>
2020</figure>
2121<figure>
22−<img src="img2.jpg" alt="Caption 2" /><figcaption>Caption 2</figcaption>
22+<img src="img2.jpg" alt="" /><figcaption>Caption 2</figcaption>
2323</figure>
2424```
2525```
@@ -30,6 +30,6 @@
3030\end{figure}
3131^D
3232<figure>
33−<img src="img1.jpg" alt="Caption 3" /><figcaption>Caption 3</figcaption>
33+<img src="img1.jpg" alt="" /><figcaption>Caption 3</figcaption>
3434</figure>
3535```
test/command/4677.md+1−1
@@ -3,6 +3,6 @@
33![Caption](img.png){#img:1}
44^D
55<figure>
6−<img src="img.png" alt="Caption" id="img:1" /><figcaption>Caption</figcaption>
6+<img src="img.png" alt="" id="img:1" /><figcaption>Caption</figcaption>
77</figure>
88```
test/command/5121.md+1−1
@@ -5,7 +5,7 @@
55## Header 2
66^D
77<figure>
8−<img src="./my-figure.jpg" alt="My caption" width="500" /><figcaption>My caption</figcaption>
8+<img src="./my-figure.jpg" alt="" width="500" /><figcaption>My caption</figcaption>
99</figure>
1010
1111Header 2
test/writer.html4+1−1
@@ -518,7 +518,7 @@ Blah
518518<h1 id="images">Images</h1>
519519<p>From “Voyage dans la Lune” by Georges Melies (1902):</p>
520520<div class="figure">
521−<img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune" />
521+<img src="lalune.jpg" title="Voyage dans la Lune" alt="" />
522522<p class="caption">lalune</p>
523523</div>
524524<p>Here is a movie <img src="movie.jpg" alt="movie" /> icon.</p>
test/writer.html5+1−1
@@ -521,7 +521,7 @@ Blah
521521<h1 id="images">Images</h1>
522522<p>From “Voyage dans la Lune” by Georges Melies (1902):</p>
523523<figure>
524−<img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune" /><figcaption>lalune</figcaption>
524+<img src="lalune.jpg" title="Voyage dans la Lune" alt="" /><figcaption>lalune</figcaption>
525525</figure>
526526<p>Here is a movie <img src="movie.jpg" alt="movie" /> icon.</p>
527527<hr />