Module:Tone superscript: Difference between revisions
Appearance
Content deleted Content added
mNo edit summary |
simplified regex, also only match numbers following not-numbers and not whitespace |
||
Line 4: | Line 4: | ||
local root = mw.html.create() |
local root = mw.html.create() |
||
local arg = frame:getParent().args[1] or "" |
local arg = frame:getParent().args[1] or "" |
||
local x = arg:gsub(" |
local x = arg:gsub("%f[%d%s]([%d\*]+)", "<sup>%1</sup>") |
||
root:tag('span'):wikitext(x) |
root:tag('span'):wikitext(x) |
||
local tracking = '' |
local tracking = '' |
Revision as of 20:19, 5 September 2017
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("%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