Help:ParserPower/List handling functions

Manipulating lists
The most powerful feature of ParserPower is its ability to manipulate lists separated by a common delimiter. While this is a useful feature in general, this makes ParserPower a great companion to extensions such as Semantic MediaWiki.

The primary advantage gained is in being able to code templates to handle parameters that can take an arbitrary number of values.

Multiple value template parameters without ParserPower
With MediaWiki alone, or even with its packaged extensions, one is left with two choices when you need to send a list to a parameter.

The first is that you leave it to the template caller to properly format and code the list, such as say: list=item1&lt;br /&gt; item2&lt;br /&gt; item3&lt;br /&gt; item4&lt;br /&gt; which is troublesome if you want to do something nontrivial with each value, such as categorize the page according to each one. By this method, you have to leave it to the template user to do the categorization.

The second is to provide a number of parameters for the same thing, such as: item1=item1 item2=item2 item3=item3 item4=item4 but first, you can accept only as many values as you provide parameters for, and you have to handle each parameter separately even if you want to do the same thing with each of them. This means you copy-paste code for each parameter or write another template, and even with a separate template, you still have to write a template call for each parameter.

ParserPower's alternative for multiple value template parameters
ParserPower's list handling functions provide a more user-friendly option for both the users of your template and yourself. By using appropriate ParserPower functions in your template, the users of your template could do something like this instead: list=item1,item2,item3,item4 and with one call to,  , or  , you can easily turn each into a link, categorize according to their values, and turn the commas into line breaks. In many cases, a separate template isn't needed either; most simple cases can be handled without it.

Note on lists, input separators, and escape sequences
Most of these functions accept a list and an input separator that separates the item. ParserPower escape sequences are recognized in the list, but only after it has been separated into individual items. This means if you use an escape sequence as a separator, you have to add a extra backslash to the beginning of the input separator parameter because the escape sequences there are processed before the split.

Example: won't work as expected! It gives you  instead of.

will be replaced with  in the input separator, but it will try to split the list before   is replaced in the list itself. It will try to find  in the list, and it won't see the   as   yet.

is correct. It gives you, as expected.

in the input separator parameter will be replaced with, and when splitting the list, it will split it by the   sequences that haven't yet been replaced.

If you can avoid it, it is probably best not to use an escape sequence as the separator for your list. There is no harm is using the characters the escape sequences represent, though. For example: will give you  as expected.

(Added in 0.95). This simple list handling function counts the number of items within the given list using the given separator. Empty values are not counted.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

This simple list handling function exchanges the input separator in the given list with the new output separator. It is similar to the  function from ParserFunctions or StringFunctions in that respect, but it also trims leading and trailing whitespace from each item in the list and discards empty values.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

This function returns only the item identified by the given index, or nothing if the index refers to an item not in the list. The index can be specified as a positive or negative number. refers to the top nonempty item in the list,  to the second, and so on. refers to the bottom nonempty item in the list,  to the second nonempty item from the bottom, and so on.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

This function returns the part of the list, where items are delimited by, identified by the given start index and length. If the range defined by the start index and length is entirely outside the item, nothing is returned. If it includes items beyond the list, only the items that actually exist within the range are returned.

The start index can be specified as a positive or negative number. refers to the top nonempty item in the list,  to the second, and so on. refers to the bottom nonempty item in the list,  to the second nonempty item from the bottom, and so on. is assumed if no value is given.

The length can also be given as a positive or negative number. When given as a positive number, the function simply returns that many nonempty items from the start index on if there are sufficient nonempty items in the list. Otherwise, it will returns all items from the start index to the end of the list. If length is given as a negative number, it will omit returning items from the end of the list. will omit the last nonempty in the list,  will omit the last two, and so on. If length isn't specified at all, then all nonempty items from start index to the end of the list will be returned.

The partial list will be returned with the items delimited by the given.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

