[Doc-SIG] image "alt" text

David Goodger goodger@users.sourceforge.net
Wed, 14 Nov 2001 22:25:24 -0500

>> The intended HTML output is::
>>     The <img src="biohazard.png" alt="biohazard"> symbol is
>>     scary-looking.
>> That alt text needs to come from somewhere.

> I remember shelving fleeting thoughts about the "alt" text; time to
> revisit them. OK, there are three possible sources for the alt text:
> 1. The substitution name.
> 2. The source URI or file name.
> 3. Explicit text in the "image" directive.
> I think (2) is the worst option, (3) is the best, and (1) is
> in-between. (1) and/or (2) could be fallbacks when (3) isn't given.
> (3) will require support from the "image" directive; I'll add it. (1)
> would also require changes, and would only be applicable to inline
> images (block-level images won't have a substitution name).

I've implemented "alt" text for images::

    .. image:: picture.png
       [alt="this is the alt text"]

I've decided against any implicit fallbacks; it's explicit or nothing. Also,
I've extracted the attribute parsing code into dps.utils, and extended it to
handle more general cases. Now the same attribute syntax can be used by
other directives. Docs, code, & test cases updated, available by CVS or

David Goodger    goodger@users.sourceforge.net    Open-source projects:
 - Python Docstring Processing System: http://docstring.sourceforge.net
 - reStructuredText: http://structuredtext.sourceforge.net
 - The Go Tools Project: http://gotools.sourceforge.net