Module:Infobox: Difference between revisions

Jump to navigation Jump to search
No edit summary
(Changed the list-split regex to not chop off the first character after the comma when the comma is not followed by whitespace. Also added a documentation case for this.)
Line 103: Line 103:
listItems = utilsString.split(listItems, "<br/?>")
listItems = utilsString.split(listItems, "<br/?>")
else
else
listItems = utilsString.split(listItems, '%s*,[%D+|%s*]') -- %D ensures that we don't split large numbers (e.g. 1,500)
listItems = utilsString.split(listItems, '%s*,%s*%f[%a]') -- %f[%a] is so we don't split numbers on their thousands separator (e.g., 1,500)
end
end
Line 227: Line 227:
listItems = utilsTable.flatMap(listItems, utilsString._split("<br/>"))
listItems = utilsTable.flatMap(listItems, utilsString._split("<br/>"))
elseif listItems then
elseif listItems then
listItems = utilsString.split(listItems, '%s*,[%D+|%s*]')
listItems = utilsString.split(listItems, '%s*,%s*%f[%a]') -- %f[%a] is so we don't split numbers on their thousands separator (e.g., 1,500)
end
end
if listItems then
if listItems then
Line 457: Line 457:
{
{
args = {"A, B, C"}
args = {"A, B, C"}
},
{
desc = "Spaces between list elements are optional, but recommended for readability.",
args = {"A,B,C"}
},
},
{
{