| 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', 'click' ), |
| | 4228 | + 'upright', 'border', 'link' ), |
| 4229 | 4229 | ); |
| 4230 | 4230 | static $internalParamMap; |
| 4231 | 4231 | if ( !$internalParamMap ) { |
| — | — | @@ -4343,7 +4343,7 @@ |
| 4344 | 4344 | /// downstream behavior seems odd with missing manual thumbs. |
| 4345 | 4345 | $validated = true; |
| 4346 | 4346 | break; |
| 4347 | | - case 'click': |
| | 4347 | + case 'link': |
| 4348 | 4348 | $chars = self::EXT_LINK_URL_CLASS; |
| 4349 | 4349 | $prots = $this->mUrlProtocols; |
| 4350 | 4350 | if ( $value === '' ) { |
| — | — | @@ -4352,16 +4352,16 @@ |
| 4353 | 4353 | $validated = true; |
| 4354 | 4354 | } elseif ( preg_match( "/^$prots/", $value ) ) { |
| 4355 | 4355 | if ( preg_match( "/^($prots)$chars+$/", $value, $m ) ) { |
| 4356 | | - $paramName = 'click-url'; |
| | 4356 | + $paramName = 'link-url'; |
| 4357 | 4357 | $this->mOutput->addExternalLink( $value ); |
| 4358 | 4358 | $validated = true; |
| 4359 | 4359 | } |
| 4360 | 4360 | } else { |
| 4361 | | - $clickTitle = Title::newFromText( $value ); |
| 4362 | | - if ( $clickTitle ) { |
| 4363 | | - $paramName = 'click-title'; |
| 4364 | | - $value = $clickTitle; |
| 4365 | | - $this->mOutput->addLink( $clickTitle ); |
| | 4361 | + $linkTitle = Title::newFromText( $value ); |
| | 4362 | + if ( $linkTitle ) { |
| | 4363 | + $paramName = 'link-title'; |
| | 4364 | + $value = $linkTitle; |
| | 4365 | + $this->mOutput->addLink( $linkTitle ); |
| 4366 | 4366 | $validated = true; |
| 4367 | 4367 | } |
| 4368 | 4368 | } |
| Index: trunk/phase3/includes/Linker.php |
| — | — | @@ -699,8 +699,8 @@ |
| 700 | 700 | * bottom, text-bottom) |
| 701 | 701 | * alt Alternate text for image (i.e. alt attribute). Plain text. |
| 702 | 702 | * caption HTML for image caption. |
| 703 | | - * click-url URL to link to |
| 704 | | - * click-title Title object to link to |
| | 703 | + * link-url URL to link to |
| | 704 | + * link-title Title object to link to |
| 705 | 705 | * no-link Boolean, suppress description link |
| 706 | 706 | * |
| 707 | 707 | * @param array $handlerParams Associative array of media handler parameters, to be passed |
| — | — | @@ -802,10 +802,10 @@ |
| 803 | 803 | 'alt' => $fp['alt'], |
| 804 | 804 | 'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false , |
| 805 | 805 | 'img-class' => isset( $fp['border'] ) ? 'thumbborder' : false ); |
| 806 | | - if ( !empty( $fp['click-url'] ) ) { |
| 807 | | - $params['custom-url-link'] = $fp['click-url']; |
| 808 | | - } elseif ( !empty( $fp['click-title'] ) ) { |
| 809 | | - $params['custom-title-link'] = $fp['click-title']; |
| | 806 | + if ( !empty( $fp['link-url'] ) ) { |
| | 807 | + $params['custom-url-link'] = $fp['link-url']; |
| | 808 | + } elseif ( !empty( $fp['link-title'] ) ) { |
| | 809 | + $params['custom-title-link'] = $fp['link-title']; |
| 810 | 810 | } elseif ( !empty( $fp['no-link'] ) ) { |
| 811 | 811 | // No link |
| 812 | 812 | } else { |
| Index: trunk/phase3/languages/messages/MessagesEn.php |
| — | — | @@ -288,7 +288,7 @@ |
| 289 | 289 | 'img_middle' => array( 1, 'middle' ), |
| 290 | 290 | 'img_bottom' => array( 1, 'bottom' ), |
| 291 | 291 | 'img_text_bottom' => array( 1, 'text-bottom' ), |
| 292 | | - 'img_click' => array( 1, 'click=$1' ), |
| | 292 | + 'img_link' => array( 1, 'link=$1' ), |
| 293 | 293 | 'int' => array( 0, 'INT:' ), |
| 294 | 294 | 'sitename' => array( 1, 'SITENAME' ), |
| 295 | 295 | 'ns' => array( 0, 'NS:' ), |
| Index: trunk/phase3/RELEASE-NOTES |
| — | — | @@ -153,7 +153,7 @@ |
| 154 | 154 | MediaWiki:Pagenumber-#-PAGENAME where # is the page's namespace number and |
| 155 | 155 | PAGENAME is the page name minus the namespace prefix. Can be disabled with |
| 156 | 156 | the new magic word __NOHEADER__ |
| 157 | | -* Added "click" parameter to image links, to allow images to link to an |
| | 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 | 160 | |
| Index: trunk/phase3/maintenance/parserTests.txt |
| — | — | @@ -3095,6 +3095,35 @@ |
| 3096 | 3096 | !! end |
| 3097 | 3097 | |
| 3098 | 3098 | !! test |
| | 3099 | +Image with link parameter, wiki target |
| | 3100 | +!! input |
| | 3101 | +[[Image:foobar.jpg|link=Target page]] |
| | 3102 | +!! result |
| | 3103 | +<p><a href="/wiki/Target_page" title="Target page"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a> |
| | 3104 | +</p> |
| | 3105 | +!! end |
| | 3106 | + |
| | 3107 | +!! test |
| | 3108 | +Image with link parameter, URL target |
| | 3109 | +!! input |
| | 3110 | +[[Image:foobar.jpg|link=http://example.com/]] |
| | 3111 | +!! result |
| | 3112 | +<p><a href="http://example.com/"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a> |
| | 3113 | +</p> |
| | 3114 | +!! end |
| | 3115 | + |
| | 3116 | +!! test |
| | 3117 | +Image with empty link parameter |
| | 3118 | +!! input |
| | 3119 | +[[Image:foobar.jpg|link=]] |
| | 3120 | +!! result |
| | 3121 | +<p><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /> |
| | 3122 | +</p> |
| | 3123 | +!! end |
| | 3124 | + |
| | 3125 | + |
| | 3126 | + |
| | 3127 | +!! test |
| 3099 | 3128 | Image with frame and link |
| 3100 | 3129 | !! input |
| 3101 | 3130 | [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]] |