This is the documentation page for Module:DisplayFunctions
This is a documentation subpage for Module:DisplayFunctions. It contains usage information, categories and other content that is not part of the original module page. |
This module depends on the following other modules: |
This module contains several display helper functions for the Module:InfoboxBuilder.
Functions
image
InfoboxBuilderDisplayFunctions.image(imageSize)
Pass the desired image size as a parameter when setting it as the display function for a row. When called, this function will return a function that uses the first parameter as the filename.
link
InfoboxBuilderDisplayFunction.link
When called, this function will use the first parameter as the link.
list
InfoboxBuilderDisplayFunctions.list(listType)
Pass the desired type of list as a parameter when setting it as the display function for a row. When called, this function will return a function that turns an array into a list.
Valid list types are:
- bulleted
- unbulleted
- horizontal
- ordered
- horizontal_ordered
Examples of these lists can be found on Wikipedia's documentation for Module:List.
trueFalseOther
InfoboxBuilderDisplayFunctions.trueFalseOther(trueVal, falseVal, otherVal)
Pass the true value, false value, and value if other as parameters when setting it as the display function for a row. When called, this function will return a function that takes a boolean value and returns the corresponding true, false, or other value.
yesAndNo
InfoboxBuilderDisplayFunctions.yesAndNo
When called, this function will display "Yes" for true
, "No" for false
, and nil
for everything else. This is a special case of trueFalseOther(trueVal, falseVal, otherVal)
.
checkAndX
InfoboxBuilderDisplayFunctions.checkAndX
When called, this function will display "✓" for true
, "✗" for false
, and nil
for everything else. This is a special case of trueFalseOther(trueVal, falseVal, otherVal)
.
pluralHeader
InfoboxBuilderDisplayFunctions.pluralHeader(forms)
Pass in a table of grammatical forms (see MediaWiki's documentation on the correct format) as the parameter when setting it as the display function for a row. When called, this function will return a function that selects the correct plurality based on the array passed in as parameter.