Extension:Substitutor

MediaWiki extensions manual
Substitutor
Release status: unmaintained
Implementation Tag , Parser function
Description Allows to do one-time string substitutions
Author(s) Simon Heimler (Fannontalk)
Latest version 1.2.0 (February 2016)
MediaWiki 1.19+
PHP 5.2+
Database changes No
License MIT License
Download
README

The Substitutor extension allows to to do one-time string substitutions.

Description Edit

Common parser functions and magic words in MediaWiki are parsed/displayed dynamically in MediaWiki. Sometimes this is not what you want. For example, you want a timestamp that is only evaluated the first time the page is saved and after that stay on that exact time. Or you want to generate a random ID that does not change with each page view.

This provides useful if you want to create unique names and URL's for "red links", or simply timestamp sites / changes.

Installation Edit

  • Download and place the file(s) in a directory called Substitutor in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    require_once "$IP/extensions/Substitutor/Substitutor.php";
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


Instead of downloading the zip archive you may also check this extension out via Git:

git clone https://github.com/Fannon/Substitutor.git

Usage Edit

Use the <substitute> tag, to define

The content of the tag will be parsed and replaced after you saved the article. The substitution will only happen exactly once - that's the whole point of this extension.

This extension is especially useful in combination with Extension:IDProvider.

Examples Edit

<substitute>{{#idprovider-random:}}</substitute>

<substitute>{{#idprovider-increment:Test_}}</substitute>

<substitute>{{CURRENTTIMESTAMP}}</substitute>

<substitute>{{Welcome}}</substitute>

Substitute vs. subst: Edit

<substitute>{{#idprovider-random:}}</substitute>
{{subst:{{#idprovider-random:}}}}

results in:

2a108083-e135-4cd1-a440-2aa78894f3e5<br>
{{subst:{{#idprovider-random:}}}}

which is rendered as:

2a108083-e135-4cd1-a440-2aa78894f3e5
{{subst:65f26d29-5415-4e46-9a4f-af2006e7a357}}