Extension:ShortLinksParser

What can this extension do?
If you're linking often to the same external sources you have always to repeat certain parts of the URL which remain the same. This extension introduces a possibility to shorten this notation by providing reusable base-urls with placeholders.

Usage
E.g. you have a lot of links to wikipedia, you would have to write again and again the same base URL:

and again

Using the ShortLinksParser-Extension the result might be:

and

whereas the ShortLink Wikipedia is replaced by the base URL  and the page name is inserted for a placeholder.

Configuration parameters
Configuring a ShortLink is as easy as filling an associative array.

Please note: You can find this array in the extension file ShortLinksParser.php below.

For the above mentioned Wikipedia example this might be:

The number in braces is a placeholder. You can use insert placeholders on any position you want and as many as you want.

An example for multiple placeholder:

A ShortLink pointing to the MediaWiki Extension authors would look like this:

Customizing the ShortLinks parameter separator
Note the use of the pipe char (|) to separate the parameters. You can also use another char, but make sure this char can't be part of an URL. To define another char use the method  of the class shortLinksParser.

Customizing the look
If you want to highlight a ShortLink e.g. with an icon, you can easily do that in CSS. Every generated ShortLink is surrounded with a div-Box which has a class assigned to it. The name of the class follows a certain syntax: NAME_OF_THE_SHORTLINK-shortLinkContainer. For the above mentioned Wikipedia example this would be.

You can either add the CSS-Code to existing CSS-files or use an extra file. To link to the extra file you can use the method  of the class shortLinksParser.

Download instructions
Please create a new folder in your MediaWiki Extension directory ($IP/extensions) named ShortLinksParser. Add the files shortLinksParser_class.php and ShortLinksParser.php to it.

Your directory structure should now look like this: --extensions ShortLinksParser --ShortLinksParser.php --shortLinksParser_class.php

Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
Installation follows two steps:

1. Add the following to LocalSettings.php:

2. Configure the ShortLinks in ShortLinksParser.php as described above.