Module:labels: Difference between revisions

m
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
mNo edit summary
mNo edit summary
Line 40: Line 40:
table.insert(labels, it + 1, after)
table.insert(labels, it + 1, after)
end
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")
local after = mw.ustring.gsub(labels[it], "^([^/]+)/(.+)", "%2")
local after = mw.ustring.gsub(labels[it], "^([^/]+)/(.+)", "%2")
Line 48: Line 48:
end
end
for conjunction, _ in pairs(conjunctions) do
for conjunction, _ in pairs(conjunctions) do
if mw.ustring.find(labels[it], "^.+%s+" .. conjunction .. "%s+.+") then
if mw.ustring.find(labels[it], "^[^%[%]]+%s+" .. conjunction .. "%s+.+") then
local before = mw.ustring.gsub(labels[it], "^(.+)%s+" .. conjunction .. "%s+(.+)", "%1")
local before = mw.ustring.gsub(labels[it], "^(.+)%s+" .. conjunction .. "%s+(.+)", "%1")
local after = mw.ustring.gsub(labels[it], "^(.+)%s+" .. conjunction .. "%s+(.+)", "%2")
local after = mw.ustring.gsub(labels[it], "^(.+)%s+" .. conjunction .. "%s+(.+)", "%2")