Jump to content

Module:Emoji: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m Reverted edits by Izno (talk) to last version by RexxS
No edit summary
Line 4: Line 4:
function p.emocode(frame)
function p.emocode(frame)
local emotbl = emodata.emotbl
local emotbl = emodata.emotbl
local emoname = mw.text.trim(frame.args[1] or "smiley")
local emoname = frame.args[1] and mw.text.trim(frame.args[1])
if '' == emoname then
emoname = 'smiley';
end
return emotbl[emoname] or emoname
return emotbl[emoname] or emoname
end
end
Line 10: Line 13:
function p.emoname(frame)
function p.emoname(frame)
local emorevtbl = emodata.emorevtbl
local emorevtbl = emodata.emorevtbl
local emocode = mw.text.trim(frame.args[1] or "1f603")
local emocode = frame.args[1] and mw.text.trim(frame.args[1])
if '' == emocode then
emocode = '1f603';
end
return emorevtbl[emocode] or emocode
return emorevtbl[emocode] or emocode
end
end

Revision as of 12:42, 25 March 2019

local p= {}
local emodata = mw.loadData ('Module:Emoji/data')

function p.emocode(frame)
	local emotbl = emodata.emotbl
	local emoname = frame.args[1] and mw.text.trim(frame.args[1])
	if '' == emoname then
		emoname = 'smiley';
	end
	return emotbl[emoname] or emoname
end

function p.emoname(frame)
	local emorevtbl = emodata.emorevtbl
	local emocode = frame.args[1] and mw.text.trim(frame.args[1])
	if '' == emocode then
		emocode = '1f603';
	end
	return emorevtbl[emocode] or emocode
end

return p