mirror of
https://github.com/diocloid/LinkTitles.git
synced 2025-07-13 17:59:29 +02:00
Do not remove magic word when saving page.
This commit is contained in:
@ -42,6 +42,7 @@
|
|||||||
if ( $wgLinkTitlesParseOnRender ) {
|
if ( $wgLinkTitlesParseOnRender ) {
|
||||||
$wgHooks['ArticleAfterFetchContent'][] = 'LinkTitles::onArticleAfterFetchContent';
|
$wgHooks['ArticleAfterFetchContent'][] = 'LinkTitles::onArticleAfterFetchContent';
|
||||||
};
|
};
|
||||||
|
$wgHooks['ParserBeforeTidy'][] = 'LinkTitles::removeMagicWord';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function is hooked to the ArticleSave event.
|
/// This function is hooked to the ArticleSave event.
|
||||||
@ -76,7 +77,7 @@
|
|||||||
// If the page contains the magic word '__NOAUTOLINKS__', do not parse
|
// If the page contains the magic word '__NOAUTOLINKS__', do not parse
|
||||||
// the content.
|
// the content.
|
||||||
$mw = MagicWord::get('MAG_LINKTITLES_NOAUTOLINKS');
|
$mw = MagicWord::get('MAG_LINKTITLES_NOAUTOLINKS');
|
||||||
if ( $mw -> matchAndRemove( $text ) ) {
|
if ( $mw -> match( $text ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,6 +201,12 @@
|
|||||||
return '[[' . LinkTitles::$safeTitle . '|' . $matches[0] . ']]';
|
return '[[' . LinkTitles::$safeTitle . '|' . $matches[0] . ']]';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeMagicWord( &$parser, &$text ) {
|
||||||
|
$mw = MagicWord::get('MAG_LINKTITLES_NOAUTOLINKS');
|
||||||
|
$mw -> matchAndRemove( $text );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: ts=2:sw=2:noet
|
// vim: ts=2:sw=2:noet
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
$magicWords = array();
|
$magicWords = array();
|
||||||
|
|
||||||
$magicWords['en'] = array(
|
$magicWords['en'] = array(
|
||||||
'MAG_LINKTITLES_NOAUTOLINKS' => '__NOAUTOLINKS__',
|
'MAG_LINKTITLES_NOAUTOLINKS' => array(0, '__NOAUTOLINKS__')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
4
NEWS
4
NEWS
@ -1,3 +1,7 @@
|
|||||||
|
LinkTitles 2.1.0: 2013-02-23
|
||||||
|
* Introduced new 'magic word' __NOAUTOLINKS__, whose presence on a page will
|
||||||
|
prevent the extension from adding links.
|
||||||
|
|
||||||
LinkTitles 2.0.0: 2013-01-29
|
LinkTitles 2.0.0: 2013-01-29
|
||||||
* Introduced a new 'smart mode' ($wgLinkTitlesSmartMode) which is enabled by
|
* Introduced a new 'smart mode' ($wgLinkTitlesSmartMode) which is enabled by
|
||||||
default and will automatically generate aliased links if there is a case
|
default and will automatically generate aliased links if there is a case
|
||||||
|
BIN
release/LinkTitles-2.1.0.tar.gz
Normal file
BIN
release/LinkTitles-2.1.0.tar.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user