(Added in 0.95). This function searches the list for the given item, and if it finds it, it returns the first occurrence. Otherwise, it returns nothing. For case sensitivity in the search, specify  as the case sensitivity option; this will mean a search for   will match only , not   or. Specify  for a case-insensitive search, or omit it, as   is the default mode.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

(Added in 1.0). This function searches the list for the given item, and if it finds it, it returns the index. Otherwise, it returns nothing.

To search the list from the end to the beginning, specify  in the options; otherwise, specify   or omit it to search from the beginning to the end.

If  is specified in the options, a negative index will be returned. In this case,  would refer to the bottom nonempty value in the list,   to the first nonempty value above that, and so on. Otherwise, specify  or omit it to have a positive index returned instead. For positive indexes,  refers to the topmost nonempty item in the list,   to the second nonempty item, and so on.

For case sensitivity in the search, specify  in the options; this will mean a search for   will match only , not   or. Specify  for a case-insensitive search, or omit it, as   is the default mode.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

(Added in 0.95.) This simple list handling function adds a single item to the end of a list with the given separator. Note that as with, leading and trailing whitespace are trimmed from each value in the list and empty values are discarded.

If an empty  is specified, the   is output with leading and trailing whitespace trimmed. If an empty  is specified, the   is output with leading and trailing whitespace trimmed from each item.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

(Added in 0.95.) This simple list handling function adds a single item to the beginning of a list with the given separator. Note that as with, leading and trailing whitespace are trimmed from each value in the list and empty values are discarded.

If an empty  is specified, the   is output with leading and trailing whitespace trimmed. If an empty  is specified, the   is output with leading and trailing whitespace trimmed from each item.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

(Added in 0.95.) This simple list handling function combines two lists together and can work with lists having different separators. Note that as with, leading and trailing whitespace are trimmed from each value in each list and empty values are discarded.

The lists are combined with the output separator, and if they are different, the separators within each list are also replaced with the output separator. Either list value can be empty, in which case the other list will be output with the new output separator. If both lists are empty, nothing will be output.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

(Added in 0.95). This list handling function takes a given list and returns a new list containing only the values that match given criteria for items to keep, or alternately, which do not match given criteria for items to remove.

Each parameter is explained below:
 * This is where the list to process goes. It's okay to put an empty list here, but the function simply outputs nothing in this case. Escape sequences are recognized after the list is split into individual items.
 * This is where the list to process goes. It's okay to put an empty list here, but the function simply outputs nothing in this case. Escape sequences are recognized after the list is split into individual items.


 * This identifies the character sequence used to separate the items in . Escape sequences are recognized.
 * This identifies the character sequence used to separate the items in . Escape sequences are recognized.


 * This is the character sequence that should separate the items after the list is processed. Escape sequences are recognized.
 * This is the character sequence that should separate the items after the list is processed. Escape sequences are recognized.


 * One basic way to specify criteria is simply to specify the exact value or values to keep. Note that this is case insensitive by default, but this can be changed by using . Note that if you use , the parameters  ,   and   will be ignored.
 * One basic way to specify criteria is simply to specify the exact value or values to keep. Note that this is case insensitive by default, but this can be changed by using . Note that if you use , the parameters  ,   and   will be ignored.


 * This is the character used to separate the values to keep in . By default, this is a comma.
 * This is the character used to separate the values to keep in . By default, this is a comma.


 * Setting this to  will make the process case-sensitive for , so that if   is in  ,   would be removed from the list. By default, this is.
 * Setting this to  will make the process case-sensitive for , so that if   is in  ,   would be removed from the list. By default, this is.


 * Another basic way to specify criteria is simply to specify the exact value or values to remove. Note that this is case insensitive by default, but this can be changed by using . Note that if you use , the parameters   and   will be ignored.
 * Another basic way to specify criteria is simply to specify the exact value or values to remove. Note that this is case insensitive by default, but this can be changed by using . Note that if you use , the parameters   and   will be ignored.


 * This is the character used to separate the values to remove in . By default, this is a comma.
 * This is the character used to separate the values to remove in . By default, this is a comma.


 * Setting this to  will make the process case-sensitive for , so that if   is in  ,   would not be removed from the list. By default, this is.
 * Setting this to  will make the process case-sensitive for , so that if   is in  ,   would not be removed from the list. By default, this is.


 * and
 * These parameters allow you to specify some wikicode to run on each item in the list that returns either  or  . For each item in the list, the token in   is replaced with the value and the wikicode is processed. Any time that   is returned, the list item will be removed from the list. This is case insensitive, so   will also remove the item. So for a   of   and a pattern of , a list value of   returns   and will not be in the returned list, but   returns   and will remain part of the list.


 * and
 * These, combined with  and , are used to provide more flexibility in testing values.   identifies a character sequence to use in separating each list item into fields.  , which is a comma by default, lets you specify a token for each field. So, for a   of  . With   of  ,   of   and a   of  ,   will return   and be returned in the list, but   will return   and be removed from the list.


 * (Added in 1.0.) When combined with  and , this specifies a token that will be replaced with a numeric index in each list value as it's processed. The indexes start counting at 1.
 * (Added in 1.0.) When combined with  and , this specifies a token that will be replaced with a numeric index in each list value as it's processed. The indexes start counting at 1.


 * and
 * A more advanced way to test values is to pass each value to a template. You simply give the name of a template to, and each value is passed through as parameter  . The exception is if you specify  . In this case, the value is separated into fields and the first field is passed through to parameter  , the second to parameter  , and so on. Note that if you specify  ,  ,  , and   are ignored. As with using   and  , the item will be removed only if the template returns   for the item in question. Note that if   is specified,  ,  , and   will be ignored.

