Defect #40650
closedFix duplicate alt and title attributes when alt text is specified for attached images in Textile formatter
0%
Description
This patch fixes the following problems when specifying alt text for attached images in Textile format.
- When a description is set for an attached image, the specified alt text is ignored and the description of the attached image takes effect.
- Incorrect img tags are generated with duplicate definitions of alt and title attributes.
!ruby-logo.png(alt text)!
When “description” is set in the description of the attached image ruby-logo.png, the result of the above Textile is as follows
Wiki (when hovering over the image) | Generated HTML |
---|---|
|
The current implementation expects to generate an img tag with “alt text” applied to the alt and title attributes, but actually generates an img tag with “description” applied.
This is due to the fact that the img tag defines two alt attributes (title attribute) with the values “alt text” and “description”; the HTML specification does not allow duplicate attributes (13.1.2.3 Attributes), and attributes defined later are ignored.
The result after applying the attached patch is as follows
Wiki (when hovering over the image) | Generated HTML |
---|---|
|
The CommonMark format should not be affected by this problem. Please see the attached test code for the first and second patches.
My environment is as follows
Environment: Redmine version 5.1.2.devel Ruby version 3.3.1-p55 (2024-04-23) [x86_64-linux] Rails version 7.1.2 Environment development Database adapter SQLite Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp Redmine settings: Redmine theme Default SCM: Subversion 1.14.2 Mercurial 6.3.2 Cvs 1.12.13 Bazaar 3.3.2 Git 2.39.2 Filesystem Redmine plugins: no plugin installed
Files
Updated by Go MAEDA 6 months ago
- Subject changed from Fix alt and title attributes when alt text is specified for attached images in Textile format. to Fix duplicate alt and title attributes when alt text is specified for attached images in Textile formatter
- Category changed from Wiki to Text formatting
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed