Jump to content

Module:Emoji: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
make it clear these are defaults--could ostensibly add them to the data module
woops!
Line 4: Line 4:
function p.emocode(frame)
function p.emocode(frame)
local emotbl = emodata.emotbl
local emotbl = emodata.emotbl
local default_name = "smiley"
local default_code = "smiley"
local emoname = mw.text.trim(frame.args[1] or default_code)
local emoname = mw.text.trim(frame.args[1] or default_code)
return emotbl[emoname] or emoname
return emotbl[emoname] or emoname

Revision as of 12:01, 25 March 2019

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

function p.emocode(frame)
	local emotbl = emodata.emotbl
	local default_code = "smiley"
	local emoname = mw.text.trim(frame.args[1] or default_code)
	return emotbl[emoname] or emoname
end

function p.emoname(frame)
	local emorevtbl = emodata.emorevtbl
	local default_name = "1f603"
	local emocode = mw.text.trim(frame.args[1] or default_name)
	return emorevtbl[emocode] or emocode
end

return p