Extension:Variables/Pre MW 1.12

This page describes the usage of the Variables extension in MediaWikis before version 1.12. From MediaWiki 1.12 on you can use one of the more current versions, starting from Variables 1.4. Currently the last available version for MW 1.12 is Variables 1.3.1.1.

Because in MediaWiki 1.12 significant parts of the parser were rewritten, Variables extension behaves differently in older MW versions. The following is an overview of the behaviors you should be aware of.

Usage with ParserFunctions
It must be noted that everything in conditional parser functions such as #ifexpr gets executed (though only one result gets displayed), regardless of the condition, see Help:Extension:ParserFunctions. This applies also to #vardefine. Thus:

first assigns b and then c (hence effectively just c) regardless of the condition, while

assigns only the applicable value.

Similarly

assigns b regardless of the condition, while

conditionally assigns value b to variable a (a dummy assignment of the value of a to a is done if the condition is not fulfilled).

Control Structure Functions
Another way around the aforementioned limitation is to use the Control Structure Functions extension, which allows one to delay the parsing of wiki markup through the use of character escape sequences. So, the first above example becomes this:

Alternatively, the Character Escapes extension can be used to automate the escape sequences:

The Control Structure Functions extension also has loop functions that support character escape sequences. The wiki markup:

produces the following:


 * 0
 * 1
 * 2