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 2: | Line 2: | ||
local p = {} | local p = {} | ||
-- Config options, | -- Config options, set in main function | ||
local listDelimiters | local listDelimiters | ||
local makeElementsLinks | local makeElementsLinks | ||
local | local makeElementsPlural | ||
local finalJoiningWord | local makeElementsSingular | ||
local finalJoiningWord | |||
local function splitListString(listString) | local function splitListString(listString) | ||
Line 61: | Line 62: | ||
local function processElement(str) | local function processElement(str) | ||
if | if makeElementsPlural then | ||
local plural = pluralize(str) | local plural = pluralize(str) | ||
if makeElementsLinks then | if makeElementsLinks then | ||
Line 125: | Line 126: | ||
function p._main(args) | function p._main(args) | ||
listDelimiters = args['delimiter'] or | listDelimiters = args['delimiter'] or "," | ||
makeElementsLinks = args['makeLinks'] | makeElementsLinks = args['makeLinks'] | ||
makeElementsPlural = args['pluralize'] or args['makePlural'] | |||
finalJoiningWord = args['joiningWord'] or | makeElementsSingular = args['makeSingular'] | ||
finalJoiningWord = args['joinWord'] or args['joiningWord'] or "and" | |||
local type = args['type'] or 'sentence' | local type = args['type'] or 'sentence' |