Ad 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, may be overwritten in the main function
-- Config options, set in main function
local listDelimiters = ","
local listDelimiters
local makeElementsLinks = false
local makeElementsLinks
local pluralizeElements = false
local makeElementsPlural
local finalJoiningWord = "and"
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 pluralizeElements then
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
listDelimiters = args['delimiter'] or ","
makeElementsLinks = args['makeLinks'] or makeElementsLinks
makeElementsLinks = args['makeLinks']
pluralizeElements = args['pluralize'] or pluralizeElements
makeElementsPlural = args['pluralize'] or args['makePlural']
finalJoiningWord = args['joiningWord'] or finalJoiningWord
makeElementsSingular = args['makeSingular']
finalJoiningWord = args['joinWord'] or args['joiningWord'] or "and"
local type = args['type'] or 'sentence'
local type = args['type'] or 'sentence'

Navigation menu