Skip to content

The MagicalLinkers extension provides dynamic linking of inline keywords, such as magic links.

Notifications You must be signed in to change notification settings

ntavares/mediawiki-extensions-magicallinkers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

mediawiki-extensions-magicallinkers

The MagicalLinkers extension provides dynamic linking of inline keywords, such as magic links. Following the discussion around the the future of magic links (more specifically, its removal from mediawiki core), 'wsd' (untraced) submitted a patch to demonstrate how magiclinks could be turned into an extension. In the meantime, $wgEnableMagicLinks was introduced to aid in phasing these out, but the possibility of extending the list was not there.

This extension is nothing but the extension.json wrapping of the simple submitted patch.

How to use

Besides normal extension insertion, you'll probably want to extend it with your own keywords. Example:

wfLoadExtension( 'MagicalLinkers' );
class MagicalLinkersExt {
	public static function linkBug( $text ) {
        $urlNumber = ltrim( substr( $text, 4 ), '0');
		$url = 'https://mybugplatform.mysite.pt/issues/?id=' . $urlNumber;
		$safeUrl = $url;
		return '<a href=\'' . $safeUrl . '\' class=\'mw-magiclink-bug\'>bug ' . $urlNumber . '</a>';
	}
}
$wgMagicalLinkers = array(
	array( 
		'linker' => 'MagicalLinkersExt::linkBug',
		'pattern' => 'bug:\\s*[0-9]+'
	)
);

About

The MagicalLinkers extension provides dynamic linking of inline keywords, such as magic links.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages