Extension:ArrayFunctions/Getting started/Introduction

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. Below is a minimal example:

Wikitext Result
{{#af_print: 
    {{#af_sort: 
        {{#af_list: orange | banana | strawberry | apple }}
    }}
}}
  • 0: apple
  • 1: banana
  • 2: orange
  • 3: strawberry

The above example demonstrates the two core features of ArrayFunctions:

  • Referential transparency - The parser functions are referentially transparent, meaning that the same input always gives the same output.
  • Composability - The 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