Release status: experimental
|Description||Allows blocks of wikicode to be rendered at a different point in the same page from where they are defined.|
|Translate the DelayedDefinition extension if it is available at translatewiki.net|
|Check usage and version matrix.|
DelayedDefinition is an extension that adds two tags to Mediawiki:
<display>. Collectively these serve to allow chunks of wikicode to be defined in a different part of the same page from where it is displayed.
- Download the snapshot that matches your version of MediaWiki and put it in the extensions directory.
- Add the following line to the end of LocalSettings.php:
The basic function of this extension is simple. It takes the code enclosed by:
Some stuff here...
And renders it at any place in the article with a display tag having the matching name:
<display name="foo" />
Display and define may appear anywhere in the article and in any order. For example, instead of having an infobox at the start of an article, one can have
<display name="infobox" /> and then define that infobox at the end of the article so that the wikicode will be organized in a more accessible manner.
Display tags can be reused multiple times, but the define statement must appear exactly once for each name used. If a define tag is missing for a given name, or appears multiple times with the same name, then an error will be generated.
<define> blocks are parsed to completion and passed back as HTML. This means that inserting a
<display> as a segment of a list or a table will not work correctly and in some cases may result in very strange displays.
In its present version this extension abuses Parser::parse in a way it was not intended to be used. In a series of a test cases this appeared the work as intended, but this functionality is not guaranteed, so try the extension at your own risk. A safer implementation would require adding new hooks to the parser and modifying the way the parser processes tags. Such changes may be considered in the future but they are not currently available in Mediawiki.