(Added in 1.0.) This defines a optional token that will be replaced with the numeric count of items returned where it is found in  and   below. It is not used if neither of those parameters are specified. It can be left blank or omitted.


 * and
 * takes content to output before any items in the list.  takes content to output after any items in the list. Using these is different from just placing content before and after the   call, however, because the   and   are suppressed if the list is empty either before or after filtering. This is useful for avoiding embedding   calls awkwardly in   calls in many situations.


 * takes content to output should the list be empty, either before or after filtering. This is useful for avoiding embedding list function calls awkwardly in  calls in many situations, or for doing the same in the   parameter itself.
 * takes content to output should the list be empty, either before or after filtering. This is useful for avoiding embedding list function calls awkwardly in  calls in many situations, or for doing the same in the   parameter itself.

(Added in 0.95). This is a shortcut version of  that returns the given list with only the specified items. If the items in question are in the list multiple times, each instance is returned. The case sensitivity option can be either  for case sensitive or   for case-insensitive. is the default option.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

(Added in 0.95). This is a shortcut version of  that returns the given list with the specified item removed. If the item in question is in the list multiple times, each instance is removed. The case sensitivity option can be either  for case sensitive or   for case-insensitive. is the default option.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

(Added in 0.95). This simple list handling function counts the number of unique items within the given list using the given separator. Empty values are not counted. The case sensitivity option can be either  for case sensitive or   for case-insensitive. is the default option.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

This powerful function allows you to reduce a list down to unique values, either by straightforward uniqueness of the actual values, or uniqueness of a key generated by a template or provided wikicode.

