Do not remove magic word when saving page.

This commit is contained in:
Daniel Kraus
2013-02-23 14:07:00 +01:00
parent 6d38db71af
commit ae1f72aefd
4 changed files with 13 additions and 2 deletions

View File

@ -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

View File

@ -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
View File

@ -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

Binary file not shown.