* (bug 27473) Fix regression: bold, italic no longer interfere with linktrail for...
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 6 Apr 2011 21:11:49 +0000 (21:11 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 6 Apr 2011 21:11:49 +0000 (21:11 +0000)
Patch to ca, kaa linktrails to exclude multiple apostrophes by Platonides: https://bugzilla.wikimedia.org/attachment.cgi?id=8337

Added parser test cases to confirm that the linktrail apostrophe works on those languages, and to confirm that the bug where a link is surrounded by bold or italics is resolved.

Tweaked Linker::splitTrail() to keep it from permanently caching $wgContLang's linktrail; when we change content languages during a script run as we do with parser tests, that was leaving us stuck forever on English's linktrail.
This may slightly slow down that path, since it'll have to make a couple brief function calls into the Language object and its data cache.

RELEASE-NOTES
includes/Linker.php
languages/messages/MessagesCa.php
languages/messages/MessagesKaa.php
tests/parser/parserTests.txt

index bdb16cf..e3e2072 100644 (file)
@@ -231,6 +231,7 @@ PHP if you have not done so prior to upgrading MediaWiki.
 * (bug 28430) Make html and TeX output of <math> always be left-to-right.
 * (bug 28306) Fix exposure of suppressed usernames in ForeignDBRepo
 * (bug 28372) Fix bogus link to suppressed file versions in ForeignDBRepo
+* (bug 27473) Fix regression: bold, italic no longer interfere with linktrail for ca, kaa
 
 === API changes in 1.18 ===
 * (bug 26339) Throw warning when truncating an overlarge API result
index d591761..8535514 100644 (file)
@@ -1459,11 +1459,8 @@ class Linker {
         * as a two-element array
         */
        static function splitTrail( $trail ) {
-               static $regex = false;
-               if ( $regex === false ) {
-                       global $wgContLang;
-                       $regex = $wgContLang->linkTrail();
-               }
+               global $wgContLang;
+               $regex = $wgContLang->linkTrail();
                $inside = '';
                if ( $trail !== '' ) {
                        $m = array();
index c08b451..90acd45 100644 (file)
@@ -179,7 +179,7 @@ $specialPageAliases = array(
        'DeletedContributions'      => array( 'Contribucions esborrades' ),
 );
 
-$linkTrail = '/^([a-zàèéíòóúç·ïü\']+)(.*)$/sDu';
+$linkTrail = "/^((?:[a-zàèéíòóúç·ïü]|'(?!'))+)(.*)$/sDu";
 
 $messages = array(
 # User preference toggles
index 080c429..1a0106c 100644 (file)
@@ -148,7 +148,7 @@ $dateFormats = array(
        'ISO 8601 both' => 'xnY-xnm-xnd"T"xnH:xni:xns',
 );
 
-$linkTrail = "/^([a-zı'ʼ’“»]+)(.*)$/sDu";
+$linkTrail = "/^((?:[a-zıʼ’“»]|'(?!'))+)(.*)$/sDu";
 
 $messages = array(
 # User preference toggles
index e6b7ea4..5c35295 100644 (file)
@@ -1761,6 +1761,60 @@ Non-breaking spaces in title
 </p>
 !!end
 
+!! test
+Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
+!! options
+language=ca
+!! input
+'''[[Main Page]]'''
+!! result
+<p><b><a href="/wiki/Main_Page">Main Page</a></b>
+</p>
+!! end
+
+!! test
+Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
+!! options
+language=ca
+!! input
+''[[Main Page]]''
+!! result
+<p><i><a href="/wiki/Main_Page">Main Page</a></i>
+</p>
+!! end
+
+!! test
+Internal link with en linktrail: no apostrophes (bug 27473)
+!! options
+language=en
+!! input
+[[Something]]'nice
+!! result
+<p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
+</p>
+!! end
+
+!! test
+Internal link with ca linktrail with apostrophes (bug 27473)
+!! options
+language=ca
+!! input
+[[Something]]'nice
+!! result
+<p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
+</p>
+!! end
+
+!! test
+Internal link with kaa linktrail with apostrophes (bug 27473)
+!! options
+language=kaa
+!! input
+[[Something]]'nice
+!! result
+<p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
+</p>
+!! end
 
 ###
 ### Interwiki links (see maintenance/interwiki.sql)