Each parameter is explained below:
 * This is where the list to reduce goes. It's okay to put an empty list here, but the function simply outputs nothing in this case. Escape sequences are recognized after the list is split into individual items.
 * This is where the list to reduce goes. It's okay to put an empty list here, but the function simply outputs nothing in this case. Escape sequences are recognized after the list is split into individual items.


 * This identifies the character sequence used to separate the items in . Escape sequences are recognized.
 * This identifies the character sequence used to separate the items in . Escape sequences are recognized.


 * This is the character sequence that should separate the items after the list is sorted. Escape sequences are recognized.
 * This is the character sequence that should separate the items after the list is sorted. Escape sequences are recognized.


 * Setting this to  will make the uniqueness comparisons case-sensitive. By default, this is  . Note this is only relevant when no   or no   and   are used, because in those cases, the generated keys are compared, and that is always done in a case-sensitive manner.
 * Setting this to  will make the uniqueness comparisons case-sensitive. By default, this is  . Note this is only relevant when no   or no   and   are used, because in those cases, the generated keys are compared, and that is always done in a case-sensitive manner.


 * and
 * These are used to generate a key for each value, and only the first value to generate a given key is kept in the list. When  is found in , it is replaced by the value to generate the key. So if you provide a   of   and a   of  , then with values  ,   and  , you'd get keys of  ,  , and  , so only   and   would be returned in the new list. As another example, a pattern of   with a token of   would give you the first letter as a key, which would be a way to reduce values to the first one starting with a particular letter.


 * and
 * These, combined with  and , are used to provide more flexibility in generating keys.   identifies a character sequence to use in separating each list item into fields.  , which is a comma by default, lets you specify a token for each field. So, for a   of  . With   of  ,   of   and a   of  , the keys become  ,   and  . As   was the first to generate the   key, her name will be returned in the output list, but   will not because the   key was already generated.   only needs to be specified if you use something other than a comma to separate the tokens in  . (Note: this example only works when everyone has only two names.)


 * (Added in 1.0.) When combined with  and , this specifies a token that will be replaced with a numeric index in each list value as it's processed. The indexes start counting at 1.
 * (Added in 1.0.) When combined with  and , this specifies a token that will be replaced with a numeric index in each list value as it's processed. The indexes start counting at 1.


 * and
 * A more advanced way to generate keys is to pass each value to a template. You simply give the name of a template to, and each value is passed through as parameter  . The exception is if you specify  . In this case, the value is separated into fields and the first field is passed through to parameter  , the second to parameter  , and so on. Note that if you specify  ,  ,  , and   are ignored.

(Added in 1.0.) This defines a optional token that will be replaced with the numeric count of items returned where it is found in  and   below. It is not used if neither of those parameters are specified. It can be left blank or omitted.


 * and
 * takes content to output before any items in the list.  takes content to output after any items in the list. Using these is different from just placing content before and after the   call, however, because the   and   are suppressed for empty lists. This is useful for avoiding embedding list functtion calls awkwardly in   calls in many situations.


 * takes content to output should the given list be empty. This is useful for avoiding embedding list function calls awkwardly in  calls in many situations, or for doing the same in the   parameter itself.
 * takes content to output should the given list be empty. This is useful for avoiding embedding list function calls awkwardly in  calls in many situations, or for doing the same in the   parameter itself.

(Functionality changed in 0.95).This does the same as  above, but it also removes duplicate items from the list. The case sensitivity option can be either  for case sensitive or   for case-insensitive. is the default option.

Each parameter recognizes ParserPower escape sequences, though as noted above, escape sequences are processed in the list after it is split into individual items.

''Version note: In 0.9,  did not have a case sensitivity option. It functioned in a case-sensitive manner without an alternative option, different from the default in later versions.''

This powerful and complex function allows you to sort a list in a variety of ways. You only have to provide the parameters you need, so it works for both simple and complex sorts, though the  shortcut function may be preferable for simple sorts.

