Jump to content

Extension:ArrayFunctions/ko

From mediawiki.org
This page is a translated version of the page Extension:ArrayFunctions and the translation is 25% complete.
미디어위키 확장 기능 설명서
ArrayFunctions
출시 상태: 안정
구현 파서 함수
설명 Provides a set of pure parser functions that operate on arrays
만든 이 Marijn van Wezel (Wikibase Solutions)
최신 버전 2.0.1 (2026-06-18)
호환성 정책 Master maintains backward compatibility.
MediaWiki >=1.40.0
PHP >=7.4
데이터베이스 변경 아니오
Composer wikibase-solutions/array-functions
  • $wgArrayFunctionsMaxPipelineLength
  • $wgArrayFunctionsEnableErrorTracking
  • $wgArrayFunctionsMaxRangeSize
  • $wgArrayFunctionsForeachIterationLimit
Licence GNU General Public License 2.0 or later
다운로드
ArrayFunctions 확장 기능 번역 (translatewiki.net에서 가능한 경우)
이슈 미해결 작업 · 버그 보고

Documentation for other releases: 1.0 · 1.1 · 1.2 · 1.3 · 1.4 · 1.5 · 1.6 · 1.7 · 1.8 · 1.9 · 1.10 · 1.11 · 1.12 · 1.13 · 1.14 · 1.15 · 1.16 · 1.17 · 2.0.

The ArrayFunctions extension creates a set of pure, 파르소이드 -compatible (see here) parser functions that perform operations on arrays.

설치

  • 파일을 다운로드하고 ArrayFunctions 폴더를 extensions/ 디렉토리에 넣어 주세요.
    개발자와 코딩 기여자는 Git을 이용해 확장기능을 다운받는 것이 좋습니다.
    cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/ArrayFunctions
    
  • 아래의 코드를 LocalSettings.php 코드의 마지막에 추가합니다.
    wfLoadExtension( 'ArrayFunctions' );
    // Increase $wgMaxArticleSize to allow for larger arrays (default: 2048)
    $wgMaxArticleSize = 8192;
    
  • Configure performance limits as necessary.
  • Yes 완료 – 위키의 ‘Special:Version’에 이동해서, 확장기능이 올바르게 설치된 것을 확인합니다.

요약

ArrayFunctions defines a collection of parser functions that allow you to work with immutable lists and objects, collectively "arrays". Instead of storing these arrays in memory, they are outputted by the parser function directly, and can be passed around to templates or to other parser functions. While it is possible to create and work with arrays entirely through wikitext, the recommended approach is to use Scribunto (Lua), Semantic MediaWiki or Cargo to create an array that contains all the necessary data, and use ArrayFunctions only for formatting the array. The #af_list and #af_object parser functions should primarily be used for simple, one-off arrays.

ArrayFunctions defines many (over 30) parser functions, but the most useful ones are:

  • #af_getto retrieve a value, or perform some operation succincly;
  • #af_pipelineto create a pipeline of operations to prevent deep nesting;
  • #af_foreachto iterate over an array;
  • #af_showto output a value stored in an array;
  • #af_printto print an array for debug purposes;
  • #af_mapto modify all elements of an array;
  • #af_templateto invoke a template with data stored in an array;
  • #af_listto create a list;
  • #af_objectto create an object;
  • #af_zipto zip two or more arrays together.

호환성

ArrayFunctions has a commitment to not breaking backwards-compatibility. This means that user-facing code (e.g. parser functions, Lua fuctions and magic words) will keep working indefinitely, and changes will always be implemented in a backwards-compatible manner.

ArrayFunctions also tries to keep compatibility with older versions of MediaWiki for as long as possible, but due to the nature of extensions, this may not be possible indefinitely. In case an update of MediaWiki breaks a feature that ArrayFunctions relies on, it will be patched in a backwards compatible manner if this is possible. Otherwise, a new MAJOR version of ArrayFunctions will be released.

Compatibility Matrix
ArrayFunctions MediaWiki PHP Scribunto1 Semantic MediaWiki1 Cargo1
2.0.0+
미디어위키 버전:
1.40
PHP version
7.4.3
Scribunto version
1.40
Semantic MediaWiki version
5.0
Cargo version
3.8
1.15.0+
미디어위키 버전:
1.35
PHP version
7.4.0
Scribunto version
1.35
Semantic MediaWiki version
4.0
Cargo version
3.0
1.14+
미디어위키 버전:
1.35
PHP version
7.4.0
Scribunto version
1.35
Semantic MediaWiki version
4.0
N/A
1.0-1.13
미디어위키 버전:
1.35 – 1.43
PHP version
7.4.0
Scribunto version
1.35
N/A N/A
1 Soft dependency; version constraint only applicable when the software is installed.

Performance limits

ArrayFunctions version
1.16
MediaWiki already limits the total size of arrays through $wgMaxArticleSize .

ArrayFunctions provides a number of configuration parameters to limit the computation time of certain functions and prevent users from performing a denial-of-service attack on your wiki. For backwards-compatibility reasons, these limits are off by default. The available configuration parameters are:

Name Default Recommended Description
$wgArrayFunctionsForeachIterationLimit -1 ~1024 This configuration parameter limits the maximum number of #af_foreach iterations a page is allowed to perform. Setting it to anything below zero will impose no restrictions on the number of iterations.
$wgArrayFunctionsMaxRangeSize -1 ~4096 This configuration parameter limits the maximum size of an array constructed with the #af_range parser function. Setting it to anything below zero will impose no restrictions on the size of arrays constructed with #af_range.
$wgArrayFunctionsMaxPipelineLength -1 ~$wgMaxTemplateDepth / 4 This configuration parameter limits the maximum length of a pipeline (#af_pipeline). Setting it to anything below zero will impose no restrictions on the number of steps in a pipeline.

These limits are reported in the parser limit report, which can be used to tweak the settings or debug a page.

FAQ

How can I define an array to be used throughout a page?

It is not possible to directly define an array to be used throughout a page, because this would require sequential processing of extension tags, which is not supported by Parsoid (see Extension API#No support for sequential, in-order processing of extension tags). Instead, you can pass arrays around as template parameters:

{{My template|{{#af_list:a|b|c}}}}

This way, the array is available in Template:My template as {{{1}}}.

How to iterate over an array?

It is possible to iteratively access elements of an array using #af_foreach:

{{#af_foreach:{{#af_list:red|green|blue}}||color|<nowiki/>
* {{{color}}} is my favourite.
}}

The expected output from the snipped above is:

  • red is my favourite.
  • green is my favourite.
  • blue is my favourite.

Why are values not recognized as arrays?

This may happen because your arrays are too large. MediaWiki internally keeps a counter on the total size of template arguments, which can be increased by increasing $wgMaxArticleSize.

How is this different from extensions such as Arrays or Variables?

The main difference between ArrayFunctions and those extensions is that ArrayFunctions parser functions are pure. This means that instead of modifying or declaring a variable, the parser function directly outputs its result.

For example with #af_map, the given array is not modified; instead, a copy is created, modified and then outputted. No parser function in ArrayFunctions modifies global state: all computation happens solely with the invocation of the parser function. This makes working with ArrayFunctions very different from working with other extensions such as Arrays or Variables. Instead of imperatively modifying an array stored in a variable, function composition must be used to perform more complex operations. For example:

Arrays
{{#arraydefine: fruits | orange, banana, strawberry, apple }}
{{#arraysort: fruits | asc }}
{{#arrayprint: fruits }}
ArrayFunctions
{{#af_pipeline: {{#af_list: orange | banana | strawberry | apple }}
| {{#af_sort: {{{prev}}} }}
| {{#af_print: {{{prev}}} }}
}}

Why is whitespace trimmed from array values?

Whitespace is inherently implicit in wikitext. In order to be consistent with this behaviour, whitespace is recursively trimmed from array values.

함수

  • Parameters prefixed with a single asterisk (*) denote that a variable number of positional arguments can be passed.
  • Parameters prefixed with a double asterisk (**) denote that a variable number of named arguments can be passed.
  • All keyword argument names are case-sensitive.
  • All string arguments support the following escape sequences:
\s for spaces
\n for newlines
\\ for backslashes

The extension defines the following parser functions, Lua functions, Semantic MediaWiki result formats, Cargo display formats and magic words:

Construct an array or value
Name Description
#af_bool Cast a string to a boolean.
#af_float Cast a string to a float.
#af_int Cast a string to an integer.
#af_list Create a new list from values.
#af_object Create a new object from values.
#af_range Create a finite range of integers.
#af_split Split a string based on a delimiter.
AF_EMPTY The empty array.
mw.af.export Create a new array from Lua.
arrayfunctions Format a Semantic MediaWiki query result as an ArrayFunctions array.
arrayfunctions Display a Cargo query result as an ArrayFunctions array.
Extract information from an array
Name Description
#af_count Count the number of values in an array.
#af_exists Check whether a key or index exists in an array.
#af_get Retrieve an element from an array by index.
#af_isarray Check if a value is an array.
#af_print Print an array for debug purposes.
#af_search Searches an array for a value.
#af_show Show a value in a human-readable format.
mw.af.import Create a new table from an ArrayFunctions array.
Create an array from an existing array
Name Description
#af_difference Compute the difference between arrays.
#af_filter Filter element from an array.
#af_flatten Flatten an array.
#af_group Compute an array that when indexed yields all elements of a key from all subarrays.
#af_intersect Compute the intersection of arrays.
#af_keysort Sort a list of objects based on the values of a key.
#af_ksort Sort an array by key.
#af_merge Compute the union of arrays.
#af_push Add a value to the end of a list.
#af_put Set a value at an index.
#af_reverse Reverse an array.
#af_set Set a value at an index (1.13.0에서 구식화됨).
#af_slice Extract a slice from an array.
#af_sort Sort a list.
#af_unique Remove duplicates from an array.
#af_unset Remove a value from an array by index.
#af_zip Zip two or more arrays together.
Iterate over an array
Name Description
#af_foreach Iterate over an array.
#af_join Recursively join the items of an array together with a separator.
#af_map Apply a callback to each element of a list.
#af_reduce Iteratively reduce the array to a single value using a callback.
Miscellaneous functions
Name Description
#af_if Select one of two alternatives based on a predicate.
#af_pipeline Create a pipeline of functions.
#af_stringmap Apply a callback to each value in a delimited string.
#af_template Invoke a template with the values in an array.
#af_trim Trim characters at the start and end of a string.

af_bool

ArrayFunctions version
1.0

This parser function casts a string to a boolean. This is useful for creating an array containing a boolean. The values that are considered as true are "1", "true", "on", and "yes". The values that are considered as false are "0", "false", "off", and "no". If any other value is given, an error will be returned.

설명

{{#af_bool: value }}

매개변수

Name Type Description
value string or boolean The value to cast to a boolean.

반환 값

Returns the casted boolean.

예시

Create an opaque representation of a boolean
{{#af_bool: yes }}, {{#af_bool: no }}, {{#af_bool: true }}
boolean__^__1, boolean__^__0, boolean__^__1
Create an array containing a boolean
{{#af_print: {{#af_list: {{#af_bool: yes}} }} }}
  • 0: true

af_count

ArrayFunctions version
1.0

This parser functions counts the number of values in an array. By default, this parser function only counts the number of top-level elements. However, if the keyword argument recursive is given a true value, it will also count the number of items in any sub-arrays. Note that in case of recursive=true, both the element containing an array, as well as all values inside the array are counted.

설명

{{#af_count: array | recursive=recursive }}

매개변수

Name Type Default Description
array array The array to count.
recursive boolean false Whether to count items recursively.

반환 값

The number of items in the array.

예시

Count the number of items in a one-dimensional list
{{#af_print: {{#af_count: {{#af_list: a | b | c }} }} }}
3
Count the number of items in a multi-dimensional list
{{#af_print: {{#af_count: {{#af_list: {{#af_list: a | b }} | {{#af_list: c | d }} }} }} }}
2
Recursively count the number of items in a multi-dimensional list
{{#af_print: {{#af_count: {{#af_list: {{#af_list: a | b }} | {{#af_list: c | d }} }} | recursive=true }} }}
6

af_difference

ArrayFunctions version
1.5
The difference between three arrays

This parser function computes the difference between arrays. This function preserves keys.

설명

{{#af_difference: array | *arrays }}

매개변수

Name Type Description
array array The first array.
*arrays array The other arrays.

반환 값

Returns an array containing all values from array that are not present in any of the arrays in arrays. The keys in array are preserved.

예시

Compute the difference of three arrays
{{#af_print: {{#af_difference: {{#af_list: a | b | c }} | {{#af_list: a }} | {{#af_list: b}} }} }}
  • 2: c

af_exists

ArrayFunctions version
1.0

This parser function checks whether the given key or index exists in the given array. Multiple keys can be given to check nested arrays.

설명

{{#af_exists: array | *keys }}

매개변수

Name Type Description
array array The array to check.
keys string or int The key to check. Multiple keys can be given to check if a nested key exists.

반환 값

Returns true if array contains the key, false otherwise.

예시

Check if a key exists
{{#af_print: {{#af_exists: {{#af_object: hello=world }} | hello }} }}
true
Check if an index exists
{{#af_print: {{#af_exists: {{#af_list: a | b | c }} | 2 }} }}
true
Check if a nested key exists
{{#af_print: {{#af_exists: {{#af_list: a | {{#af_list: b | c }} }} | 0 | 3 }} }}
false

af_filter

ArrayFunctions version
2.0

This parser function filters elements from an array based on a condition. The condition is evaluated for each element in the array, and if the condition returns a "falsy" value, the element will be removed. Otherwise, the element will be kept. The values that are considered "falsy" are:

  • The empty string;
  • The boolean false;
  • The strings "no", "off", "false" and "0".

If no condition is given, all empty elements are removed. Indices are not reset after calling this function.

Description

{{#af_filter: array | value_name | condition }}

Parameters

Name Type Default Description
array array The array to filter.
value_name string null The name to give to the value in the condition.
condition string null The condition to filter on.

Return values

Returns the array with all values for which the condition returned a falsy value removed.

Examples

Remove all empty values
{{#af_print: {{#af_filter: {{#af_list: a | | c }} }} }}
  • 0: a
  • 2: c
Remove the element "b"
{{#af_print: {{#af_filter: {{#af_list: a | b | c }} | v | {{#ifeq: {{{v}}} | b | yes }} }} }}
  • 0: a
  • 2: c

af_flatten

ArrayFunctions version
1.11

This parser function creates a new array with all sub-array elements concatenated into it recursively up to the specified depth, or until it is completely flattened if no depth is specified.

설명

{{#af_flatten: array | depth }}

매개변수

Name Type Default Description
array array The array to flatten.
depth integer null The depth to flatten to, or nothing to flatten until the array is completely flat.

반환 값

Returns an array with all sub-array elements concatenated into it recursively up to the specified depth, or a completely flattened array if no depth is specified.

예시

Flatten an array one level deep
{{#af_print: {{#af_flatten: {{#af_list: {{#af_list: a | b | c }} | {{#af_list: d | e | f }} }} }} }}
  • 0: a
  • 1: b
  • 2: c
  • 3: d
  • 4: e
  • 5: f

af_float

ArrayFunctions version
1.0

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

설명

{{#af_float: value }}

매개변수

Name Type Description
value string or float The value to cast to a float.

반환 값

Returns the casted float.

예시

Create an opaque representation of a float
{{#af_float: 1.298 }}, {{#af_float: 0 }}
float__^__1.298, float__^__0
Create an array containing a float
{{#af_print: {{#af_list: {{#af_float: 1.298 }} }} }}
  • 0: 1.298

af_foreach

ArrayFunctions version
1.0

This parser function provides a way to iterate over arrays. For each of the elements in the given input array, it will evaluate its body, replacing any occurences of the key_name and value_name variables. These variables can be accessed in the same manner as template parameters, by surrounding them with triple braces (e.g. {{{value_name}}}).

The behaviour of this parser function might be influenced by the $wgArrayFunctionsForeachIterationLimit configuration parameter.

설명

{{#af_foreach: array | key_name | value_name | body | delimiter=delimiter }}

매개변수

Name Type Default Description
array array The array over which to iterate.
key_name string null The name to use for the key.
value_name string null The name to use for the value.
body string The body to return for each iteration.
delimiter string "" The delimiter to put between results (available since version 1.9.0).

반환 값

Returns the resulting wikitext.

예시

Iterate over a list
{{#af_foreach: {{#af_list: John | Steve | Harry }} | | name | Hello, {{{name}}}!<br/> }}
Hello, John!
Hello, Steve!
Hello, Harry!
Iterate over an object
{{#af_foreach: {{#af_object: Hello=John | Hi=Steve | Welcome=Harry }} | greeting | name | {{{greeting}}}, {{{name}}}!<br/> }}
Hello, John!
Hi, Steve!
Welcome, Harry!
Iterate over a list and add a delimiter
{{#af_foreach: {{#af_list: John | Steve | Harry }} | | name | Hello, {{{name}}}! | delimiter=<br/> }}
Hello, John!
Hello, Steve!
Hello, Harry!

af_get

ArrayFunctions version
1.0

This parser function retrieves the element with the given index from the given array, or performs some operation if the index is overloaded. If the index does not exist and it is not an overloaded index, the empty string is returned.

An overloaded index allows the user to succinctly perform certain simple operations on arrays during indexing. Using an overloaded index is identical to first performing an #af_get with all indices before the overloaded index, then performing the function specified by the overloaded index, and then performing another #af_get with the remaining indices. For example, {{#af_get: {{{1}}} | a | * | b }} is equivalent to {{#af_get: {{#af_group: {{#af_get: {{{1}}} | a }} }} | b }}.

If the array contains a key that clashes with the symbol for an overloaded index, the value under the key will be retrieved instead. This was done for backwards compatibility reasons.

설명

{{#af_get: array | *indices }}

매개변수

Name Type Description
array array The array in which to index.
*indices string The index. Multiple indices can be given to index nested arrays.
Overloaded indices (available since version 1.11.0)
Syntax Equivalent function Description
* #af_group Group subarrays together by key.
<- #af_reverse Reverse the array.
>< #af_flatten Flatten the array once.
>><< #af_flatten Flatten the array until it is completely flat.
# #af_unique Remove duplicates from the array.
n..m #af_slice Retrieve a slice of the array (either n or m can be omitted to index from the start up to the end of the array respectively).
! (available since version 1.16.0) #af_show Show the value in a human-readable way using format table, simple.
// (available since version 2.0.0) #af_filter Remove all empty elements from the array.

반환 값

Returns the indexed value, or the empty string if the index does not exist.

예시

Get a top-level element
{{#af_get: {{#af_list: a | b | c }} | 1 }}
b
Get a subarray
{{#af_print: {{#af_get: {{#af_list: a | {{#af_list: b | c }} }} | 1 }} }}
  • 0: b
  • 1: c
Get a nested element
{{#af_get: {{#af_list: a | {{#af_object: hello=world }} }} | 1 | hello }}
world
Reverse the array
{{#af_print: {{#af_get: {{#af_list: a | b | c }} | <- }} }}
  • 0: c
  • 1: b
  • 2: a
Retrieve the last element of the array
{{#af_print: {{#af_get: {{#af_list: a | b | c }} | <- | 0 }} }}
c

af_group

ArrayFunctions version
1.11

This parser function computes an array where subarrays are recursively grouped together by key.

설명

{{#af_group: array }}

매개변수

Name Type Description
array array The array for which to group subarrays together.

반환 값

Returns an array where subarrays are recursively grouped together by key.

예시

Group subarrays by key
{{#af_print: {{#af_group: {{#af_list: {{#af_object: a=1 | b=2 }} | {{#af_object: a=3 | b=4 }} | {{#af_object: a=5 | b=5 }} }} }} }}
  • a
    • 0: 1
    • 1: 3
    • 2: 5
  • b
    • 0: 2
    • 1: 4
    • 2: 5

af_if

ArrayFunctions version
1.0

This parser function selects one of two alternatives based on the given predicate.

설명

{{#af_if: predicate | consequent | alternative }}

매개변수

Name Type Default Description
predicate boolean The predicate.
consequent string The value to return if the predicate holds (i.e. is true).
alternative string "" The value to return if the predicate does not hold (i.e. is false).

반환 값

Returns the consequent if the predicate holds, or the alternative if it is given and the predicate does not hold.

예시

Check if a value is an array
{{#af_if: {{#af_isarray: not an array }} | A beautiful array! | Not an array! }}
Not an array!

af_int

ArrayFunctions version
1.0

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

설명

{{#af_int: value }}

매개변수

Name Type Description
value string or int The value to cast to an integer.

반환 값

Returns the casted integer.

예시

Create an opaque representation of an integer
{{#af_int: 42 }}, {{#af_int: -12 }}
integer__^__42, integer__^__-12
Create an array containing an integer
{{#af_print: {{#af_list: {{#af_int: -129}} }} }}
  • 0: -129

af_intersect

ArrayFunctions version
1.2
The intersection of three arrays

This parser function computes the intersection of arrays. This function preserves keys.

설명

{{#af_intersect: array | *arrays }}

매개변수

Name Type Description
array array The first array.
*arrays array The other arrays.

반환 값

Returns the intersection of the given arrays.

예시

Compute the intersection of two identical arrays
{{#af_print: {{#af_intersect: {{#af_list: a | b | c }} | {{#af_list: a | b | c }} }} }}
  • 0: a
  • 1: b
  • 2: c
Compute the intersection of two partially overlapping arrays
{{#af_print: {{#af_intersect: {{#af_list: a | b | c }} | {{#af_list: c | d | e }} }} }}
  • 2: c

af_isarray

ArrayFunctions version
1.0

This parser function checks if the given value is an array.

설명

{{#af_isarray: value }}

매개변수

Name Type Description
value mixed The value to check.

반환 값

Returns true if value is an array, false otherwise.

예시

Check if an array is an array
{{#af_print: {{#af_isarray: {{#af_list: a | b | c }} }} }}
true
Check if a string is an array
{{#af_print: {{#af_isarray: Hello, World! }} }}
false

af_join

ArrayFunctions version
1.0

This parser function recursively joins the items of an array together with a given separator.

설명

{{#af_join: array | glue }}

매개변수

Name Type Default Description
array array The array to join.
glue string "" The string used to join each item.

반환 값

Returns the joined array.

예시

Join a one-dimensional array
{{#af_join: {{#af_list: a | b | c }} }}
abc
Join a one-dimensional array using a separator
{{#af_join: {{#af_list: a | b | c }} | \s-\s }}
a - b - c
Join a multi-dimensional array using a separator
{{#af_join: {{#af_list: a | b | {{#af_list: c | d }} }} | \s-\s }}
a - b - c - d

af_keysort

ArrayFunctions version
1.0

This parser function sorts a list of objects based on the values of the specified key. To sort an array by key, use #af_ksort.

설명

{{#af_keysort: array | key | descending=descending | caseinsensitive=caseinsensitive }}

매개변수

Name Type Default Description
array array The array to sort.
key string The key of the values on which the sort should be based.
descending boolean false Whether to sort in a descending order.
caseinsensitive boolean false Whether to ignore case when sorting (available since version 1.7.0).

반환 값

Returns the sorted array.

예시

Sort based on age
{{#af_print: {{#af_keysort: {{#af_list:
    {{#af_object: name=John | age=56 }} |
    {{#af_object: name=Harry | age=12 }} |
    {{#af_object: name=Bob | age=24 }}
}} | age }} }}
  • 0
    • name: Harry
    • age: 12
  • 1
    • name: Bob
    • age: 24
  • 2
    • name: John
    • age: 56
Sort based on age, in descending order
{{#af_print: {{#af_keysort: {{#af_list:
    {{#af_object: name=John | age=56 }} |
    {{#af_object: name=Harry | age=12 }} |
    {{#af_object: name=Bob | age=24 }}
}} | age | descending=true }} }}
  • 0
    • name: John
    • age: 56
  • 1
    • name: Bob
    • age: 24
  • 2
    • name: Harry
    • age: 12

af_ksort

ArrayFunctions version
1.7

This parser function sorts an array by key.

설명

{{#af_ksort: array | descending=descending | caseinsensitive=caseinsensitive }}

매개변수

Name Type Default Description
array array The array to sort.
descending boolean false Whether to sort in a descending order.
caseinsensitive boolean false Whether to ignore case when sorting (available since version 1.7.0).

반환 값

Returns the sorted array.

예시

Sort by key
{{#af_print: {{#af_ksort: {{#af_object: c=banana | a=orange | b=apple }} }} }}
  • a: orange
  • b: apple
  • c: banana

af_list

ArrayFunctions version
1.0

This parser function creates a new list from the given parameters.

설명

{{#af_list: *values }}

매개변수

*values : mixed
The values for the list.

반환 값

Returns the resulting list.

예시

Create a simple one-dimensional list
{{#af_print: {{#af_list: a | b | c }} }}
  • 0: a
  • 1: b
  • 2: c
Create a multi-dimensional list
{{#af_print: {{#af_list: {{#af_list: a | b }} | {{#af_list: c | d }} }} }}
  • 0
    • 0: a
    • 1: b
  • 1
    • 0: c
    • 1: d
Create a list of objects
{{#af_print: {{#af_list:
    {{#af_object: name=Harry | age=22 }} |
    {{#af_object: name=Bobby | age=29 }}
}} }}
  • 0
    • name: Harry
    • age: 22
  • 1
    • name: Bobby
    • age: 29

af_map

ArrayFunctions version
1.0

This parser function applies a callback to each element of a list.

설명

{{#af_map: array | value_name | callback }}

매개변수

array : array
The array to run through the callback.
value_name : string
The name to give to the value in the callback.
callback : string
The callback to apply to each element of the array.

반환 값

Returns the resulting mapped array.

예시

Appending a string to each element
{{#af_print: {{#af_map: {{#af_list: a | b | c }} | v | {{{v}}}-appended }} }}
  • 0: a-appended
  • 1: b-appended
  • 2: c-appended
Altering list elements
{{#af_print: {{#af_map: {{#af_list: {{#af_list: a }} | {{#af_list: b }} }} | v | {{#af_push: {{{v}}} | c }} }} }}
  • 0
    • 0: a
    • 1: c
  • 1
    • 0: b
    • 1: c

af_merge

ArrayFunctions version
1.2

This parser function computes the merges two or more arrays. It merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It does not remove duplicates.

If the input arrays have the same string key, then the later value for that key will overwrite the previous one. If the arrays contain numeric keys, later values will be appended instead and the later keys will be renumbered.

설명

{{#af_merge: array | *arrays }}

매개변수

array : array
The first array.
*arrays : array
The other arrays.

반환 값

Returns the union of the given arrays.

예시

Appending a string to each element
{{#af_print: {{#af_merge: {{#af_list: a | b | c }} | {{#af_list: d | e | f }} }} }}
  • 0: a
  • 1: b
  • 2: c
  • 3: d
  • 4: e
  • 5: f

af_object

ArrayFunctions version
1.0

This parser function creates a new object from the given parameters.

설명

{{#af_object: **values }}

매개변수

**values : mixed
The values for the object.

반환 값

Returns the resulting object.

예시

Create a simple one-dimensional object
{{#af_print: {{#af_object: a=b | b=c | c=d }} }}
  • a: b
  • b: c
  • c: d
Create a multi-dimensional object
{{#af_print: {{#af_object: head={{#af_object: title=MediaWiki | meta={{#af_list: {{#af_object: charset=UTF-8 }} }} }} }} }}
  • head
    • title: MediaWiki
    • meta
      • 0
        • charset: UTF-8

af_pipeline

ArrayFunctions version
1.14

This parser function creates a pipeline of operations. The parser function takes the result from expanding the previous argument, and passes that as the specified parameter (or prev by default) to the next argument of the parser function. This is very useful to improve the readability of the template code, as it allows you to remove deeply nested parser function calls. For example, the following two snippets are semantically equivalent:

Before After
{{#af_print: {{#af_unique: {{#af_reverse: {{#af_list: a | a | b | c}} }} }} }}
{{#af_pipeline: {{#af_list: a | a | b | c }}
| {{#af_reverse: {{{prev}}} }}
| {{#af_unique: {{{prev}}} }}
| {{#af_print: {{{prev}}} }}
}}

The behaviour of this parser function might be influenced by the $wgArrayFunctionsMaxPipelineLength configuration parameter.

설명

{{#af_pipeline: initial | *steps | parameter=parameter }}

매개변수

Name Type Default Description
initial mixed The initial value of the pipeline.
*steps mixed The subsequent steps of the pipeline.
parameter string "prev" The name to use for the previous value.

반환 값

Returns the value returned by the final step of the pipeline.

예시

Create a pipeline
{{#af_pipeline: {{#af_list: a | a | b | c }}
| {{#af_reverse: {{{prev}}} }}
| {{#af_unique: {{{prev}}} }}
| {{#af_print: {{{prev}}} }}
}}
  • 0: c
  • 1: b
  • 2: a

af_print

ArrayFunctions version
1.0

This parser function prints the given value for debug purposes. Unlike #af_show, it does not parse the value. This function should only be used for debug purposes, consider using #af_show to display a value to the reader.

설명

{{#af_print: *values | end=end }}

매개변수

Name Type Default Description
*values mixed The values to print.
end string "" The string to append to the end of each printed value.

반환 값

Returns the value in human-readable form.

예시

Print a boolean
{{#af_print: {{#af_bool: yes }} }}
true
Print a list
{{#af_print: {{#af_list: a | b | c }} }}
  • 0: a
  • 1: b
  • 2: c

af_push

ArrayFunctions version
1.0

This parser function adds the given value to the end of the list.

설명

{{#af_push: array | value }}

매개변수

array : array
The array to append the value to.
value : mixed
The value to add.

반환 값

Returns the array with the value appended.

예시

Push a value
{{#af_print: {{#af_push: {{#af_list: a | b }} | c }} }}
  • 0: a
  • 1: b
  • 2: c

af_put

ArrayFunctions version
1.13

This parser function sets the given value for the given index. It is identical to #af_set, except for the parameter order. This parser function should be preferred over #af_set.

설명

{{#af_put: array | value | *indices }}

매개변수

array : array
To array in which to set the index.
value : mixed
The value to set the index to.
*indices : string
The index to set. Multiple indices can be given to index nested arrays.

반환 값

Returns the array with the given index set to the given value.

예시

Replace an existing value
{{#af_print: {{#af_put: {{#af_list: a | b | c }} | d | 2 }} }}
  • 0: a
  • 1: b
  • 2: d
Create a new index
{{#af_print: {{#af_set: {{#af_object: foo=bar }} | far | boo }} }}
  • foo: bar
  • boo: far
Create a new subarray
{{#af_print: {{#af_set: {{#af_object: foo=bar }} | far | boo | far }} }}
  • foo: bar
  • boo
    • far: far

af_range

ArrayFunctions version
1.12

This parser function creates a finite range of integers. The ith element of a range is determined by the function r(i) = start + step * i. For a positive step, the bounds of the range are i >= 0 and r(i) < stop. For a negative step, the bounds are i >= 0 and r(i) > stop.

The behaviour of this parser function might be influenced by the $wgArrayFunctionsMaxRangeSize configuration parameter.

설명

{{#af_range: start | stop | step }}

매개변수

Name Type Default Description
start integer The start of the range.
stop integer null The end of the range (non-inclusive). If this value is omitted, the start will become the stop, and start will default to zero.
step integer 1 The step size between range values.

반환 값

A finite range of integers.

예시

Create a range from 0 to 4
{{#af_print: {{#af_range: 0 | 5 }} }}
  • 0: 0
  • 1: 1
  • 2: 2
  • 3: 3
  • 4: 4
Alternative syntax for a range from 0 to 4
{{#af_print: {{#af_range: 5 }} }}
  • 0: 0
  • 1: 1
  • 2: 2
  • 3: 3
  • 4: 4
Create a range from 0 to -4
{{#af_print: {{#af_range: 0 | -5 | -1 }} }}
  • 0: 0
  • 1: -1
  • 2: -2
  • 3: -3
  • 4: -4
Create a range of all odd numbers between 0 to 10
{{#af_print: {{#af_range: 1 | 10 | 2 }} }}
  • 0: 0
  • 1: 3
  • 2: 5
  • 3: 7
  • 4: 9

af_reduce

ArrayFunctions version
1.2

This parser function iteratively reduces the array to a single value using a callback. It iteratively applies callable to the elements of the given array, so as to reduce the array to a single value. The callable is passed the value of the current iteration, as well as the result of the previous iteration.

설명

{{#af_reduce: array | carry_name | value_name | callable | initial }}

매개변수

Name Type Default Description
array array The array to reduce.
carry_name string The name to use for the carry.
value_name string The name to use for the value.
callable string The callback to use for each iteration.
initial string "" The initial carry to use.

반환 값

Returns the resulting value.

예시

Using reduction to concatenate values
{{#af_reduce: {{#af_list: a | b | c }} | c | i | {{{c}}}{{{i}}} }}
abc
Using reduction to reverse and then concatenate values
{{#af_reduce: {{#af_list: a | b | c }} | c | i | {{{i}}}{{{c}}} }}
cba
Using reduction to build an equation
{{#af_reduce: {{#af_list: 2 | 3 | 5 | 7 | 11 }} | c | i | {{{c}}} + {{{i}}} | 0 }}
0 + 2 + 3 + 5 + 7 + 11

af_reverse

ArrayFunctions version
1.11

This parser function reverses the given array. It does not preserve numeric keys.

설명

{{#af_reverse: array }}

매개변수

array : array
The array to reverse.

반환 값

Returns the original array reversed.

예시

Reverse a list
{{#af_print: {{#af_reverse: {{#af_list: a | b | c}} }} }}
  • 0: c
  • 1: b
  • 2: a
ArrayFunctions version
1.3

This parser function searches the given array for the given value, and returns the first corresponding key if the value is found.

설명

{{#af_search: array | value }}

매개변수

array : array
The array to search in.
value : mixed
The value to search for.

반환 값

Returns the first corresponding key if the value is found, nothing otherwise.

예시

Search for a value in an array
{{#af_print: {{#af_search: {{#af_list: a | b | c }} | b }} }}
1

af_set

ArrayFunctions version
1.0

(1.13.0에서 구식화됨)

This parser function sets the given value for the given index. It has been deprecated in ArrayFunctions 1.13.0, and should no longer be used. It will remain available indefinitely for backwards compatibility. As an alternative, you should use #af_put instead.

설명

{{#af_set: value | array | *indices }}

매개변수

value : mixed
The value to set the index to.
array : array
To array in which to set the index.
*indices : string
The index to set. Multiple indices can be given to index nested arrays.

반환 값

Returns the array with the given index set to the given value.

예시

Replace an existing value
{{#af_print: {{#af_set: d | {{#af_list: a | b | c }} | 2 }} }}
  • 0: a
  • 1: b
  • 2: d
Create a new index
{{#af_print: {{#af_set: far | {{#af_object: foo=bar }} | boo }} }}
  • foo: bar
  • boo: far
Create a new subarray
{{#af_print: {{#af_set: far | {{#af_object: foo=bar }} | boo | far }} }}
  • foo: bar
  • boo
    • far: far

af_show

ArrayFunctions version
1.4

This parser function prints the given value in a human-readable format. The formatting of the value is based on format.

설명

{{#af_show: value | format=format }}

매개변수

Name Type Default Description
value mixed The value to show.
format string "simple" (1.16.0버전부터 도입됨) A comma-separated list of formats. The value will be shown using the first format supporting the type of the value.
Formats (available since version 1.16.0)
Name Supported types Description
simple string, integer, float, boolean Format the value as its string representation. This is the default format.
table array Format the value as a table.

반환 값

Returns the value in human-readable form, formatted using format.

예시

Show a value
{{#af_show: Hello World! }}
Hello World!
Show an integer
{{#af_show: {{#af_int: 42 }} | format=simple }}
42

af_slice

ArrayFunctions version
1.0

This parser function extracts a slice from the given array. Keys will be reset and reordered.

설명

{{#af_slice: array | offset | length }}

매개변수

Name Type Required? Description
array array Required The array to take a slice from.
offset integer Required The offset at which the slice starts. If non-negative, the slice will start at this given offset. If negative, the sequence will start that far from the end of the array.
length integer Optional The length of the slice. If the length is given and positive, then the slice will have that many elements in it. If the length is given and negative, then the slice will stop that many elements from the end of the array. If it is omitted, then the slice will have everything from offset up until the end of the array.

반환 값

The slice.

예시

Get the first two elements
{{#af_print: {{#af_slice: {{#af_list: a | b | c }} | 0 | 2 }} }}
  • 0: a
  • 1: b
Get the last element
{{#af_print: {{#af_slice: {{#af_list: a | b | c }} | -1 }} }}
  • 0: c

af_sort

ArrayFunctions version
1.0

This parser function sorts the given list. It does not preserve numeric keys.

설명

{{#af_sort: array | descending=descending | caseinsensitive=caseinsensitive }}

매개변수

Name Type Default Description
array array The array to sort.
descending boolean false Whether to sort the list in descending order.
caseinsensitive boolean false Whether to ignore case when sorting.

반환 값

Returns the sorted list.

예시

Sort a list in ascending order
{{#af_print: {{#af_sort: {{#af_list: b | c | a }} }} }}
  • 0: a
  • 1: b
  • 2: c
Sort a list in descending order
{{#af_print: {{#af_sort: {{#af_list: b | c | a }} | descending=true }} }}
  • 0: c
  • 1: b
  • 2: a

af_split

ArrayFunctions version
1.1

This parser function splits the given string based on a delimiter.

설명

{{#af_split: string | delimiter }}

매개변수

Name Type Default Description
string string The string to split.
delimiter string "," The delimiter to use.

반환 값

Returns the resulting list.

예시

Split a string based on commas
{{#af_print: {{#af_split: a, b, c }} }}
  • 0: a
  • 1: b
  • 2: c
Split a sentence into words
{{#af_print: {{#af_split: Lorem ipsum dolor et | \s }} }}
  • 0: Lorem
  • 1: ipsum
  • 2: dolor
  • 3: et

af_stringmap

ArrayFunctions version
1.6

This parser function applies a callback to each item of a delimited string, and returns the result as a delimited string, optionally with a different delimiter. This function is similar to Page Forms' #arraymap parser function.

설명

{{#af_stringmap: value | delimiter | value_name | callback | new_delimiter | conjunction }}

매개변수

Name Type Default Description
value string The delimited string.
delimiter string The delimiter to split value on. If the empty string is given, "," is used.
value_name string The name to give to the value in the callback.
callback string The callback to apply to each element of the array.
new_delimiter string ", " The new delimiter to insert in between the mapped items.
conjunction string null The delimiter to place between the last two items. This allows you to create a more natural summation, such as "Alice, Bob and Eve". If no value is given, the value of new_delimiter is used.

반환 값

Returns the resulting delimited string.

예시

Turn each item into a link
{{#af_stringmap: William Shakespeare, Stephen King, Mark Twain | , | x | [[{{{x}}}]] }}
William Shakespeare, Stephen King, Mark Twain
Turn a comma-separated list into a human-readable list
{{#af_stringmap: William Shakespeare, Stephen King, Mark Twain | , | x | {{{x}}} | ,\s | and }}
William Shakespeare, Stephen King and Mark Twain

af_template

ArrayFunctions version
1.0

This parser function will invoke the given template and pass the values in the given array as arguments. In case the given array is an object, the values will be passed as named arguments. Otherwise, they will be passed as numeric arguments.

설명

{{#af_template: name | data }}

매개변수

name : string
The name of the template to invoke. If no namespace is given, it is assumed the page is in the template namespace, otherwise the given namespace is used. The page must exist, must be includable and must be readable by the user, otherwise an error is given.
data : array
The data to pass to the parameters. Values with numeric indices are passed as positional arguments and values with string indices are passed as named arguments.

반환 값

The expanded template.

예시

Invoking a template with a list
{{#af_template: Echo | {{#af_list: a | b }} }}
{{Echo|a|b}}
Invoking a template with an object
{{#af_template: Echo | {{#af_object: foo=bar | boo=far }} }}
{{Echo|foo=bar|boo=far}}

af_trim

ArrayFunctions version
1.8

This parser function will trim the given characters from the beginning and the end of the given string. The order of the characters does not matter. It will stop once it hits a character that is not in characters.

설명

{{#af_trim: string | characters }}

매개변수

string : string
The string that will be trimmed.
characters : string
The characters to trim.

반환 값

The trimmed string.

예시

Trimming a string
{{#af_trim: !a! | ! }}
a
Trimming every string in a list
{{#af_print: {{#af_map: {{#af_list: !a! | !b! | !c! }} | v | {{#af_trim: {{{v}}} | ! }} }} }}
  • 0: a
  • 1: b
  • 2: c

af_unique

ArrayFunctions version
1.0

This parser function removes duplicate values from the given array. This function does not reset keys.

설명

{{#af_unique: array }}

매개변수

array : array
The array from which to remove duplicates.

반환 값

Returns the array with duplicates removed.

예시

Remove duplicates from an array
{{#af_print: {{#af_unique: {{#af_list: a | a | b | c | b }} }} }}
  • 0: a
  • 2: b
  • 3: c

af_unset

ArrayFunctions version
1.0

This parser function removes the value associated with the given index from the array and returns the result. Numeric keys are not reset after calling this function.

설명

{{#af_unset: array | *indices }}

매개변수

array : array
The array from which to remove the given key.
*indices : string
The index to remove. Multiple indices can be given to index nested arrays.

반환 값

Returns the array with the given index removed.

예시

Remove a top-level index
{{#af_print: {{#af_unset: {{#af_list: a | b | c }} | 2 }} }}
  • 0: a
  • 1: b
Remove a top-level index, keys not reset
{{#af_print: {{#af_unset: {{#af_list: a | b | c }} | 1 }} }}
  • 0: a
  • 2: c
Remove a nested index
{{#af_print: {{#af_unset: {{#af_object: foo={{#af_object: bar=quz | far=buz }} }} | foo | bar }} }}
  • foo
    • far: buz

af_zip

ArrayFunctions version
1.16

This parser functions takes one or more arrays and zips these together by key, creating an array where each key maps to an array containing all values under that key in each of the input arrays. The final array will only contain keys that were present in all of the input arrays. This means that if an input array contains a key not present in one of the other input arrays, the key will be dropped, and it will not be part of the final zipped array.

설명

{{#af_zip: array | *arrays }}

매개변수

array : array
The first array.
*arrays : array
The other arrays.

반환 값

Returns the arrays zipped together.

예시

Zip two lists of equal length
{{#af_print: {{#af_zip: {{#af_list: a | b | c }} | {{#af_list: d | e | f }} }} }}
  • 0
    • 0: a
    • 1: d
  • 1
    • 0: b
    • 1: e
  • 2
    • 0: c
    • 1: f
Zip two lists of different lengths
{{#af_print: {{#af_zip: {{#af_list: a | b }} | {{#af_list: d | e | f }} }} }}
  • 0
    • 0: a
    • 1: d
  • 1
    • 0: b
    • 1: e
Zip two objects with the same keys
{{#af_print: {{#af_zip: {{#af_object: a=a | b=b }} | {{#af_object: a=c | b=d }} }} }}
  • a
    • 0: a
    • 1: c
  • b
    • 0: b
    • 1: d
Zip two objects with different keys
{{#af_print: {{#af_zip: {{#af_object: a=a | b=b }} | {{#af_object: a=c | different=d }} }} }}
  • a
    • 0: a
    • 1: c

Scribunto

It is recommended to use LuaSandbox , because the order of arrays is not preserved when using LuaStandalone (see T349590).

This extension is particularly useful in combination with Lua, as it can be used to create the array containing data required for the presentation of the page. This array can be exported to work with ArrayFunctions:

local p = {};

function p.world()
	return mw.af.export({
		["Hello"] = "World"
	});
end

return p;

This module may then be invoked like so:

{{#af_print: {{#invoke: Hello | world }} }}
  • Hello: World

mw.af.export

ArrayFunctions version
1.0

This Lua function exports a Lua table as an ArrayFunctions array.

설명

mw.af.export( table )

매개변수

table : array
The array to export.

반환 값

Returns the table as an ArrayFunctions array.

mw.af.import

ArrayFunctions version
1.6

This Lua function imports an ArrayFunctions array as a Lua table.

설명

mw.af.import( array )

매개변수

array : array
The array to import.

반환 값

Returns the array as a Lua table.

시맨틱 미디어위키

This extension integrates with Semantic MediaWiki by adding the arrayfunctions result format. The arrayfunctions result format is used to format query results as an ArrayFunctions array. The result is almost identical to the result of Semantic Scribunto's mw.smw.ask Lua function, except numeric indices start at zero.

arrayfunctions

ArrayFunctions version
1.14

This result format formats query results as an ArrayFunctions array.

설명

{{#ask: query | format=arrayfunctions }}

반환 값

Returns the query result as an ArrayFunctions array.

예시

Simple query
{{#af_print: {{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area#km²=Size
 |mainlabel=City
 |sort=Population
 |order=descending
 |headers=plain
 |format=arrayfunctions
}} }}
  • 0
    • City: Berlin
    • Population: 3520061
    • Size: 891.85 km²
  • 1
    • City: Munich
    • Population: 1353186
    • Size: 310.43 km²
  • 2
    • City: Cologne
    • Population: 1080394
    • Size: 405.02 km²
  • 3
    • City: Frankfurt
    • Population: 679664
    • Size: 248.31 km²
  • 4
    • City: Stuttgart
    • Population: 606588
    • Size: 207.35 km²
  • 5
    • City: Würzburg
    • Population: 126635
    • Size: 87.63 km²

Cargo

This extension integrates with Cargo by adding the arrayfunctions display format. The arrayfunctions result format is used to format query results as an ArrayFunctions array.

arrayfunctions

ArrayFunctions version
1.15

This display format formats query results as an ArrayFunctions array.

설명

The no html parameter is required for ArrayFunctions to interpret the result correctly.
{{#cargo_query: parameters | no html | format=arrayfunctions }}

반환 값

Returns the query result as an ArrayFunctions array.

예시

Simple query
{{#af_print: {{#cargo_query: tables=Books
 |no html
 |fields=_pageName,Authors,Genres
 |format=arrayfunctions
}} }}
  • 0
    • _pageName: The Masque of the Red Death
    • Authors: Edgar Allan Poe
    • Genres
      • 0: Horror
      • 1: Fiction
  • 1
    • _pageName: Rita Hayworth and Shawshank Redemption
    • Authors: Stephen King
    • Genres
      • 0: Realism
      • 1: Crime
  • 2
    • _pageName: Animal Farm
    • Authors: George Orwell
    • Genres: Political satire

특수 명령

The extension defines a number of magic words (variables).

AF_EMPTY

ArrayFunctions version
1.0

This magic word returns the empty array. This is useful, because it is not possible to create an empty array with #af_list or #af_object.

설명

{{AF_EMPTY}}

반환 값

Returns the empty array.

Presentations

같이 보기

변경 기록

All notable changes to ArrayFunctions will be documented here.

The format is based on Keep a Changelog, and this extension adheres to Semantic Versioning.

v2.0.1 - 2026 6월 18

Changed

  • Make #af_stringmap able to create array with "0" as a value. Previously, "0" would be removed from the array.

v2.0.0 - 2026 1월 28

Added

  • Add the #af_filter parser function.
  • Add the // overloaded index to remove empty values.

Changed

  • BREAKING: Remove support for MediaWiki 1.39 and earlier. The oldest supported version is now MediaWiki 1.40.
  • BREAKING: In #af_pipeline, when the first argument is empty, {{{prev}}} now renders literally as {{{prev}}}. Use {{{prev|}}} to preserve the 1.x.x behavior.
  • Ignore the first argument when it is empty for #af_difference, #af_intersect, #af_merge, #af_object, #af_pipeline, and #af_zip.
  • Localisation updates courtesy of translatewiki.net.

v1.17.0 - 2025 8월 26

This version is not tagged properly on Special:Version, where it still shows as 1.16.2.

추가됨

  • Add the $wgArrayFunctionsMaxPipelineLength configuration variable to limit the total number of steps in a pipeline.
  • Add the Pages using the ArrayFunctions extension (af-tracking-category) tracking category.

변경됨

수정됨

  • Ranges that exceed $wgArrayFunctionsMaxRangeSize are now taken into account when reporting the size of the largest constructed range in the parser limit report. Previously, only ranges that did not exceed the limit would be taken into account.
  • Fix TypeError that occurred when an error was propagated from a nested parser function call.

v1.16.2 - 2025 6월 28

수정됨

  • Fix exception caused by storing a Message object in the parser's extension data (T397946).
  • Ensure errors are rendered in the page's target language instead of the user's language (T397951).

v1.16.1 - 2025 6월 19

변경됨

수정됨

  • Fix BadMethodCallException that was caused by relying on $wgLang in the ParserLimitReportPrepare hook.

v1.16.0 - 2025 6월 10

추가됨

  • Add the $wgArrayFunctionsForeachIterationLimit configuration variable to limit the total number of iterations that can be performed by #af_foreach.
  • Add the $wgArrayFunctionsMaxRangeSize configuration variable to limit the maximum number of elements that an array constructed using #af_range can contain.
  • Add the #af_zip parser function.
  • Add the ! overloaded index to show a value.
  • Add the table and simple formats for `#af_show`.
  • Add the Pages with ArrayFunctions errors (af-error-category) tracking category.
  • Add error tracking and propagation.

변경됨

  • Allow #af_show to take a format.
  • The #af_sort and #af_ksort parser functions now compare items normally instead of as strings.
  • Localisation updates courtesy of translatewiki.net.

수정됨

  • Fix exception when passing the empty string to a keyword argument.

v1.15.0 - 2025 5월 13

추가됨

  • Add the arrayfunctions Cargo display format.

변경됨

v1.14.2 - 2025 4월 15

수정됨

  • Remove properties without a value from the result when using the arrayfunctions result format with Semantic MediaWiki.

v1.14.1 - 2025 4월 15

추가됨

  • Add compatibility with Semantic MediaWiki 5.0.0.

변경됨

수정됨

  • Restore compatibility with deprecated MediaWiki 1.35.

v1.14.0 - 2025 4월 1

추가됨

  • Add the arrayfunctions Semantic MediaWiki result format.
  • Add the #af_pipeline parser function.

변경됨

  • Drop compatibility with MediaWiki 1.35.
  • Localisation updates courtesy of translatewiki.net.

수정됨

  • Fix exception when using #af_template on MediaWiki 1.44.

v1.13.0 - 2025 3월 4

변경됨

  • Replace the #af_set parser function with #af_put. The #af_set parser function remains available for backwards compatibility.
  • Localisation updates courtesy of translatewiki.net.

수정됨

  • The magic variable IDs array is now no longer treated as associative, which would previously break CodeMirror syntax highlighting. (by alex4401)

v1.12.0 - 2025 2월 4

추가됨

  • Add the #af_range parser function.

변경됨

  • Rename the #af_wildcard parser function to #af_group, and add an alias for #af_wildcard.
  • The #af_difference parser function now compares items normally instead of as strings.
  • The #af_exists parser function now accepts multiple keys to check if a nested key exists.
  • The #af_intersect parser function now compares items normally instead of as strings.
  • Localisation updates courtesy of translatewiki.net.

v1.11.0 - 2024 12월 10

추가됨

  • Add following parser functions: #af_flatten #af_wildcard #af_reverse .
  • Overload #af_get with special indices to perform certain operations on the array instead of retrieving a key.

변경됨

  • The #af_unique parser function now compares items normally instead of as strings.

v1.10.0 - 2024 11월 26

추가됨

  • Add ZLIB compression using gzdeflate and gzinflate.

변경됨

v1.9.0 - 2024 5월 2

추가됨

  • Add delimiter option to the #af_foreach parser function.

변경됨

  • All string parameters now support escape sequences.

v1.8.0 - 2024 4월 4

변경됨

  • Whitespace is now trimmed from the beginning and the end of array values to be consistent with the behaviour of other parameters in MediaWiki.
  • Localisation updates courtesy of translatewiki.net.

v1.7.0 - 2023 10월 24

추가됨

  • Add the #af_ksort parser function.
  • Add caseinsensitive option to the #af_keysort parser function.
  • Add caseinsensitive option to the #af_sort parser function.

변경됨

v1.6.0 - 2023 9월 12

추가됨

  • Add the #af_stringmap parser function.
  • Add the mw.af.import Lua function to import ArrayFunctions arrays into Lua.

변경됨

v1.5.0 - 2023 9월 7

추가됨

  • Add the #af_difference parser function.

변경됨

v1.4.4 - 2023 6월 30

변경됨

수정됨

  • Fix #af_template parser function to no longer check a user their read permissions explicitly, as regular template transclusion also does not do this. Previously, an error would be outputted.

v1.4.3 - 2023 5월 26

변경됨

  • Exporting a NULL value (e.g. through the mw.af.export Lua function) will now result in the empty string. Previously, the NULL would be returned unaltered.

v1.4.2 - 2023 5월 26

변경됨

  • The #af_template parser function now shows non-existent templates as a broken link. Previously, an error would be outputted.
  • Localisation updates courtesy of translatewiki.net.

v1.4.1 - 2023 5월 5

변경됨

  • The #af_split parser function now allows the empty string as its first parameter. Previously, an error would be outputted.
  • Localisation updates courtesy of translatewiki.net.

v1.4.0 - 2023 4월 26

추가됨

  • Add the #af_show parser function.

v1.3.0 - 2023 3월 27

추가됨

  • Add the #af_search parser function.

v1.2.0 - 2023 3월 3

추가됨

  • Add the following parser functions: #af_intersect #af_merge #af_reduce.

v1.1.0 - 2023 2월 3

추가됨

  • Add the #af_split parser function.

v1.0.1 - 2023 1월 9

변경됨

  • The mw.af.export Lua function now supports parameters of all types.

Previously, it only supported arrays.

수정됨

  • Fix issue where an exception was thrown when a parameter with an incorrect type was passed to mw.af.export.

v1.0.0 - 2023 1월 7

추가됨

  • Add the parser functions: #af_bool #af_count #af_exists #af_float #af_foreach #af_get #af_if #af_int #af_isarray #af_join #af_keysort #af_list #af_map #af_object #af_print #af_push #af_set #af_slice #af_sort #af_template #af_unique #af_unset