Module:ParseList/doc
This is the documentation page for Module:ParseList
Doc page: Module:ParseList/doc
This module allows you to process a list of values (separated by a comma by default) and display them in a variety of useful formats.
{{#invoke:ParseList|main|Fighter, Cleric, Wizard}}
Becomes:
- Fighter, Cleric, and Wizard
Parameters
The first parameter is the list to be processed. The remaining parameters are optional:
parameter | default | meaning |
---|---|---|
type |
sentence
|
The desired output format, see below for possibilities. |
delimiter |
,
|
The character that should serve as a delimiter of the list. This can actually be a string of multiple characters which will all work as a delimiter, but that usage is discouraged as it may cause confusion. |
makeLinks |
(empty) | If provided and not blank, means that each element will be made into a link. |
makePlural |
(empty) | If provided and not blank, means that each element will be turned into a plural word. This happens after turning them into links, so e.g. the word "Apple" would become [[Apple|Apples]] .
|
makeSingular |
(empty) | If provided and not blank, means that each element will be turned into singular. This happens after turning them into links, so e.g. the word "Apples" would become [[Apples|Apple]] .
|
joinWord |
and
|
If type is sentence , this defines whether to use "and" or "or" (or any other word) for the last two elements of the list. E.g., the default would be to turn "X, Y" into "X and Y" and "X, Y, Z" into "X, Y, and Z", but by providing joinWord = or you can make these become "X or Y" and "X, Y, or Z" respectively.
|
The automatic plural/singular transforms are able to recognize certain irregular plurals and handle them correctly, such as "thieves" and "quarterstaves." This is handled partly through a table of explicit special conversions like staff -> staves
, and partly through logical rules like ...f --> ...ves
. If you find a word that produces a wrong result, it should be added to the table of explicit conversions.
Output types
The value of the type
parameter can be the following:
value | example output |
---|---|
sentence
|
Fighter, Cleric, and Wizard |
htmlList
|
|
simpleList
|
Fighter, Cleric, Wizard |
Examples
Make Links
{{#invoke: ParseList | main | Fighter, Cleric, Wizard | makeLinks = yes }}
Result:
Make plural
{{#invoke: ParseList | main | Fighter, Cleric, Wizard | makePlural = yes }}
Result:
- Fighters, Clerics, and Wizards
Make Plural Links
{{#invoke: ParseList | main | Fighter, Cleric, Wizard | makeLinks = yes | makePlural = yes }}
Result:
Make Plural Links, end with "or"
{{#invoke: ParseList | main | Fighter, Cleric, Wizard | makeLinks = yes | makePlural = yes | joinWord = or }}
Result:
Make Plural Links, turn into HTML list
{{#invoke: ParseList | main | Fighter, Cleric, Wizard | makeLinks = yes | makePlural = yes | type = htmlList }}
Result: