Correct test/test.html. Should be <img> not <a>.
Remove code smell, and in the process discover/fix a bug.

For images with reference links, was generating <a> but should have
been <img>.