Each parameter is explained below:
 * This is where the list to sort goes. It's okay to put an empty list here, but the function simply outputs nothing in this case. Escape sequences are recognized after the list is split into individual items.
 * This is where the list to sort goes. It's okay to put an empty list here, but the function simply outputs nothing in this case. Escape sequences are recognized after the list is split into individual items.


 * This identifies the character sequence used to separate the items in . Escape sequences are recognized.
 * This identifies the character sequence used to separate the items in . Escape sequences are recognized.


 * This is the character sequence that should separate the items after the list is sorted. Escape sequences are recognized.
 * This is the character sequence that should separate the items after the list is sorted. Escape sequences are recognized.


 * One or more of the following keywords:
 * : sort the values alphanumerically. This is default and the option to use when the list is made up of words.
 * : sort the values numerically. This is the option to use when the list is made up of numbers.
 * : short for not case sensitive, meaning that uppercase and lowercase letters are treated as the same. "alpha" will be placed before "BETA" in such a sort. This is default and only relevant to  sorts. This is ignored in   sorts.
 * : short for case sensitive, meaning that uppercase and lowercase letters are treated differently. "BETA" will be placed before "alpha" in such a sort. This only relevant to  sorts. This is ignored in   sorts.
 * : sorts in ascending order. For  sorts, this means in alphabetical order. For   sorts, this means from smallest to largest.
 * : sorts in descending order. For  sorts, this means in reverse alphabetical order. For   sorts, this means from largest to smallest.
 * Note that if  and   or   are provided, these sort options apply to the sort keys generated, not to the values themselves.
 * Note that if  and   or   are provided, these sort options apply to the sort keys generated, not to the values themselves.


 * Either  to keep all duplicates in the list or   to remove duplicates.   is the default option.
 * Either  to keep all duplicates in the list or   to remove duplicates.   is the default option.


 * and
 * These are used to generate a sort key to sort the values by instead of just sorting the values themselves. When  is found in , it is replaced by the value to generate the sort key. So if you provide a   of   and a   of  , then with values  ,  , and  , you'd get sort keys of  ,  , and  , which would be useful for sorting page names by their namespace.


 * (Added in 1.0.) When combined with  and , this specifies a token that will be replaced with a numeric index in each list value as it's processed. The indexes start counting at 1.
 * (Added in 1.0.) When combined with  and , this specifies a token that will be replaced with a numeric index in each list value as it's processed. The indexes start counting at 1.


 * and
 * These, combined with  and , are used to provide more flexibility in generating sort keys.   identifies a character sequence to use in separating each list item into fields.  , which is a comma by default, lets you specify a token for each field. So, for a   of  . With   of  ,   of   and a   of  , the sort keys become   and  , which would sort them in last name order.   only needs to be specified if you use something other than a comma to separate the tokens in  . (Note: this example only works when everyone has only two names.)


 * and
 * A more advanced way to generate sort keys is to pass each value to a template. You simply give the name of a template to, and each value is passed through as parameter  . The exception is if you specify  . In this case, the value is separated into fields and the first field is passed through to parameter  , the second to parameter  , and so on. Note that if you specify  ,  ,  , and   are ignored.


 * and
 * accepts either  or  . If , this indicates that any values with the same sort key should be sorted according to the options in   (or the defaults if none are provided). The available   are the same as for.

(Added in 1.0.) This defines a optional token that will be replaced with the numeric count of items returned where it is found in  and   below. It is not used if neither of those parameters are specified. It can be left blank or omitted.


 * and
 * (Added in 0.95.)  takes content to output before any items in the list.   takes content to output after any items in the list. Using these is different from just placing content before and after the   call, however, because the   and   are suppressed for empty lists. This is useful for avoiding embedding list function calls awkwardly in   calls in many situations.


 * (Added in 0.95.)  takes content to output should the given list be empty. This is useful for avoiding embedding   calls awkwardly in   calls in many situations, or for doing the same in the   parameter itself.
 * (Added in 0.95.)  takes content to output should the given list be empty. This is useful for avoiding embedding   calls awkwardly in   calls in many situations, or for doing the same in the   parameter itself.

This is a shortcut version of  for when sort keys are not needed. The sort options are the same as for  above.

This is the most powerful list handling function in ParserPower. It not only allows one to sort values in the list, but change them in some way. For example, one might add linking brackets to each value, or use each value to add the page to a given category, or more. Unlike, however, it does not have the ability to generate sort keys and sort by those; it can do only simple alphabetical and numerical sorts.

