Merge branch 'release-3.0.1'

This commit is contained in:
Daniel Kraus
2014-09-03 15:13:42 +02:00
4 changed files with 26 additions and 9 deletions

View File

@ -104,17 +104,30 @@
global $wgLinkTitlesSmartMode;
global $wgCapitalLinks;
( $wgLinkTitlesWordStartOnly ) ? $wordStartDelim = '\b' : $wordStartDelim = '';
( $wgLinkTitlesWordEndOnly ) ? $wordEndDelim = '\b' : $wordEndDelim = '';
// Use unicode character properties rather than \b escape sequences
// to detect whole words containing non-ASCII characters as well.
// Note that this requires the use of the '/u' switch, and you need
// to have PHP with a PCRE library that was compiled with
// --enable-unicode-properties
( $wgLinkTitlesWordStartOnly ) ? $wordStartDelim = '(?<!\pL)' : $wordStartDelim = '';
( $wgLinkTitlesWordEndOnly ) ? $wordEndDelim = '(?!\pL)' : $wordEndDelim = '';
( $wgLinkTitlesPreferShortTitles ) ? $sort_order = 'ASC' : $sort_order = 'DESC';
( $wgLinkTitlesFirstOnly ) ? $limit = 1 : $limit = -1;
if ( $wgLinkTitlesSkipTemplates )
{
$templatesDelimiter = '{{.+?}}|';
$templatesDelimiter = '{{[^}]+}}|';
} else {
$templatesDelimiter = '{{[^|]+?}}|{{.+\||';
// Match template names (ignoring any piped [[]] links in them)
// along with the trailing pipe and parameter name or closing
// braces; also match sequences of '|wordcharacters=' (without
// spaces in them) that usually only occur as parameter names in
// transclusions (but could also occur as wiki table cell contents).
// TODO: Find a way to match parameter names in transclusions, but
// not in table cells or other sequences involving a pipe character
// and equal sign.
$templatesDelimiter = '{{[^|]*?(?:(?:\[\[[^]]+]])?)[^|]*?(?:\|(?:\w+=)?|(?:}}))|\|\w+=|';
};
LinkTitles::$currentTitle = $title;
@ -142,7 +155,7 @@
'style=".+?"|class=".+?"|' . // styles and classes (e.g. of wikitables)
'\[' . $urlPattern . '\s.+?\]|'. $urlPattern . '(?=\s|$)|' . // urls
'(?<=\b)\S+\@(?:\S+\.)+\S+(?=\b)' . // email addresses
')/i';
')/ism';
// Build a blacklist of pages that are not supposed to be link
// targets. This includes the current page.
@ -209,7 +222,7 @@
for ( $i = 0; $i < count( $arr ); $i+=2 ) {
// even indexes will point to text that is not enclosed by brackets
$arr[$i] = preg_replace_callback( '/(?<![\:\.\@\/\?\&])' .
$wordStartDelim . $searchTerm . $wordEndDelim . '/',
$wordStartDelim . $searchTerm . $wordEndDelim . '/u',
array('LinkTitles', 'simpleModeCallback'), $arr[$i], $limit, $count );
if (( $limit >= 0 ) && ( $count > 0 )) {
break;
@ -227,7 +240,7 @@
// even indexes will point to text that is not enclosed by brackets
$arr[$i] = preg_replace_callback( '/(?<![\:\.\@\/\?\&])' .
$wordStartDelim . '(' . $quotedTitle . ')' .
$wordEndDelim . '/i', array('LinkTitles', 'smartModeCallback'),
$wordEndDelim . '/iu', array('LinkTitles', 'smartModeCallback'),
$arr[$i], $limit, $count );
if (( $limit >= 0 ) && ( $count > 0 )) {
break;

View File

@ -195,7 +195,7 @@
'name' => 'LinkTitles',
'author' => '[https://www.mediawiki.org/wiki/User:Bovender Daniel Kraus]',
'url' => 'https://www.mediawiki.org/wiki/Extension:LinkTitles',
'version' => '3.0.0',
'version' => '3.0.1',
'descriptionmsg' => 'linktitles-desc'
);

4
NEWS
View File

@ -1,3 +1,7 @@
LinkTitles 3.0.1: 2014-09-03
* Fix several bugs in template handling.
* Ignore <pre> and similar sections that span multiple lines.
LinkTitles 3.0.0: 2014-06-13
* Dramatically improved performance (especially apparent during batch
processing).

View File

@ -19,7 +19,7 @@ tar cvzf $FILENAME gpl-*.txt README.md NEWS *.php --exclude '*~' --transform 's,
if [[ $? -eq 0 ]]; then
# Add the tarball to the repository, commit it, then tag the commit and push to origin.
git add $FILENAME
git commit -m "Release version $1"
git commit -m --amend
git tag -a $1 -m "Version $1."
git push
git push --tags