10,992
editsAd placeholder
Module:ParseList: Difference between revisions
Jump to navigation
Jump to search
no edit summary
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
local pluralizeElements = false | local pluralizeElements = false | ||
local finalJoiningWord = "and" | local finalJoiningWord = "and" | ||
local function splitListString(listString) | local function splitListString(listString) | ||
Line 100: | Line 80: | ||
end, | end, | ||
} | } | ||
function p.main(frame) | |||
local args = getArgs(frame, { frameOnly = true }) | |||
return p._main(args) | |||
end | |||
function p._main(args) | |||
listDelimiters = args['delimiter'] or listDelimiters | |||
makeElementsLinks = args['makeLinks'] or makeElementsLinks | |||
pluralizeElements = args['pluralize'] or pluralizeElements | |||
finalJoiningWord = args['joiningWord'] or finalJoiningWord | |||
local type = args['type'] or 'sentence' | |||
local converter = converters[type] | |||
local elements = {} | |||
for str in splitListString(args[1]) do | |||
table.insert(elements, processElement(str)) | |||
end | |||
return converter(elements) | |||
end | |||
return p | return p |