changeset 1997:1bf17e0dd6f1

better alt/title for drawings
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 17 Apr 2007 00:04:29 +0200
parents 6c4f6efbb36e
children a82f06dba7ca
files MoinMoin/formatter/text_html.py
diffstat 1 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/formatter/text_html.py	Mon Apr 16 22:47:28 2007 +0200
+++ b/MoinMoin/formatter/text_html.py	Tue Apr 17 00:04:29 2007 +0200
@@ -684,7 +684,7 @@
 
         # check whether attachment exists, possibly point to upload form
         if not exists:
-            linktext = _('Create new drawing "%(filename)s"')
+            linktext = _('Create new drawing "%(filename)s (opens in new window)"')
             return wikiutil.link_tag(
                 self.request,
                 ('%s?action=AttachFile&rename=%s%s' %
@@ -715,25 +715,24 @@
                 # add alt and title tags to areas
                 map = re.sub('href\s*=\s*"((?!%TWIKIDRAW%).+?)"', r'href="\1" alt="\1" title="\1"', map)
                 # add in edit links plus alt and title attributes
-                map = map.replace('%TWIKIDRAW%"',
-                                  edit_link + 
-                                  '" alt="' + _('Edit drawing %(filename)s') % {'filename': self.text(fname)} + 
-                                  '" title="' + _('Edit drawing %(filename)s') % {'filename': self.text(fname)} +
-                                  '"')
+                alt = title =  _('Edit drawing %(filename)s (opens in new window)') % {'filename': self.text(fname)}
+                map = map.replace('%TWIKIDRAW%"', '%s" alt="%s" title="%s"' % (edit_link, alt, title))
                 # unxml, because 4.01 concrete will not validate />
                 map = map.replace('/>', '>')
+                alt = title = _('Clickable drawing: %(filename)s') % {'filename': self.text(fname)}
                 return (map + self.image(
-                    alt=drawing,
-                    src=AttachFile.getAttachUrl(
-                    pagename, filename, self.request,
-                    addts=1),
+                    alt=alt,
+                    title=title,
+                    src=AttachFile.getAttachUrl(pagename, filename, self.request, addts=1),
                     usemap='#'+mapid, css="drawing"))
         else:
+            alt = title =  _('Edit drawing %(filename)s (opens in new window)') % {'filename': self.text(fname)}
             return wikiutil.link_tag(self.request,
                                      edit_link,
-                                     self.image(alt=url,
+                                     self.image(alt=alt,
+                                                title=title,
                                                 src=AttachFile.getAttachUrl(pagename, filename, self.request, addts=1), css="drawing"),
-                                     title="%s" % (_('Edit drawing %(filename)s') % {'filename': self.text(fname)}))
+                                     title=title)
 
 
     # Text ##############################################################