Module:labels: Difference between revisions

m
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
mNo edit summary
mNo edit summary
Line 30: Line 30:
local it = 1
local it = 1
-- split parameters at /
-- split parameters at / and ,
while labels[it] do
while labels[it] do
if mw.ustring.find(labels[it], "^[^,]+,%s.+") then
local before = mw.ustring.gsub(labels[it], "^([^,]+),%s*(.+)", "%1")
local after = mw.ustring.gsub(labels[it], "^([^,]+),%s*(.+)", "%2")
labels[it] = before
table.insert(labels, it + 1, after)
end
if mw.ustring.find(labels[it], "^[^/]+/.+") then
if mw.ustring.find(labels[it], "^[^/]+/.+") then
local before = mw.ustring.gsub(labels[it], "^([^/]+)/(.+)", "%1")
local before = mw.ustring.gsub(labels[it], "^([^/]+)/(.+)", "%1")