getpelican/pelican — pull request #895 by Rogdham (2013-05-19 14:08:23+00:00)
Title: Add warnings for img with empty alts. Fixes #647.

That issue raises the point that with the rst format, when we don't specify the `alt` attribute, a wrong `alt` get added:

.. image:: |filename|/images/image.png

is turned into

In mkd,

![](|filename|/images/image.png)

is turned into

This PR gives the **same behaviour** in both cases (i.e. an empty `alt=""`), and also **create warnings** if `img` with empty `alt` are found:

WARNING: empty alt attribute for image image.png in /tmp/test/content/post.md

Note that the warnings will also be triggered if someone puts direct HTML in a mkd file for example, but not if that HTML is set to be a code part.

Performances tests (thanks to @justinmayer for all those blog posts to test with):
- before this PR: `Processed 1404 articles and 0 pages in 83.14 seconds.`
- after this PR: `Processed 1404 articles and 0 pages in 83.52 seconds.`

…and there was *a lot* of warnings raised!
So the performances does not seems to be affected by this PR.

*Side note: the `alt` attribute is one of the key points of web accessibility. See the [WCAG page on that](http://www.w3.org/TR/WCAG20-TECHS/H37) for example. Giving a warning if it is missing would be a healthy way to promote best practices which make a difference.*