Module:Tone superscript
Appearance
Implements {{Tone superscript}}
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>)+(.*)(</sup>)+</sup>", "<sup>%2</sup>")
root:tag('span'):wikitext(x)
return tostring(root)
end
return p