Skip to content

Commit

Permalink
alt/title attributes should now appear on img tags even if uid linkin…
Browse files Browse the repository at this point in the history
…g is not enabled, refs https://dev.plone.org/ticket/12322
  • Loading branch information
domenkozar committed Feb 22, 2012
1 parent 3f7f5db commit 80241db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Expand Up @@ -4,6 +4,9 @@ Changelog
1.2 - unreleased
----------------

- alt/title attributes on img tags were not present if tinymce uid linking was not used
[iElectric]

- When making relative URIs absolute, use the parent as the relative
root when the context is not folderish. Fixes an issue where
relative URLs from Plone 3, for example, had the wrong URLs under
Expand Down
5 changes: 3 additions & 2 deletions plone/outputfilters/filters/resolveuid_and_caption.py
Expand Up @@ -94,7 +94,8 @@ def resolve_uids(self):
def is_enabled(self):
if self.context is None:
return False
return self.captioned_images or self.resolve_uids
else:
return True

def __call__(self, data):
self.feed(data)
Expand Down Expand Up @@ -328,7 +329,7 @@ def unknown_starttag(self, tag, attrs):
self.handle_captioned_image(attributes, image, fullimage,
caption)
return True
elif fullimage is not None:
if fullimage is not None:
# Check to see if the alt / title tags need setting
title = aq_acquire(fullimage, 'Title')()
if 'alt' not in attributes:
Expand Down

5 comments on commit 80241db

@yurj
Copy link
Contributor

@yurj yurj commented on 80241db Mar 6, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use the description of the image as the "title" attribute:

            if fullimage is not None:
                # Check to see if the alt / title tags need setting
                title = aq_acquire(fullimage, 'Title')()
                if 'alt' not in attributes:
                    attributes['alt'] = title
                if 'title' not in attributes:
                    attributes['title'] = description or title

I think it is better, and title is given if a description is missing

@domenkozar
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great, can you make a commit/pull request?

@yurj
Copy link
Contributor

@yurj yurj commented on 80241db Mar 8, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ehm, no because I'm still not good on git. Can you do it, they're just one lines? :P

@yurj
Copy link
Contributor

@yurj yurj commented on 80241db May 22, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we did it, but rejected. Can we think to add an option, off by default?

@k-j-kleist
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that #12322 has been reopened. Quoting the last comment:

"We have seen this working correctly with new images in our production 4.1.4 site, and our development 4.1.5 site. However, images that were migrated over from our previous Plone site show the alt attribute displaying the short name. I have tried changing the image, re-saving the image and the page, changing the title in the image itself and the image description in the TinyMCE editor. It always displays the short name in the alt tag. This is a problem as we have several thousand images on our site."

Please sign in to comment.