Jump to content

Module:Ustring

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ans (talk | contribs) at 05:16, 1 March 2019 (no need to check, since the item never duplicate). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

p = {}

for k, v in pairs(mw.ustring) do
	p[k] = function(frame)
		local args = {}
		for _, v in ipairs(frame.args) do
			table.insert(args, tonumber(v) or v:gsub("^\\", "", 1))
		end
		if frame.args.tag then
			local tag = {name = frame.args.tag, content = mw.ustring[k](unpack(args)), args = {}}
			for x, y in pairs(frame.args) do
				if type(x)~='number' and x~='tag' then tag.args[x] = y end
			end
			return frame:extensionTag(tag)
		end
		return (mw.ustring[k](unpack(args)))
	end
end

return p