Each parameter is explained below:
 * This is where the list to process goes. It's okay to put an empty list here, but the function simply outputs nothing or the value of  in this case. Escape sequences are recognized after the list is split into individual items.
 * This is where the list to process goes. It's okay to put an empty list here, but the function simply outputs nothing or the value of  in this case. Escape sequences are recognized after the list is split into individual items.


 * This identifies the character sequence used to separate the items in . Escape sequences are recognized.
 * This identifies the character sequence used to separate the items in . Escape sequences are recognized.


 * This is the character sequence that should separate the items after the list is sorted. Escape sequences are recognized.
 * This is the character sequence that should separate the items after the list is sorted. Escape sequences are recognized.


 * and
 * The most basic way to change each value in the list is provide a  and a   that contains that token. For each item in the list, the token in   is replaced with the value and the result is returned. So for a   of   and a pattern of , list values of   and   become   and.


 * and
 * These, combined with  and , are used to provide more flexibility in changing values.   identifies a character sequence to use in separating each list item into fields.  , which is a comma by default, lets you specify a token for each field. So, for a   of  . With   of  ,   of   and a   of  , the values become   and  .   only needs to be specified if you use something other than a comma to separate the tokens in  . (Note: this example only works when everyone has only two names.)


 * (Added in 1.0.) When combined with  and , this specifies a token that will be replaced with a numeric index in each list value as it's processed. The indexes start counting at 1.
 * (Added in 1.0.) When combined with  and , this specifies a token that will be replaced with a numeric index in each list value as it's processed. The indexes start counting at 1.


 * and
 * A more advanced way to change values is to pass each value to a template. You simply give the name of a template to, and each value is passed through as parameter  . The exception is if you specify  . In this case, the value is separated into fields and the first field is passed through to parameter  , the second to parameter  , and so on. Note that if you specify  ,  ,  , and   are ignored.


 * (Changed in 0.95.) One of the following keywords:
 * : returns the values in the order they were passed in. This is default.
 * : sorts the values before changing them. Depending on the changes, this might mean the final values aren't sorted in alphabetical or numerical order, but it may sometimes make more sense to sort by the original values. Also, if the changes won't affect the order, presorting may be a little more efficient.
 * or : sorts the values after changing them. If the changes will affect the sorting order, this is probably the most desirable option.
 * : sorts the values before and after changing them. There may be some unusual circumstances, such as processing that uses a variable to store the previous value, where this just might be desirable, but in most cases this option is not recommended.
 * When in doubt, if you want sorting, one is least likely to go wrong with.
 * Before 0.95,  sorted values both before and after the change, and   was not recognized. As it is rare for sorting before and after to be desirable, it was decided that   should apply to the option that will usually be the preferred option.
 * Before 0.95,  sorted values both before and after the change, and   was not recognized. As it is rare for sorting before and after to be desirable, it was decided that   should apply to the option that will usually be the preferred option.


 * One or more of the following keywords:
 * : sort the values alphanumerically. This is default and the option to use when the list is made up of words.
 * : sort the values numerically. This is the option to use when the list is made up of numbers.
 * : short for not case sensitive, meaning that uppercase and lowercase letters are treated as the same. "alpha" will be placed before "BETA" in such a sort. This is default and only relevant to  sorts. This is ignored in   sorts.
 * : short for case sensitive, meaning that uppercase and lowercase letters are treated differently. "BETA" will be placed before "alpha" in such a sort. This only relevant to  sorts. This is ignored in   sorts.
 * : sorts in ascending order. For  sorts, this means in alphabetical order. For   sorts, this means from smallest to largest.
 * : sorts in descending order. For  sorts, this means in reverse alphabetical order. For   sorts, this means from largest to smallest.
 * Naturally, these are ignored if  is set to   or isn't set at all.
 * Naturally, these are ignored if  is set to   or isn't set at all.


 * (Changed in 0.95.) One of the following keywords:
 * : keeps duplicate values in the list.
 * : removes duplicate values before the values are changed. This is useful if you want to keep any duplicate values than occur after the items are changed. Alternatively, if the changes are such that the values will still be unique after changing, prestripping is more efficient.
 * or : removes duplicate values after the values are changed. If you don't want any duplicates in the output and your changes might cause some different input values to become the same, you'll need to poststrip.
 * : removes duplicate values both before and after the values are changed. In some cases, this may avoid redundant changes in the processing stage and may be more efficient overall, especially if the changes are nontrivial. In most cases, this will have the same result at, but will do it faster in some cases and slower in others.
 * When in doubt, it's probably best to just choose  if you want unique values at the end.
 * Before 0.95,  removed duplicate values before and after the change, and   was not recognized. As it is rare for removal before and after to be desirable, it was decided that   should apply to the option that will usually be the preferred option.
 * Before 0.95,  removed duplicate values before and after the change, and   was not recognized. As it is rare for removal before and after to be desirable, it was decided that   should apply to the option that will usually be the preferred option.

