Module:Entry/metatable: Difference between revisions

m
Reverted edits by Tailx (talk) to last revision by HyperNervie
No edit summary
m (Reverted edits by Tailx (talk) to last revision by HyperNervie)
Tag: Rollback
 
(4 intermediate revisions by 2 users not shown)
Line 17: Line 17:


function entryMT.title(entry)
function entryMT.title(entry)
return entry._data[2] or titles.target
return entry._data[2] or entry.target
end
end


function entryMT.text(entry)
function entryMT.text(entry)
return entry._data[3] or titles.title
return entry._data[3] or entry.title
end
end


local function _textWithTempoUp(entry, args)
local function _textWithTempoUp(entry, args)
if entry.target == "" then return "" end
if entry.target == "" then return "" end
local tempoUpSize = args.tempoUpSize
local t = entry.text
local t = entry.text
if (entry.console == "GBA" or entry.console == "Arcade")
if (entry.console == "GBA" or entry.console == "Arcade")
and entry.stage == "EX"
and entry.stage == "EX"
then
then
tempoUpSize = tempoUpSize or "72px"
local tempoUpSize = args.tempoUpSize or "72px"
t = mw.ustring.format("%s [[File:TempoUpExtra%s.png|%s|link=]]",
local class = ""
t, entry.number, tempoUpSize)
if args.class then class = "|class=" .. args.class end
t = mw.ustring.format("%s [[File:TempoUpExtra%s.png|%s%s|link=]]",
t, entry.number, tempoUpSize, class)
end
end
return t
return t
Line 83: Line 84:
function entryMT.iconVariants(entry)
function entryMT.iconVariants(entry)
local variants = {}
local variants = {}
for _, v in ipairs(entry._data.variants) do variants[v] = true end
for _, v in ipairs(entry._data.variants or {}) do
variants[v] = true
end
return variants
return variants
end
end
Line 112: Line 115:
local function _icon(entry, args)
local function _icon(entry, args)
local iconSize = args.iconSize or entry.defaultIconSize
local iconSize = args.iconSize or entry.defaultIconSize
return mw.ustring.format("[[File:%s|%s|link=%s]]",
local link = entry.selfLink and "" or entry.title
entry:iconName(args), iconSize, entry.selfLink and "" or entry.title)
local class = ""
if args.class then class = "|class=" .. args.class end
return mw.ustring.format("[[File:%s|%s%s|link=%s]]",
entry:iconName(args), iconSize, class, link)
end
end