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 Dabao qian (talk | contribs) at 15:58, 13 November 2016 (Created page with 'local p = { main = main, } function p.main(frame) local root=mw.html.create() local arg=frame:getParent().args[1] if not arg or arg:len()==0 then root:tag...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {
	main = main,
}

function p.main(frame)
	local root=mw.html.create()
	local arg=frame:getParent().args[1]
	if not arg or arg:len()==0 then
		root:tag('strong'):attr('class','error'):wikitext('Unknown pronunciation.')
		return tostring(root)
	end
	local x=arg:gsub("(%d)","<sup>%1</sup>")
	x=x:gsub("(%d)</sup>%*<sup>(%d)","%1*%2")
	root:tag('span'):wikitext(x)
	return tostring(root)
end

return p