(Added in 1.0.) This defines a optional token that will be replaced with the numeric count of items returned where it is found in  and   below. It is not used if neither of those parameters are specified. It can be left blank or omitted.


 * and
 * (Added in 0.95.)  takes content to output before any items in the list.   takes content to output after any items in the list. Using these is different from just placing content before and after the   call, however, because the   and   are suppressed for empty lists, whether it is empty before or after processing. This is useful for avoiding embedding list function calls awkwardly in   calls in many situations.


 * (Added in 0.95.)  takes content to output should the given list be empty or should it be empty after processing. This is useful for avoiding embedding   calls awkwardly in   calls in many situations, or for doing the same in the   parameter itself.
 * (Added in 0.95.)  takes content to output should the given list be empty or should it be empty after processing. This is useful for avoiding embedding   calls awkwardly in   calls in many situations, or for doing the same in the   parameter itself.

This is a shortcut version of  that allows you to change values with a simple single token pattern as with the   and   parameters of. It doesn't allow you to use a template to change values, nor does it allow the use of a field separator. To be accurate, it simply ignores any field separator in the values. You can also use the sorting options of, but you can't strip duplicates.

This is a shortcut version of  that allows you to change values with a template as with the   parameter of. It doesn't allow you to use a token and pattern to change values, nor does it allow the use of a field separator. To be accurate, it simply ignores any field separator in the values. You can also use the sorting options of, but you can't strip duplicates.

This function is used to compare all items in a list to each other, one pair at a time, and merge those that are common in some way according to the specified logic. The function automatically runs additional passes over all items until the list is either reduced to a single item, or it makes it through a complete pass without the number of items in the list getting any smaller.

It can also sort the list values both before and after such merging. Unlike, however, it does not have the ability to generate sort keys and sort by those; it can do only simple alphabetical and numerical sorts.

