Extension:ArrayFunctions

The ArrayFunctions extension creates an additional set of pure, Parsoid-compatible parser functions that operate on arrays.

The extension works by using pure parser functions. Instead of manipulating some previously defined array, a pure parser function takes some arguments, performs some calculation, and returns the result. Arrays, and other data types, are passed around as opaque data types.

af_bool
This parser function casts a string to a boolean. This is useful for creating an array containing a boolean.

Parameters

 * value : string or boolean
 * The value to cast to a boolean.

Return values
Returns the casted boolean.

af_count
This parser functions counts the number of values in an array.

Parameters

 * array : array
 * The array to count.


 * recursive : boolean, default=false
 * Whether to count items recursively. Note that elements containing a list are also counted (see examples below).

Return values
The number of items in the array.

af_exists
This parser function checks whether the given key or index in an array exists.

Parameters

 * array : array
 * The array to check.


 * key : string or int
 * The key to check.

Return values
Returns true if  contains , false otherwise.

af_float
This parser function casts a string to a float. This is useful for creating an array containing a float.

Parameters

 * value : string or float
 * The value to cast to a float.

Return values
Returns the casted float.

af_foreach
This parser function provides a way to iterate over arrays.

Parameters

 * array : array
 * The array over which to iterate.


 * keyName : string, default=null
 * The name to use for the key.


 * valueName : string, default=null
 * The name to use for the value.


 * body : string
 * The body to return for each iteration.

Return values
Returns the resulting wikitext.

Installation
Not yet available.