Add option $wgLinkTitlesIgnoreCase to enable case-sensitive linking of page titles.

This commit is contained in:
Daniel Kraus
2013-01-22 16:09:51 +01:00
parent a269b906b0
commit 455f333c28
4 changed files with 10 additions and 3 deletions

View File

@ -79,9 +79,11 @@
global $wgLinkTitlesFirstOnly;
global $wgLinkTitlesWordStartOnly;
global $wgLinkTitlesWordEndOnly;
global $wgLinkTitlesIgnoreCase;
( $wgLinkTitlesWordStartOnly ) ? $wordStartDelim = '\b' : $wordStartDelim = '';
( $wgLinkTitlesWordEndOnly ) ? $wordEndDelim = '\b' : $wordEndDelim = '';
( $wgLinkTitlesIgnoreCase ) ? $regexModifier = 'i' : $regexModifier = '';
// To prevent adding self-references, we now
// extract the current page's title.
@ -148,7 +150,7 @@
// even indexes will point to text that is not enclosed by brackets
$arr[$i] = preg_replace( '/(?<![\:\.\@\/\?\&])' .
$wordStartDelim . '(' . $safeTitle . ')' .
$wordEndDelim . '/i', '[[$1]]', $arr[$i], $limit, $count );
$wordEndDelim . '/' . $regexModifier , '[[$1]]', $arr[$i], $limit, $count );
if (( $limit >= 0 ) && ( $count > 0 )) {
break;
};

View File

@ -42,13 +42,14 @@
$wgLinkTitlesFirstOnly = false;
$wgLinkTitlesWordStartOnly = true;
$wgLinkTitlesWordEndOnly = true;
$wgLinkTitlesIgnoreCase = true;
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'LinkTitles',
'author' => '[http://www.mediawiki.org/wiki/User:Bovender Daniel Kraus]',
'url' => 'http://www.mediawiki.org/wiki/Extension:LinkTitles',
'version' => '1.6.1',
'version' => '1.7.0',
'descriptionmsg' => 'linktitles-desc'
);

6
NEWS
View File

@ -1,3 +1,7 @@
LinkTitles 1.7.0: 2013-01-22
* Added new option to do exact searches of page titles; the default is to
do __case-insensitive__ searches as before ($wgLinkTitlesIgnoreCase).
LinkTitles 1.6.1: 2012-12-31
* Fixed a bug that caused linking to fail in certain situations when
$wgLinkTitlesFirstOnly was set to true.
@ -13,7 +17,7 @@ LinkTitles 1.4.0: 2012-10-09
* Added new option to skip template variables.
LinkTitles 1.3.2: 2012-10-05
* Fix incorrect handling of PreverShortTitles option.
* Fix incorrect handling of PreferShortTitles option.
LinkTitles 1.3.1: 2012-10-05
* Fix typo that prevented proper function of the extension.

Binary file not shown.