Each parameter is explained below:
 * This is where the list to process goes. It's okay to put an empty list here, but the function simply outputs nothing or the value of  in this case. Escape sequences are recognized after the list is split into individual items.
 * This is where the list to process goes. It's okay to put an empty list here, but the function simply outputs nothing or the value of  in this case. Escape sequences are recognized after the list is split into individual items.


 * This identifies the character sequence used to separate the items in . Escape sequences are recognized.
 * This identifies the character sequence used to separate the items in . Escape sequences are recognized.


 * This is the character sequence that should separate the items after the list is sorted. Escape sequences are recognized.
 * This is the character sequence that should separate the items after the list is sorted. Escape sequences are recognized.


 * ,,   and
 * These parameters are one way to specify the logic that determines what pairings should be merged and how that merging is handled. This is done by specifying character sequences that will represent each item in  and , which must be different for this function to work correctly. These sequences are then included in wikicode in   and  . As each pair of values is processed, the   and   sequences in   are replaced by the first and second values in the pair, respectively. The wikicode is then processed, and if it resolves to  , the pair of items will then be merged. This is done by using  , which functions largely the same way: the token sequences are replaced and the wikicode is processed to get the new value.


 * and
 * These, combined with,  ,   and  , increase the flexibility of using patterns to find matches and merge like items. The character sequence specified in   is used to separate each value in the pair into fields, and   is used to specify a character that separates the tokens representing each field.   is a comma by default. Again, every token must be different; a token used in   cannot be reused in   for the function to operate correctly.


 * ,, and
 * Another way to specify the logic for matching and merging pairs of values is through templates. When using this approach, each pair is processed by calling the template in  with the first value of the pair passed as the first parameter and the second value as the second. If the template returns , the   is called, again with the first value passed as the first parameter and the second value as the second. The result of that template call becomes the merged value. This behavior changes if   is specified, as this causes each value to be separated into fields by that character. For each template, each field of the first value is passed in in order, then the fields of the second. For example, if a given   results in each value being divided into two fields, parameters   and   get the fields from the first value and parameters   and   get the fields from the second value.


 * One of the following keywords:
 * : returns the values in the order they were passed in. This is default.
 * : sorts the values before changing them. Depending on the changes, this might mean the final values aren't sorted in alphabetical or numerical order, but it may sometimes make more sense to sort by the original values. Also, if the changes won't affect the order, presorting may be a little more efficient.
 * or : sorts the values after changing them. If the changes will affect the sorting order, this is probably the most desirable option.
 * : sorts the values before and after changing them. There may be some unusual circumstances, such as processing that uses a variable to store the previous value, where this just might be desirable, but in most cases this option is not recommended.
 * When in doubt, if you want sorting, one is least likely to go wrong with.
 * When in doubt, if you want sorting, one is least likely to go wrong with.


 * One or more of the following keywords:
 * : sort the values alphanumerically. This is default and the option to use when the list is made up of words.
 * : sort the values numerically. This is the option to use when the list is made up of numbers.
 * : short for not case sensitive, meaning that uppercase and lowercase letters are treated as the same. "alpha" will be placed before "BETA" in such a sort. This is default and only relevant to  sorts. This is ignored in   sorts.
 * : short for case sensitive, meaning that uppercase and lowercase letters are treated differently. "BETA" will be placed before "alpha" in such a sort. This only relevant to  sorts. This is ignored in   sorts.
 * : sorts in ascending order. For  sorts, this means in alphabetical order. For   sorts, this means from smallest to largest.
 * : sorts in descending order. For  sorts, this means in reverse alphabetical order. For   sorts, this means from largest to smallest.
 * Naturally, these are ignored if  is set to   or isn't set at all.
 * Naturally, these are ignored if  is set to   or isn't set at all.


 * One of the following keywords:
 * : keeps duplicate values in the list.
 * : removes duplicate values before the values are changed. This is useful if you want to keep any duplicate values than occur after the items are changed. Alternatively, if the changes are such that the values will still be unique after changing, prestripping is more efficient.
 * or : removes duplicate values after the values are changed. If you don't want any duplicates in the output and your changes might cause some different input values to become the same, you'll need to poststrip.
 * : removes duplicate values both before and after the values are changed. In some cases, this may avoid redundant changes in the processing stage and may be more efficient overall, especially if the changes are nontrivial. In most cases, this will have the same result at, but will do it faster in some cases and slower in others.
 * When in doubt, it's probably best to just choose  if you want unique values at the end.
 * When in doubt, it's probably best to just choose  if you want unique values at the end.

(Added in 1.0.) This defines a optional token that will be replaced with the numeric count of items returned where it is found in  and   below. It is not used if neither of those parameters are specified. It can be left blank or omitted.


 * and
 * takes content to output before any items in the list.  takes content to output after any items in the list. Using these is different from just placing content before and after the   call, however, because the   and   are suppressed for empty lists, whether it is empty before or after the merge. This is useful for avoiding embedding   calls awkwardly in   calls in many situations.


 * takes content to output should the given list be empty or if the merging process results in an empty list. This is useful for avoiding embedding  calls awkwardly in   calls in many situations, or for doing the same in the   parameter itself.
 * takes content to output should the given list be empty or if the merging process results in an empty list. This is useful for avoiding embedding  calls awkwardly in   calls in many situations, or for doing the same in the   parameter itself.