Extension:ArrayFunctions/Getting started/Introduction
Appearance
ArrayFunctions is a MediaWiki extension that provides a set of Parsoid-compatible parser functions that perform operations on arrays and that — in conjunction with Scribunto — can be used to build user interfaces in an elegant and structured manner.
Here is a minimal example:
{{#af_print: {{#af_sort: {{#af_list: orange | banana | strawberry | apple }} }} }}
- Result
- 0: apple
- 1: banana
- 2: orange
- 3: strawberry
The above example demonstrates the two core features of ArrayFunctions:
- Referential transparency - Parser functions are referentially transparent, meaning that the same input always gives the same output.
- Composability - Parser functions provided are composable, meaning that the output of one parser function can be used as the input of another parser function.
Together, these features are the key to making ArrayFunctions compatible with Parsoid's concurrent cached parsing model. Referential transparency guarantees that caching is safe, and composability forces Parsoid to parse the parser functions in the correct order.
Pick your learning path
[edit]- Read the guide - that explains how to use ArrayFunctions.
- Follow the tutorial - for hands-on experience on how to use ArrayFunctions.
- Check out the examples - for a collection of examples that cover common use-cases.