Module:Tone superscript: Difference between revisions

Content deleted Content added
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...'
 
m Protected "Module:Tone superscript": High-risk module ([Edit=Require autoconfirmed or confirmed access] (indefinite))
 
(10 intermediate revisions by 3 users not shown)
Line 1:
local p = {}
main = main,
}
 
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>")
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)
local tracking = ''
return tostring(root)
if string.match(arg, "</?sup>") then tracking = '[[Category:Pages using Tone superscript with sup tags]]' end
return tostring(root)..tracking
end