模組:Jpingauto

local p = {}

function p.main(frame)
	local root = mw.html.create()
	local arg = frame:getParent().args[1] or ""
	local x = arg:gsub("(%d)", "<sup>%1</sup>")
	x = x:gsub("(%d)</sup>%*<sup>(%d)", "%1*%2")
	x = x:gsub("<sup><sup>([%d%*]+)</sup></sup>", "<sup>%1</sup>")
	root:tag('span'):wikitext(x)
	local tracking = ''
	if string.match(arg, "</?sup>") then tracking = '[[Category:用咗sup標記嘅調號上標模]]' end
	return tostring(root)..tracking
end

return p