https://bugzilla.wikimedia.org/show_bug.cgi?id=26207

--- Comment #7 from William Demchick <[email protected]> 2011-05-25 04:33:21 
UTC ---
Created attachment 8582
  --> https://bugzilla.wikimedia.org/attachment.cgi?id=8582
Magical Extension

It does seem to me that having magic linking in the core is inappropriate for a
number of reasons, many noted above.  Attached is a simple extension that
replaces the core functionality.  I have tested it with a modified MediaWiki
that lacks the magic linking in the core.

A few notes about the extension:
    - it easily supports "legacy" magic linking (i.e. ISBN, RFC, PMID) via
$wgMagicalClassic
    - it can be easily extended (example below)
    - the code is a little more general, and less hackey :)

An example of a custom linker (I have tested this in my LocalSettings.php):

function myCustomLinker( $matches ) {
        $num = ltrim($matches[1], '0');
        $url = 'http://bugzilla.wikimedia.org/show_bug.cgi?id=' . $num;
        return '<a href=\'' . $url . '\'>' . $matches[0] . '</a>';
}

$wgMagicalLinkers[] = array(
        'linker' => 'myCustomLinker',
        'pattern' => '@bug ([0-9]+)@'
);

The name of the extension is "Magical".

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to