r87030 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87029‎ | r87030 | r87031 >
Date:19:13, 27 April 2011
Author:mah
Status:ok
Tags:
Comment:
revert r76127, r76129, and r83535 b/c I'm backing out the fix for bug #542. Fixing ancient bugs causes grief for many people.
Modified paths:
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/tests/parser/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/parser/parserTests.txt
@@ -1911,7 +1911,7 @@
19121912 !! input
19131913 [[Main Page]]
19141914 !! result
1915 -<p><a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>
 1915+<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>
19161916 </p>
19171917 !! end
19181918
@@ -1920,7 +1920,7 @@
19211921 !! input
19221922 [[main Page]]
19231923 !! result
1924 -<p><a href="https://www.mediawiki.org/wiki/Main_Page">main Page</a>
 1924+<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a>
19251925 </p>
19261926 !! end
19271927
@@ -1974,7 +1974,7 @@
19751975 !! input
19761976 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
19771977 !! result
1978 -<p>xxx<a href="https://www.mediawiki.org/wiki/Main_Page">main Page</a>, xxx<a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>, Xxx<a href="https://www.mediawiki.org/wiki/Main_Page">main Page</a> XXX<a href="https://www.mediawiki.org/wiki/Main_Page">main Page</a>, XXX<a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>
 1978+<p>xxx<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>
19791979 </p>
19801980 !! end
19811981
@@ -1983,7 +1983,7 @@
19841984 !! input
19851985 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
19861986 !! result
1987 -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>XXX, <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>!!!
 1987+<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>!!!
19881988 </p>
19891989 !! end
19901990
@@ -2216,7 +2216,7 @@
22172217 !!input
22182218 [[00]]
22192219 !!result
2220 -<p><a href="https://www.mediawiki.org/wiki/00">00</a>
 2220+<p><a href="https://www.mediawiki.org/wiki/00" title="00">00</a>
22212221 </p>
22222222 !!end
22232223
@@ -2245,7 +2245,7 @@
22462246 !! input
22472247 '''[[Main Page]]'''
22482248 !! result
2249 -<p><b><a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a></b>
 2249+<p><b><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></b>
22502250 </p>
22512251 !! end
22522252
@@ -2256,7 +2256,7 @@
22572257 !! input
22582258 ''[[Main Page]]''
22592259 !! result
2260 -<p><i><a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a></i>
 2260+<p><i><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></i>
22612261 </p>
22622262 !! end
22632263
@@ -2302,7 +2302,7 @@
23032303 !! input
23042304 [[MeatBall:SoftSecurity]]
23052305 !! result
2306 -<p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw">MeatBall:SoftSecurity</a>
 2306+<p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
23072307 </p>
23082308 !! end
23092309
@@ -2311,7 +2311,7 @@
23122312 !! input
23132313 [[MeatBall:]]
23142314 !! result
2315 -<p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw">MeatBall:</a>
 2315+<p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw" title="meatball:">MeatBall:</a>
23162316 </p>
23172317 !! end
23182318
@@ -3220,7 +3220,7 @@
32213221 !! input
32223222 [[{{linktest2}}]]
32233223 !! result
3224 -<p><a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>
 3224+<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>
32253225 </p>
32263226 !! end
32273227
@@ -3242,7 +3242,7 @@
32433243 !! input
32443244 {{loop1}}
32453245 !! result
3246 -<p><span class="error">Template loop detected: <a href="https://www.mediawiki.org/wiki/Template:Loop1">Template:Loop1</a></span>
 3246+<p><span class="error">Template loop detected: <a href="https://www.mediawiki.org/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
32473247 </p>
32483248 !! end
32493249
@@ -4065,7 +4065,7 @@
40664066 !! input
40674067 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
40684068 !! result
4069 -<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a></div></div></div>
 4069+<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" 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>
40704070
40714071 !! end
40724072
@@ -4074,7 +4074,7 @@
40754075 !! input
40764076 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
40774077 !! result
4078 -<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a></div></div></div>
 4078+<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" 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>
