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 09:49, 8 March 2019 (to consolidate common function to Module:LuaCall, for ease to maintain bug fix and improvement. Some bug fixes and improvements has been done there but not yet here. One of common functions like tostringOrNumber() will also be shared there. This is not proxying, but to share common code with other modules.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = require("Module:LuaCall").import(mw.ustring)

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

return p