Moduł:String/UNIQ
Wygląd
![](https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Test_Template_Info-Icon.svg/50px-Test_Template_Info-Icon.svg.png)
Zobacz podstrony tego modułu.
local function posUNIQ(text, tag)
if text then
local pattern = "\127'\"`UNIQ"
if tag then
pattern = pattern.."--"..tag.."-"
end
local b, _ = mw.ustring.find(text, pattern, 1, true)
return b
end
end
return {
podziel = function(text, tag, def)
local pos = posUNIQ(text, tag)
if text and pos and (pos > 1) then
local before = mw.ustring.sub(text, 1, pos - 1)
local after = mw.ustring.sub(text, pos)
return before, after
end
return text, def
end,
pozycja = function(frame)
local text = frame.args[1]
return posUNIQ(text, frame.args.tag)
end,
przed = function(frame)
local text = frame.args[1]
local pos = posUNIQ(text, frame.args.tag)
if text and pos and (pos > 1) then
return mw.ustring.sub(text, 1, pos - 1)
end
return text
end,
od = function(frame)
local text = frame.args[1]
local pos = posUNIQ(text, frame.args.tag)
if text and pos and (pos >= 1) then
return mw.ustring.sub(text, pos)
end
end,
}