40794079
40804080 !! end
40814081
@@ -4274,7 +4274,7 @@
42754275 !! input
42764276 [[Image:Barfoo.jpg]]
42774277 !! result
4278 -<p><a href="https://www.mediawiki.org/wiki/File:Barfoo.jpg">File:Barfoo.jpg</a>
 4278+<p><a href="https://www.mediawiki.org/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
42794279 </p>
42804280 !! end
42814281
@@ -4285,7 +4285,7 @@
42864286 !! input
42874287 [[Image:Foobaz.jpg]]
42884288 !! result
4289 -<p><a href="https://www.mediawiki.org/wiki/File:Foobaz.jpg">File:Foobaz.jpg</a>
 4289+<p><a href="https://www.mediawiki.org/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
42904290 </p>
42914291 !! end
42924292
@@ -4355,7 +4355,7 @@
43564356 !! input
43574357 [[:Category:MediaWiki User's Guide]]
43584358 !! result
4359 -<p><a href="https://www.mediawiki.org/wiki/Category:MediaWiki_User%27s_Guide">Category:MediaWiki User's Guide</a>
 4359+<p><a href="https://www.mediawiki.org/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
43604360 </p>
43614361 !! end
43624362
@@ -5025,7 +5025,7 @@
50265026 <a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
50275027 <a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
50285028 <a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
5029 -<a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7">אַ</a>
 5029+<a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
50305030 </p>
50315031 !! end
50325032
@@ -5088,7 +5088,7 @@
50895089 !! input
50905090 [[Main Page]]]
50915091 !! result
5092 -<p><a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>]
 5092+<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>]
50935093 </p>
50945094 !! end
50955095
@@ -6291,7 +6291,7 @@
62926292 !! result
62936293 <p><br />
62946294 </p>
6295 -<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx">Xyzzyx</a></td></tr></table>
 6295+<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
62966296
62976297 !! end
62986298
@@ -6304,10 +6304,10 @@
63056305 !! result
63066306 <p><br />
63076307 </p>
6308 -<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx">Xyzzyx</a></td></tr></table>
 6308+<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
63096309 <p><br />
63106310 </p>
6311 -<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx">Xyzzyx</a></td></tr></table>
 6311+<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
63126312
63136313 !! end
63146314
@@ -7202,7 +7202,7 @@
72037203 !! input
72047204 {{Special:search}}
72057205 !! result
7206 -<p><a href="https://www.mediawiki.org/wiki/Special:Search">Special:Search</a>
 7206+<p><a href="https://www.mediawiki.org/wiki/Special:Search" title="Special:Search">Special:Search</a>
72077207 </p>
72087208 !! end
72097209
@@ -7316,7 +7316,7 @@
73177317 </gallery>
73187318 !! result
73197319 <ul class="gallery" style="max-width: 202px;_width: 202px;">
7320 - <li class='gallerycaption'>Foo <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a></li>
 7320+ <li class='gallerycaption'>Foo <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></li>
73217321 <li class="gallerybox" style="width: 95px"><div style="width: 95px">
73227322 <div style="height: 70px;">Nonexistant.jpg</div>
73237323 <div class="gallerytext">
@@ -7332,7 +7332,7 @@
73337333 <li class="gallerybox" style="width: 95px"><div style="width: 95px">
73347334 <div class="thumb" style="width: 90px;"><div style="margin:26px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
73357335 <div class="gallerytext">
7336 -<p>some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>
 7336+<p>some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>
73377337 </p>
73387338 </div>
73397339 </div></li>
@@ -7409,7 +7409,7 @@
74107410 <div class="thumb" style="width: 150px;"><div style="margin:66px auto;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
74117411 <div class="gallerytext">
74127412 <p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
7413 -some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>
 7413+some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>
74147414 </p>
74157415 </div>
74167416 </div></li>
@@ -8035,7 +8035,7 @@
80368036 !! input
80378037 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
80388038 !! result
8039 -<p><a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a> can be written as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a>.
 8039+<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a>.
