Extension:Loops/de

Die Loops-Erweiterung bietet, um Schleifen durchzuführen.

Aktuell wird diese Erweiterung auf einer Basisebene von MGChecker gewartet.

performs a loop (i.e. it repeatedly parses a given wiki markup block statement) so long as the condition mark-up evaluates to non-whitespace.


 * Beispiele:

Dieser Wiki-Markup:

ergibt folgendes:


 * 0
 * 1
 * 2
 * 3
 * 4

kann auch in einer Vorlage verwendet werden, um ein nummeriertes Array zu simulieren. Falls die Seite "Template:Loops Test" folgendes beinhaltet

Dann wird der Wiki-Markup

folgendes erzeugen:


 * null
 * eins
 * zwei
 * drei
 * vier

It's important to note that whitespace, including newlines, tabs, and spaces, is stripped from the beginning and end of all the arguments of these parser functions. If this is not desirable, adding any non-whitespace characters (including the HTML encoding for a whitespace character ) will prevent further stripping (hence the  tags in the above examples).

performs exactly like, with the exception that the block statement is guaranteed to be parsed and displayed (if it results in displayable text) at least once. This is done before the condition text is evaluated.

repeatedly parses and displays &lt;wiki markup> a number of times equal to the absolute value of &lt;number of loops to be performed>. &lt;Starting value> is placed in a variable (accessible by extension's   parser function) using the name &lt;variable name>. After each loop, the variable is incremented by one if &lt;number of loops to be performed> is positive, or decremented by one if &lt;number of loops to be performed> is negative.

Der folgende Code:
 * Beispiele :

erzeugt folgendes:


 * Dies ist Runde 4 und wir haben noch 3 vor uns
 * Dies ist Runde 5 und wir haben noch 2 vor uns
 * Dies ist Runde 6 und wir haben noch 1 vor uns
 * Dies ist Runde 7 und wir haben noch 0 vor uns

(experimentell)
soll in Vorlagen verwendet werden.

It takes arguments that are passed to the template and puts them in variables accessible by extension's   parser function.

This function iterates through each argument whose name begins with &lt;prefix>.

With each iteration it puts the argument name minus &lt;prefix> into &lt;key> as if calling.

It then takes the value of the argument and puts it into &lt;value> in a similar method.

The block statement is then expanded.

The block statement may contain  and   to access the stored arguments.
 * Beispiel

If the page "Template:Loops Test" contains

then the wiki markup

produces


 * 1 = val1
 * 5 = val5
 * ument = value

( experimental )
performs similarly to  with two major differences: It doesn't take a prefix argument, and it only works on numbered arguments whether they're explicitly numbered,

or implicitly numbered.

Mixing these methods in a single template call may cause values to get overwritten, so be careful.


 * Beispiele

If "Template:Loops Test" is edited to contain:

then

will result in


 * 1 = Apricot
 * 2 = Caramel slice
 * 5 = Eclair

Konfiguration
These configuration variables have to be set in the  file after the inclusion of this extension.


 * This parameter sets the maximum number of loops a page is allowed to perform (default ). Setting it to   lets the loops run within the limits of phps environment. This parameter affects neither the   nor   parser functions.
 * This parameter sets the maximum number of loops a page is allowed to perform (default ). Setting it to   lets the loops run within the limits of phps environment. This parameter affects neither the   nor   parser functions.


 * Configuration variable (array) to define which Loops functions should be enabled. By default, all functions are enabled if the extension is installed as well. If the Variables extension is not installed, ,   and   will be disabled since they do not work without it being installed. To enable the   and   functions only, one can use:
 * Configuration variable (array) to define which Loops functions should be enabled. By default, all functions are enabled if the extension is installed as well. If the Variables extension is not installed, ,   and   will be disabled since they do not work without it being installed. To enable the   and   functions only, one can use:



Siehe auch

 * - Eine weitere Erweiterung für Schleifen
 * Module:Loops