(Created page with "local Functions = {} function Functions.bulletedList(array) end function Functions.unbulletedList(array) end function Functions.orderedList(array) end function Functions.unorderedList(array) end function Functions.horizontalList(array) local List = require('Module:List') local data = List.makeListData('horizontal', array) return List.renderList(data) end return Functions") |
No edit summary |
||
Line 1: | Line 1: | ||
local Functions = {} |
local Functions = {} |
||
function Functions. |
function Functions.formatToLink(pageName, linkName) |
||
if pageName == nil or pageName == '' then return nil end |
|||
⚫ | |||
return string.format('[[%s|%s]]', pageName or linkName, linkName) |
|||
end |
end |
||
function Functions. |
function Functions.formatToList(listType) |
||
return function(array) |
|||
end |
|||
⚫ | |||
function Functions.orderedList(array) |
|||
⚫ | |||
end |
|||
⚫ | |||
function Functions.unorderedList(array) |
|||
end |
end |
||
function Functions.horizontalList(array) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
end |
||
Revision as of 03:02, 7 August 2022
This module depends on the following other modules: |
This module contains several display helper functions for the Module:InfoboxBuilder and Module:DatatableBuilder. The only dependency this module has is Module:List; this is required to use list(listType)
and is only loaded when needed.
Functions
image
DisplayFunctions.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
DisplayFunctions.link
When called, this function will use the first parameter as the link.
list
DisplayFunctions.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
DisplayFunctions.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
DisplayFunctions.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
DisplayFunctions.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
DisplayFunctions.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.
minutesAndSeconds
DisplayFunctions.minutesAndSeconds
When called, this function will format a number (assumed to be seconds) into the "m:ss" format.
local Functions = {}
function Functions.formatToLink(pageName, linkName)
if pageName == nil or pageName == '' then return nil end
return string.format('[[%s|%s]]', pageName or linkName, linkName)
end
function Functions.formatToList(listType)
return function(array)
local List = require('Module:List')
local data = List.makeListData(listType, array)
return List.renderList(data)
end
end
return Functions