80408040 </p>
80418041 !!end
80428042
@@ -8130,7 +8130,7 @@
81318131 !! input
81328132 -{[[Main Page]]}-
81338133 !! result
8134 -<p><a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a>
 8134+<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>
81358135 </p>
81368136 !! end
81378137
@@ -8637,9 +8637,9 @@
86388638 [[meatball:2]]
86398639 [[meatball:3]]
86408640 !! result
8641 -<p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw">meatball:1</a>
8642 -<a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw">meatball:2</a>
8643 -<a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw">meatball:3</a>
 8641+<p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
 8642+<a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
 8643+<a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
86448644 </p>
86458645 !! end
86468646
@@ -8756,7 +8756,7 @@
87578757 !! input
87588758 I like the [[Main Page]] a lot
87598759 !! result
8760 -I like the <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a> a lot
 8760+I like the <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> a lot
87618761 !!end
87628762
87638763 !! test
@@ -9108,27 +9108,7 @@
91099109 </p>
91109110 !! end
91119111
9112 -!! article
9113 -A
9114 -!! text
9115 -A
9116 -!! endarticle
91179112
9118 -!! article
9119 
9120 -!! text
9121 
9122 -!! endarticle
9123 -
9124 -!! test
9125 -Bug#542 Link text shouldn't be duplicated in title attributes
9126 -!! input
9127 -[[A]] [[a]] [[Ä]] [[ä]]
9128 -!! result
9129 -<p><a href="https://www.mediawiki.org/wiki/A">A</a> <a href="https://www.mediawiki.org/wiki/A">a</a> <a href="https://www.mediawiki.org/wiki/%C3%84">Ä</a> <a href="https://www.mediawiki.org/wiki/%C3%84">ä</a>
9130 -</p>
9131 -!! end
9132 -
91339113 TODO:
91349114 more images
91359115 more tables
Index: trunk/phase3/includes/Linker.php
@@ -201,7 +201,7 @@
202202
203203 $attribs = array_merge(
204204 $attribs,
205 - self::linkAttribs( $target, $customAttribs, $options, $text )
 205+ self::linkAttribs( $target, $customAttribs, $options )
206206 );
207207 if ( is_null( $text ) ) {
208208 $text = self::linkText( $target );
@@ -258,7 +258,7 @@
259259 *
260260 * @param $target Title
261261 */
262 - private static function linkAttribs( $target, $attribs, $options, $linkText ) {
 262+ private static function linkAttribs( $target, $attribs, $options ) {
263263 wfProfileIn( __METHOD__ );
264264 global $wgUser;
265265 $defaults = array();
@@ -289,16 +289,12 @@
290290 }
291291
292292 # Get a default title attribute.
293 - global $wgLang;
294 - $known = in_array( 'known', $options );
295293 if ( $target->getPrefixedText() == '' ) {
296294 # A link like [[#Foo]]. This used to mean an empty title
297295 # attribute, but that's silly. Just don't output a title.
298 - } elseif ( $known &&
299 - $wgLang->caseFold($linkText) !== $wgLang->caseFold($target->getPrefixedText() ) )
300 - {
 296+ } elseif ( in_array( 'known', $options ) ) {
301297 $defaults['title'] = $target->getPrefixedText();
302 - } elseif ( !$known ) {
 298+ } else {
303299 $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
304300 }
305301

Follow-up revisions

RevisionCommit summaryAuthorDate
r871701.17: MFT r85546, r86450, r86625, r86805, r86841, r86904, r86973, r87030catrope16:57, 30 April 2011
r873531.17wmf1: MFT r85546, r86409, r86450, r86625, r86788, r86805, r86841, r86904,...catrope20:27, 3 May 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r76127Resolves Bug#542 by removing the link title from in-wiki links where...mah19:06, 5 November 2010
r76129followup r76127 - update parser tests.mah19:39, 5 November 2010
r83535* Followup r76127 and r83521 by adding parsertests and using caseFoldmah18:09, 8 March 2011

Status & tagging log