Spring til indhold

Modul:Sidelist

Fra Wikipedia, den frie encyklopædi

local p = {} local seplst = { [1] = "comma", [2] = "dot", [3] = "pipe", [4] = "tpt-languages" } local NS_SEP = ":" local MRK1 = '\1' local _a = { ["nspace"] = "", ["separator"] = "comma",  ["conjunction"] = " og ",  ["delim"] = "",  ["edelim"] = "" } _a.samme = 8 _a.lt = 8 local str = "" p.m = function (P)  for k in pairs (_a) do _a[k] = P.args[k] or _a[k] end for k in pairs (seplst) do if (_a.separator == seplst[k]) then _a.separator = mw.message.new(seplst[k] .. "-separator"):plain() break end end if (_a.samme == "1") then _a.conjunction = _a.separator end if (_a.nspace ~= "") then _a.nspace = NS_SEP .. _a.nspace .. NS_SEP else _a.nspace = NS_SEP end local tmp2 = "" for k, v in ipairs (P.args) do tmp2 = (_a.lt == "1") and "|" .. v: gsub ("^%s*",""): gsub ("%s*$",""): gsub (".*:","") or "" str = (v: match ("^%s*$")) and str or (str .. MRK1 .. _a.delim .. "[[" .. _a.nspace .. v: gsub ("^%s*",""): gsub ("%s*$","") .. tmp2 .. "]]" .. _a.edelim .. _a.separator) end str = str: gsub ("(.*)(" .. _a.separator .. MRK1 .. ")([^" .. MRK1 .. "]+)" .. _a.separator,"%1" .. _a.conjunction .. "%3"): gsub (MRK1,""): gsub (_a.separator .. "$","") return str end return p