Extension:DelayedDefinition

DelayedDefinition is an extension that adds two tags to Mediawiki:  and. Collectively these serve to allow chunks of wikicode to be defined in a different part of the same page from where it is displayed.

Installation

 * 1) Download the snapshot that matches your version of MediaWiki and put it in the  directory.
 * 2) Add the following line to the end of  :

Usage
The basic function of this extension is simple. It takes the code enclosed by:

And renders it at any place in the article with a display tag having the matching name:

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  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.

Current limitations
Currently  blocks are parsed to completion and passed back as HTML. This means that inserting a  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.