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 Mps (talk | contribs) at 20:19, 5 September 2017 (simplified regex, also only match numbers following not-numbers and not whitespace). 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("%f[%d%s]([%d\*]+)", "<sup>%1</sup>")
	root:tag('span'):wikitext(x)
	local tracking = ''
	if string.match(arg, "</?sup>") then tracking = '[[Category:Pages using Tone superscript with sup tags]]' end
	return tostring(root)..tracking
end

return p