Extension:PatchOutput

Purpose
This extension applies some patches to the HTML code of a page before it is displayed. It can be seen as a demo for using the hook. You're likely to customize it for your needs.

The current version achieves the following:


 * A link like  is shown as [mailto:test@example.org test@example.org] (while the link behind is still a mailto: link).

Warnings

 * The result is achieved via crude string search-and-replace on the html code. The search patterns are likely to be subject to change in future MediaWiki versions.


 * As stated on, the hook may have bugs.

Installation

 * Copy the to a file   in your   folder.
 * Add the following code at the bottom of your LocalSettings.php:


 * ✅ – Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

Even though this extension has been tested on MediaWiki 1.20, it should work on earlier versions as well.

Configuration
The search-and-replace patterns are stored in a global variable. It contains an array where keys are the terms to search and values the corresponding replacements. You can redefine this array or add entries in your.

Change Log

 * 0.2.2 :
 * Use, thus avoiding an explicit loop.


 * 0.2.1 :
 * Removed the replacement pair used to open links in a new browser window. This is now achieved better with the configuration parameter $wgExternalLinkTarget.
 * Removed the replacement pair used to translate "localhost" with the current server. It is better to use the magic word instead.
 * The code has been reviewed in order to comply better with the guidelines on mediawiki.org.


 * 0.2 :
 * The configuration parameter now a class member.


 * 0.1 :
 * First version published.