Jump to content

Module:Tone superscript

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Jc86035 (talk | contribs) at 01:49, 20 March 2017. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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)
	return tostring(root)
end

return p