Editing Module:Twemoji

Jump to navigation Jump to search

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 4: Line 4:


function p.main(frame)
function p.main(frame)
local inp = frame.args[1]
local p1 = frame.args[1]
local beginspan = "<span class='nowrap'>"
local p2 = ""
local size = "20px"
local p3 = ""
if (frame.args[2] and not(frame.args[2] == ""))
if (frame.args[2])
then
then
beginspan = "<span class='nowrap' title='" .. frame.args[2] .. "'>"
p2 = frame.args[2]
end
end
if (frame.args[3] and not(frame.args[3] == ""))
if (frame.args[3])
then
then
size = frame.args[3]
p3 = frame.args[3]
end
end
if (mw.ustring.match(inp, "[A-z0-9-]"))
if (mw.ustring.match(p1, "[A-z0-9-]"))
then
then
return beginspan .. "[[File:Twemoji12 " .. inp .. ".svg|".. size .."|link=|alt=]]</span>"
return "{{inline emote|Twemoji12 " .. p1 .. ".svg|2=" .. p2 .. "|3=" .. p3 .. "}}"
else
else
local cps = {}
local cps = {}
local i = 1
local i = 1
for codepoint in mw.ustring.gcodepoint(inp) do
for codepoint in mw.ustring.gcodepoint(p1) do
cps[i] = string.format("%x", codepoint)
cps[i] = string.format("%x", codepoint)
i = i + 1
i = i + 1
Line 32: Line 32:
local output = table.concat(cps, "-")
local output = table.concat(cps, "-")
return beginspan .. "[[File:Twemoji12 " .. output .. ".svg|".. size .."|link=|alt=" .. inp .. "]]</span>"
return "{{inline emote|Twemoji12 " .. output .. ".svg|2=" .. p2 .. "|3=" .. p3 .. "}}"
end
end
end
end


return p
return p
Please note that all contributions to Irony Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see Irony Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Template used on this page: