Extension:Link Attributes

This extension adds support for the,   and   attributes on links.

The syntax is a little unorthodox. To set the rel attribute, place one or more tokens in double-parentheses at the end of the link title. e.g.:

My website((me home))

The above would be converted to the following link:

To set the class attribute, the same syntax is used, but tokens which represent classes are prefixed with a dot:

My website((me .class1 home .class2))

Becomes:

Similarly, prefixing with a tilde (~) sets the  attribute.

Tokens may be prefixed by a minus sign (-) to indicate that you don't want to add the token, but remove it. For example:

My website((me -.external home))

Becomes:

The "nofollow" rel token is considered untouchable though.

Installation
You need to patch includes/Linker.php. Find the makeExternalLink function and replace the existing wfRunHooks line with the following:

This allows the external link hook function access to a bit more information than it otherwise has. Hopefully MediaWiki 1.15.0 will incorporate this patch. This however seems to become unnecessary when the commented line in the linkattr_ExternalLink-function is used instead of the line above it, MediaWiki version 1.18.0.

Add the following to LocalSettings.php:

Copy and paste the following as extensions/linkAttributes.php: