Index: trunk/phase3/maintenance/parserTests.txt |
— | — | @@ -3128,11 +3128,20 @@ |
3129 | 3129 | !! input |
3130 | 3130 | [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]] |
3131 | 3131 | !! result |
3132 | | -<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="This is a test image Main Page"><img alt="This is a test image Main Page" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div> |
| 3132 | +<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="This is a test image Main Page"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div> |
3133 | 3133 | |
3134 | 3134 | !! end |
3135 | 3135 | |
3136 | 3136 | !! test |
| 3137 | +Image with frame and link and explicit alt |
| 3138 | +!! input |
| 3139 | +[[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]] |
| 3140 | +!! result |
| 3141 | +<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="This is a test image Main Page"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div> |
| 3142 | + |
| 3143 | +!! end |
| 3144 | + |
| 3145 | +!! test |
3137 | 3146 | Link to image page- image page normally doesn't exists, hence edit link |
3138 | 3147 | Add test with existing image page |
3139 | 3148 | #<p><a href="https://www.mediawiki.org/wiki/Image:Test" title="Image:Test">Image:test</a> |
— | — | @@ -3157,16 +3166,25 @@ |
3158 | 3167 | !! input |
3159 | 3168 | [[Image:foobar.jpg|thumb|http://example.com]] |
3160 | 3169 | !! result |
3161 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a></div></div></div> |
| 3170 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a></div></div></div> |
3162 | 3171 | |
3163 | 3172 | !! end |
3164 | 3173 | |
3165 | 3174 | !! test |
| 3175 | +Thumbnail image caption with a free URL and explicit alt |
| 3176 | +!! input |
| 3177 | +[[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]] |
| 3178 | +!! result |
| 3179 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a></div></div></div> |
| 3180 | + |
| 3181 | +!! end |
| 3182 | + |
| 3183 | +!! test |
3166 | 3184 | BUG 1887: A ISBN with a thumbnail |
3167 | 3185 | !! input |
3168 | 3186 | [[Image:foobar.jpg|thumb|ISBN 1235467890]] |
3169 | 3187 | !! result |
3170 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="ISBN 1235467890"><img alt="ISBN 1235467890" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="https://www.mediawiki.org/wiki/Special:BookSources/1235467890" class="internal">ISBN 1235467890</a></div></div></div> |
| 3188 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="ISBN 1235467890"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="https://www.mediawiki.org/wiki/Special:BookSources/1235467890" class="internal">ISBN 1235467890</a></div></div></div> |
3171 | 3189 | |
3172 | 3190 | !! end |
3173 | 3191 | |
— | — | @@ -3175,7 +3193,7 @@ |
3176 | 3194 | !! input |
3177 | 3195 | [[Image:foobar.jpg|thumb|This is RFC 12354]] |
3178 | 3196 | !! result |
3179 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="This is RFC 12354"><img alt="This is RFC 12354" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a href="http://tools.ietf.org/html/rfc12354" class="external" title="http://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div> |
| 3197 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="This is RFC 12354"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a href="http://tools.ietf.org/html/rfc12354" class="external" title="http://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div> |
3180 | 3198 | |
3181 | 3199 | !! end |
3182 | 3200 | |
— | — | @@ -3184,7 +3202,7 @@ |
3185 | 3203 | !! input |
3186 | 3204 | [[Image:foobar.jpg|thumb|Please mailto:[email protected]]] |
3187 | 3205 | !! result |
3188 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="Please mailto:[email protected]"><img alt="Please mailto:[email protected]" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a href="mailto:[email protected]" class="external free" title="mailto:[email protected]" rel="nofollow">mailto:[email protected]</a></div></div></div> |
| 3206 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="Please mailto:[email protected]"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a href="mailto:[email protected]" class="external free" title="mailto:[email protected]" rel="nofollow">mailto:[email protected]</a></div></div></div> |
3189 | 3207 | |
3190 | 3208 | !! end |
3191 | 3209 | |
— | — | @@ -3194,7 +3212,7 @@ |
3195 | 3213 | !! input |
3196 | 3214 | [[Image:foobar.jpg|thumb|<math>2+2</math>]] |
3197 | 3215 | !! result |
3198 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="<math>2+2</math>"><img alt="<math>2+2</math>" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><math>2+2</math></div></div></div> |
| 3216 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="<math>2+2</math>"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><math>2+2</math></div></div></div> |
3199 | 3217 | |
3200 | 3218 | !! end |
3201 | 3219 | |
— | — | @@ -3205,7 +3223,7 @@ |
3206 | 3224 | !! input |
3207 | 3225 | [[Image:foobar.jpg|thumb|<math>2+2</math>]] |
3208 | 3226 | !! result |
3209 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="2 + 2"><img alt="2 + 2" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><span class="texhtml">2 + 2</span></div></div></div> |
| 3227 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="2 + 2"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><span class="texhtml">2 + 2</span></div></div></div> |
3210 | 3228 | |
3211 | 3229 | !! end |
3212 | 3230 | |
— | — | @@ -3278,7 +3296,7 @@ |
3279 | 3297 | !! input |
3280 | 3298 | [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]] |
3281 | 3299 | !! result |
3282 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="This is a caption with another Image:Icon.png inside it!"><img alt="This is a caption with another Image:Icon.png inside it!" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=Icon.png" class="new" title="Image:Icon.png">Image:Icon.png</a> inside it!</div></div></div> |
| 3300 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="This is a caption with another Image:Icon.png inside it!"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=Icon.png" class="new" title="Image:Icon.png">Image:Icon.png</a> inside it!</div></div></div> |
3283 | 3301 | |
3284 | 3302 | !! end |
3285 | 3303 | |
— | — | @@ -3298,7 +3316,7 @@ |
3299 | 3317 | !! input |
3300 | 3318 | [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]] |
3301 | 3319 | !! result |
3302 | | -<div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="This caption has irc and Secure ext links in it."><img alt="This caption has irc and Secure ext links in it." src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a href="irc://example.net" class="external text" title="irc://example.net" rel="nofollow">irc</a> and <a href="https://example.com" class="external text" title="https://example.com" rel="nofollow">Secure</a> ext links in it.</div></div></div> |
| 3320 | +<div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="This caption has irc and Secure ext links in it."><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a href="irc://example.net" class="external text" title="irc://example.net" rel="nofollow">irc</a> and <a href="https://example.com" class="external text" title="https://example.com" rel="nofollow">Secure</a> ext links in it.</div></div></div> |
3303 | 3321 | |
3304 | 3322 | !! end |
3305 | 3323 | |
— | — | @@ -7115,7 +7133,7 @@ |
7116 | 7134 | !! input |
7117 | 7135 | [[Image:Foobar.jpg|thumb|http://x|hello]] |
7118 | 7136 | !! result |
7119 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="hello"><img alt="hello" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div> |
| 7137 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="image" title="hello"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/https/static-codereview.wikimedia.org/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div> |
7120 | 7138 | |
7121 | 7139 | !! end |
7122 | 7140 | |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -4224,7 +4224,7 @@ |
4225 | 4225 | 'vertAlign' => array( 'baseline', 'sub', 'super', 'top', 'text-top', 'middle', |
4226 | 4226 | 'bottom', 'text-bottom' ), |
4227 | 4227 | 'frame' => array( 'thumbnail', 'manualthumb', 'framed', 'frameless', |
4228 | | - 'upright', 'border', 'link' ), |
| 4228 | + 'upright', 'border', 'link', 'alt' ), |
4229 | 4229 | ); |
4230 | 4230 | static $internalParamMap; |
4231 | 4231 | if ( !$internalParamMap ) { |
— | — | @@ -4260,16 +4260,17 @@ |
4261 | 4261 | function makeImage( $title, $options, $holders = false ) { |
4262 | 4262 | # Check if the options text is of the form "options|alt text" |
4263 | 4263 | # Options are: |
4264 | | - # * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang |
4265 | | - # * left no resizing, just left align. label is used for alt= only |
4266 | | - # * right same, but right aligned |
4267 | | - # * none same, but not aligned |
4268 | | - # * ___px scale to ___ pixels width, no aligning. e.g. use in taxobox |
4269 | | - # * center center the image |
4270 | | - # * framed Keep original image size, no magnify-button. |
4271 | | - # * frameless like 'thumb' but without a frame. Keeps user preferences for width |
4272 | | - # * upright reduce width for upright images, rounded to full __0 px |
4273 | | - # * border draw a 1px border around the image |
| 4264 | + # * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang |
| 4265 | + # * left no resizing, just left align. label is used for alt= only |
| 4266 | + # * right same, but right aligned |
| 4267 | + # * none same, but not aligned |
| 4268 | + # * ___px scale to ___ pixels width, no aligning. e.g. use in taxobox |
| 4269 | + # * center center the image |
| 4270 | + # * framed Keep original image size, no magnify-button. |
| 4271 | + # * frameless like 'thumb' but without a frame. Keeps user preferences for width |
| 4272 | + # * upright reduce width for upright images, rounded to full __0 px |
| 4273 | + # * border draw a 1px border around the image |
| 4274 | + # * alt Text for HTML alt attribute (defaults to empty) |
4274 | 4275 | # vertical-align values (no % or length right now): |
4275 | 4276 | # * baseline |
4276 | 4277 | # * sub |
— | — | @@ -4338,9 +4339,11 @@ |
4339 | 4340 | } else { |
4340 | 4341 | # Validate internal parameters |
4341 | 4342 | switch( $paramName ) { |
4342 | | - case "manualthumb": |
4343 | | - /// @fixme - possibly check validity here? |
4344 | | - /// downstream behavior seems odd with missing manual thumbs. |
| 4343 | + case 'manualthumb': |
| 4344 | + case 'alt': |
| 4345 | + // @fixme - possibly check validity here for |
| 4346 | + // manualthumb? downstream behavior seems odd with |
| 4347 | + // missing manual thumbs. |
4345 | 4348 | $validated = true; |
4346 | 4349 | break; |
4347 | 4350 | case 'link': |
— | — | @@ -4390,24 +4393,48 @@ |
4391 | 4394 | $params['frame']['valign'] = key( $params['vertAlign'] ); |
4392 | 4395 | } |
4393 | 4396 | |
4394 | | - # Strip bad stuff out of the alt text |
4395 | | - # We can't just use replaceLinkHoldersText() here, because if this function |
4396 | | - # is called from replaceInternalLinks2(), mLinkHolders won't be up to date. |
| 4397 | + $params['frame']['caption'] = $caption; |
| 4398 | + |
| 4399 | + # Strip bad stuff out of the title (tooltip). We can't just use |
| 4400 | + # replaceLinkHoldersText() here, because if this function is called |
| 4401 | + # from replaceInternalLinks2(), mLinkHolders won't be up-to-date. |
4397 | 4402 | if ( $holders ) { |
4398 | | - $alt = $holders->replaceText( $caption ); |
| 4403 | + $tooltip = $holders->replaceText( $caption ); |
4399 | 4404 | } else { |
4400 | | - $alt = $this->replaceLinkHoldersText( $caption ); |
| 4405 | + $tooltip = $this->replaceLinkHoldersText( $caption ); |
4401 | 4406 | } |
4402 | 4407 | |
4403 | 4408 | # make sure there are no placeholders in thumbnail attributes |
4404 | 4409 | # that are later expanded to html- so expand them now and |
4405 | 4410 | # remove the tags |
4406 | | - $alt = $this->mStripState->unstripBoth( $alt ); |
4407 | | - $alt = Sanitizer::stripAllTags( $alt ); |
| 4411 | + $tooltip = $this->mStripState->unstripBoth( $tooltip ); |
| 4412 | + $tooltip = Sanitizer::stripAllTags( $tooltip ); |
4408 | 4413 | |
4409 | | - $params['frame']['alt'] = $alt; |
4410 | | - $params['frame']['caption'] = $caption; |
| 4414 | + $params['frame']['title'] = $tooltip; |
4411 | 4415 | |
| 4416 | + # In the old days, [[Image:Foo|text...]] would set alt text. Later it |
| 4417 | + # came to also set the caption, ordinary text after the image -- which |
| 4418 | + # makes no sense, because that just repeats the text multiple times in |
| 4419 | + # screen readers. It *also* came to set the title attribute. |
| 4420 | + # |
| 4421 | + # Now that we have an alt attribute, we should not set the alt text to |
| 4422 | + # equal the caption: that's worse than useless, it just repeats the |
| 4423 | + # text. This is the framed/thumbnail case. If there's no caption, we |
| 4424 | + # use the unnamed parameter for alt text as well, just for the time be- |
| 4425 | + # ing, if the unnamed param is set and the alt param is not. |
| 4426 | + # |
| 4427 | + # For the future, we need to figure out if we want to tweak this more, |
| 4428 | + # e.g., introducing a title= parameter for the title; ignoring the un- |
| 4429 | + # named parameter entirely for images without a caption; adding an ex- |
| 4430 | + # plicit caption= parameter and preserving the old magic unnamed para- |
| 4431 | + # meter for BC; ... |
| 4432 | + if( $caption !== '' && !isset( $params['frame']['alt'] ) |
| 4433 | + && !isset( $params['frame']['framed'] ) |
| 4434 | + && !isset( $params['frame']['thumbnail'] ) |
| 4435 | + && !isset( $params['frame']['manualthumb'] ) ) { |
| 4436 | + $params['frame']['alt'] = $tooltip; |
| 4437 | + } |
| 4438 | + |
4412 | 4439 | wfRunHooks( 'ParserMakeImageParams', array( $title, $file, &$params ) ); |
4413 | 4440 | |
4414 | 4441 | # Linker does the rest |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -730,11 +730,12 @@ |
731 | 731 | $page = isset( $hp['page'] ) ? $hp['page'] : false; |
732 | 732 | if ( !isset( $fp['align'] ) ) $fp['align'] = ''; |
733 | 733 | if ( !isset( $fp['alt'] ) ) $fp['alt'] = ''; |
| 734 | + # Backward compatibility, title used to always be equal to alt text |
| 735 | + if ( !isset( $fp['title'] ) ) $fp['title'] = $fp['alt']; |
734 | 736 | |
735 | 737 | $prefix = $postfix = ''; |
736 | 738 | |
737 | | - if ( 'center' == $fp['align'] ) |
738 | | - { |
| 739 | + if ( 'center' == $fp['align'] ) { |
739 | 740 | $prefix = '<div class="center">'; |
740 | 741 | $postfix = '</div>'; |
741 | 742 | $fp['align'] = 'none'; |
— | — | @@ -765,7 +766,6 @@ |
766 | 767 | } |
767 | 768 | |
768 | 769 | if ( isset( $fp['thumbnail'] ) || isset( $fp['manualthumb'] ) || isset( $fp['framed'] ) ) { |
769 | | - |
770 | 770 | # Create a thumbnail. Alignment depends on language |
771 | 771 | # writing direction, # right aligned for left-to-right- |
772 | 772 | # languages ("Western languages"), left-aligned |
— | — | @@ -800,6 +800,7 @@ |
801 | 801 | } else { |
802 | 802 | $params = array( |
803 | 803 | 'alt' => $fp['alt'], |
| 804 | + 'title' => $fp['title'], |
804 | 805 | 'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false , |
805 | 806 | 'img-class' => isset( $fp['border'] ) ? 'thumbborder' : false ); |
806 | 807 | if ( !empty( $fp['link-url'] ) ) { |
— | — | @@ -848,6 +849,8 @@ |
849 | 850 | $page = isset( $hp['page'] ) ? $hp['page'] : false; |
850 | 851 | if ( !isset( $fp['align'] ) ) $fp['align'] = 'right'; |
851 | 852 | if ( !isset( $fp['alt'] ) ) $fp['alt'] = ''; |
| 853 | + # Backward compatibility, title used to always be equal to alt text |
| 854 | + if ( !isset( $fp['title'] ) ) $fp['title'] = $fp['alt']; |
852 | 855 | if ( !isset( $fp['caption'] ) ) $fp['caption'] = ''; |
853 | 856 | |
854 | 857 | if ( empty( $hp['width'] ) ) { |
— | — | @@ -907,6 +910,7 @@ |
908 | 911 | } else { |
909 | 912 | $s .= $thumb->toHtml( array( |
910 | 913 | 'alt' => $fp['alt'], |
| 914 | + 'title' => $fp['title'], |
911 | 915 | 'img-class' => 'thumbimage', |
912 | 916 | 'desc-link' => true, |
913 | 917 | 'desc-query' => $query ) ); |
Index: trunk/phase3/includes/MediaTransformOutput.php |
— | — | @@ -129,7 +129,8 @@ |
130 | 130 | * should be indicated with a value of true for true, and false or |
131 | 131 | * absent for false. |
132 | 132 | * |
133 | | - * alt Alternate text or caption |
| 133 | + * alt HTML alt attribute |
| 134 | + * title HTML title attribute |
134 | 135 | * desc-link Boolean, show a description link |
135 | 136 | * file-link Boolean, show a file download link |
136 | 137 | * valign vertical-align property, if the output is an inline element |
— | — | @@ -150,14 +151,18 @@ |
151 | 152 | } |
152 | 153 | |
153 | 154 | $alt = empty( $options['alt'] ) ? '' : $options['alt']; |
| 155 | + # Note: if title is empty and alt is not, make the title empty, don't |
| 156 | + # use alt; only use alt if title is not set |
| 157 | + $title = !isset( $options['title'] ) ? $alt : $options['title']; |
154 | 158 | $query = empty($options['desc-query']) ? '' : $options['desc-query']; |
| 159 | + |
155 | 160 | if ( !empty( $options['custom-url-link'] ) ) { |
156 | 161 | $linkAttribs = array( 'href' => $options['custom-url-link'] ); |
157 | 162 | } elseif ( !empty( $options['custom-title-link'] ) ) { |
158 | 163 | $title = $options['custom-title-link']; |
159 | 164 | $linkAttribs = array( 'href' => $title->getLinkUrl(), 'title' => $title->getFullText() ); |
160 | 165 | } elseif ( !empty( $options['desc-link'] ) ) { |
161 | | - $linkAttribs = $this->getDescLinkAttribs( $alt, $query ); |
| 166 | + $linkAttribs = $this->getDescLinkAttribs( $title, $query ); |
162 | 167 | } elseif ( !empty( $options['file-link'] ) ) { |
163 | 168 | $linkAttribs = array( 'href' => $this->file->getURL() ); |
164 | 169 | } else { |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -289,6 +289,7 @@ |
290 | 290 | 'img_bottom' => array( 1, 'bottom' ), |
291 | 291 | 'img_text_bottom' => array( 1, 'text-bottom' ), |
292 | 292 | 'img_link' => array( 1, 'link=$1' ), |
| 293 | + 'img_alt' => array( 1, 'alt=$1', 'alt $1' ), |
293 | 294 | 'int' => array( 0, 'INT:' ), |
294 | 295 | 'sitename' => array( 1, 'SITENAME' ), |
295 | 296 | 'ns' => array( 0, 'NS:' ), |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -156,6 +156,8 @@ |
157 | 157 | * Added "link" parameter to image links, to allow images to link to an |
158 | 158 | arbitrary title or URL. This should replace inaccessible and incomplete |
159 | 159 | solutions such as CSS-based overlays and ImageMap. |
| 160 | +* (bug 368) Don't use caption for alt attribute; allow manual specification |
| 161 | + using new "alt=" parameter for images |
160 | 162 | |
161 | 163 | === Bug fixes in 1.14 === |
162 | 164 | |