From: Brion Vibber Date: Wed, 6 Apr 2011 21:11:49 +0000 (+0000) Subject: * (bug 27473) Fix regression: bold, italic no longer interfere with linktrail for... X-Git-Tag: 1.31.0-rc.0~30989 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=fcbd1134c66edb5c1eb80886b6f5841d3cfed061;p=lhc%2Fweb%2Fwiklou.git * (bug 27473) Fix regression: bold, italic no longer interfere with linktrail for ca, kaa 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. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bdb16cf99c..e3e2072584 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -231,6 +231,7 @@ PHP if you have not done so prior to upgrading MediaWiki. * (bug 28430) Make html and TeX output of 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 diff --git a/includes/Linker.php b/includes/Linker.php index d591761302..85355140ca 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -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(); diff --git a/languages/messages/MessagesCa.php b/languages/messages/MessagesCa.php index c08b4510cb..90acd45db1 100644 --- a/languages/messages/MessagesCa.php +++ b/languages/messages/MessagesCa.php @@ -179,7 +179,7 @@ $specialPageAliases = array( 'DeletedContributions' => array( 'Contribucions esborrades' ), ); -$linkTrail = '/^([a-zàèéíòóúç·ïü\']+)(.*)$/sDu'; +$linkTrail = "/^((?:[a-zàèéíòóúç·ïü]|'(?!'))+)(.*)$/sDu"; $messages = array( # User preference toggles diff --git a/languages/messages/MessagesKaa.php b/languages/messages/MessagesKaa.php index 080c42910c..1a0106cdfb 100644 --- a/languages/messages/MessagesKaa.php +++ b/languages/messages/MessagesKaa.php @@ -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 diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index e6b7ea492a..5c35295ed5 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -1761,6 +1761,60 @@ Non-breaking spaces in title

!!end +!! test +Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue) +!! options +language=ca +!! input +'''[[Main Page]]''' +!! result +

Main Page +

+!! end + +!! test +Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue) +!! options +language=ca +!! input +''[[Main Page]]'' +!! result +

Main Page +

+!! end + +!! test +Internal link with en linktrail: no apostrophes (bug 27473) +!! options +language=en +!! input +[[Something]]'nice +!! result +

Something'nice +

+!! end + +!! test +Internal link with ca linktrail with apostrophes (bug 27473) +!! options +language=ca +!! input +[[Something]]'nice +!! result +

Something'nice +

+!! end + +!! test +Internal link with kaa linktrail with apostrophes (bug 27473) +!! options +language=kaa +!! input +[[Something]]'nice +!! result +

Something'nice +

+!! end ### ### Interwiki links (see maintenance/interwiki.sql)