mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 09:49:31 +02:00
Add new option to skip parsing of templates.
This commit is contained in:
@ -75,6 +75,7 @@
|
|||||||
global $wgLinkTitlesMinimumTitleLength;
|
global $wgLinkTitlesMinimumTitleLength;
|
||||||
global $wgLinkTitlesParseHeadings;
|
global $wgLinkTitlesParseHeadings;
|
||||||
global $wgLinkTitlesBlackList;
|
global $wgLinkTitlesBlackList;
|
||||||
|
global $wgLinkTitlesSkipTemplates;
|
||||||
|
|
||||||
// To prevent adding self-references, we now
|
// To prevent adding self-references, we now
|
||||||
// extract the current page's title.
|
// extract the current page's title.
|
||||||
@ -82,6 +83,13 @@
|
|||||||
|
|
||||||
( $wgLinkTitlesPreferShortTitles ) ? $sort_order = 'ASC' : $sort_order = 'DESC';
|
( $wgLinkTitlesPreferShortTitles ) ? $sort_order = 'ASC' : $sort_order = 'DESC';
|
||||||
|
|
||||||
|
if ( $wgLinkTitlesSkipTemplates )
|
||||||
|
{
|
||||||
|
$templatesDelimiter = '{{.+}}';
|
||||||
|
} else {
|
||||||
|
$templatesDelimiter = '{{[^|]+?}}|{{.+\|';
|
||||||
|
};
|
||||||
|
|
||||||
// Build a regular expression that will capture existing wiki links ("[[...]]"),
|
// Build a regular expression that will capture existing wiki links ("[[...]]"),
|
||||||
// wiki headings ("= ... =", "== ... ==" etc.),
|
// wiki headings ("= ... =", "== ... ==" etc.),
|
||||||
// urls ("http://example.com", "[http://example.com]", "[http://example.com Description]",
|
// urls ("http://example.com", "[http://example.com]", "[http://example.com Description]",
|
||||||
@ -91,8 +99,9 @@
|
|||||||
// capturing subpattern (which precludes the use of conditional subpatterns).
|
// capturing subpattern (which precludes the use of conditional subpatterns).
|
||||||
( $wgLinkTitlesParseHeadings ) ? $delimiter = '' : $delimiter = '=+.+?=+|';
|
( $wgLinkTitlesParseHeadings ) ? $delimiter = '' : $delimiter = '=+.+?=+|';
|
||||||
$urlPattern = '[a-z]+?\:\/\/(?:\S+\.)+\S+(?:\/.*)?';
|
$urlPattern = '[a-z]+?\:\/\/(?:\S+\.)+\S+(?:\/.*)?';
|
||||||
$delimiter = '/(' . $delimiter . '\[\[.*?\]\]|{{[^|]+?}}|{{.+\||{{.+\||\[' .
|
$delimiter = '/(' . $delimiter . '\[\[.*?\]\]|' . $templatesDelimiter .
|
||||||
$urlPattern . '\s.+?\]|'. $urlPattern . '(?=\s|$)|(?<=\b)\S+\@(?:\S+\.)+\S+(?=\b))/i';
|
'|\[' . $urlPattern . '\s.+?\]|'. $urlPattern .
|
||||||
|
'(?=\s|$)|(?<=\b)\S+\@(?:\S+\.)+\S+(?=\b))/i';
|
||||||
|
|
||||||
$black_list = str_replace( '_', ' ',
|
$black_list = str_replace( '_', ' ',
|
||||||
'("' . implode( '", "',$wgLinkTitlesBlackList ) . '")' );
|
'("' . implode( '", "',$wgLinkTitlesBlackList ) . '")' );
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
$wgLinkTitlesParseHeadings = false;
|
$wgLinkTitlesParseHeadings = false;
|
||||||
$wgLinkTitlesParseOnEdit = true;
|
$wgLinkTitlesParseOnEdit = true;
|
||||||
$wgLinkTitlesParseOnRender = false;
|
$wgLinkTitlesParseOnRender = false;
|
||||||
|
$wgLinkTitlesSkipTemplates = false;
|
||||||
$wgLinkTitlesBlackList = array();
|
$wgLinkTitlesBlackList = array();
|
||||||
|
|
||||||
$wgExtensionCredits['parserhook'][] = array(
|
$wgExtensionCredits['parserhook'][] = array(
|
||||||
@ -44,7 +45,7 @@
|
|||||||
'name' => 'LinkTitles',
|
'name' => 'LinkTitles',
|
||||||
'author' => '[http://www.mediawiki.org/wiki/User:Bovender Daniel Kraus]',
|
'author' => '[http://www.mediawiki.org/wiki/User:Bovender Daniel Kraus]',
|
||||||
'url' => 'http://www.mediawiki.org/wiki/Extension:LinkTitles',
|
'url' => 'http://www.mediawiki.org/wiki/Extension:LinkTitles',
|
||||||
'version' => '1.3.2',
|
'version' => '1.4.0',
|
||||||
'descriptionmsg' => 'linktitles-desc'
|
'descriptionmsg' => 'linktitles-desc'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user