Module:Distinguish

local p = {}

function p.distinguish(frame) local template = frame.args[1] local args = frame:getParent.args local noDlcIcon = args.noDlcIcon or '' local links = {} for i, v in ipairs(args) do        local s = trim(args[i]) if #s > 0 then table.insert(links, frame:expandTemplate{title = template, args = { s, noDlcIcon = noDlcIcon } }) end end

if args[2] ~= nil and args[3] == nil then return mw.text.listToText( links, ', ', ' or ' ) else return mw.text.listToText( links, ', ', ', or ' ) end end

function trim(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end

return p