#!/usr/bin/env python # -*- coding: utf-8 -*- import re, time import wikipedia, pagegenerators # Text for translation # # Magic words: %(title)s %(url)s %(parseddate)s lead = { 'en': u"""
Alternative text (alt text) is meant for readers who cannot see an image, such as blind readers and readers who use a text or mobile browser. It should summarize an image's appearance, and should not duplicate its caption. Every image should have alt text, except for purely decorative images, which should instead have "|link=".
The following table shows images and captions on the left, and alt text and captions on the right: the right column is what a visually impaired reader will hear. This table was computed from the copy of %(title)s cached on %(parseddate)s.
""", 'simple':u"""Alternative text (alt text) is suppose to tell the important features to a person who cannot see the image due to non-graphical or mobile browser or blindness.
The following table shows pictures on the left and the alternative text for the picture on the right which a blind person might hear. This table was computed from the copy of %(title)s cached on %(parseddate)s.
""", } ImageDesc = { 'en': "Image and thumbnail", 'de': "Bild und miniaturbild", 'simple': "Pictures", } AltDesc = { 'en': "Text description", 'de': "alttext", 'simple': "Text for the blind", } # Regular expression for getting images ImageR = re.compile(r'''(?six) # Video posters| %s | %s |
|---|---|
%s | '%(image.group().replace('="/', '="%s/'%wgServer),)
if image.group('videoalt') is not None:
print image.group().replace(image.group('poster'), " %s "%(image.group('videoalt')=='' and 'defaultalt' or '', image.group('videoalt'))).replace(image.group('videomagnify'), '').replace('="/', '="%s/'%wgServer)
elif image.group('thumbalt') is not None:
print image.group().replace(image.group('image'), "%s "%(image.group('thumbalt')=='' and 'defaultalt' or '', image.group('thumbalt'))).replace(image.group('thumbmagnify'), '').replace('="/', '="%s/'%wgServer)
elif image.group('imagealt') is not None:
print '%s ' % (image.group('imagealt')=='' and 'defaultalt' or '', image.group('imagewidth'), image.group('imagealt') and '%s' % image.group('imagealt') or '')
elif image.group('decalt') is not None:
print '%s ' % (image.group('decalt'), )
else:
raise
print '(Unlinked image) |