591
edits
No edit summary |
m (Reverted edits by Wpvandelicer (talk) to last revision by IncredibleMeh) Tag: Rollback |
||
(13 intermediate revisions by 4 users not shown) | |||
Line 3: | Line 3: | ||
local p = {} | local p = {} | ||
local attributedict = { | local attributedict = { | ||
[" | ["FIRE"] = "Fire", | ||
[" | ["ELECTRIC"] = "Electric", | ||
[" | ["WIND"] = "Wind", | ||
[" | ["STUN"] = "Stun", | ||
[" | ["EXPLOSION"] = "Explosion", | ||
[" | ["ICE"] = "Ice", | ||
["Blind"] = " | ["BLIND"] = "Blind", | ||
[" | ["POISON"] = "Poison", | ||
[" | ["NULL"] = "None", | ||
["NONE"] = "None", | |||
} | } | ||
Line 20: | Line 21: | ||
function p._main(args) | function p._main(args) | ||
local | if args[1] then | ||
local attribute = string.upper(args[1]) | |||
local pageName | |||
for key, value in pairs(attributedict) do | |||
if string.match(attribute, key) then | |||
output = attribute:gsub(key,value) | |||
if output == "None" then | |||
pageName = "Null" | |||
else | |||
pageName = output | |||
end | |||
local formattedImage | |||
local formattedLink | |||
if args[2] == "text" then | |||
formattedImage = string.format('[[File:Attrib-%s.png|%s|link=%s]]', output, '20px', pageName) | |||
formattedLink = string.format('[[%s|%s]]', args['link'] or pageName) | |||
return string.format('<span style="white-space: nowrap;">%s %s</span>', formattedImage, formattedLink) | |||
else | |||
if args[3] == "text" then | |||
formattedImage = string.format('[[File:Attrib-%s.png|%s|link=%s]]', output, args[2] or '20px', pageName) | |||
formattedLink = string.format('[[%s|%s]]', args['link'] or pageName, args[text] or pageName) | |||
return string.format('<span style="white-space: nowrap;">%s %s</span>', formattedImage, formattedLink) | |||
else | |||
formattedImage = string.format('[[File:Attrib-%s.png|%s|link=%s]]', output, args[2] or 'x36px', pageName) | |||
return formattedImage | |||
end | |||
end | |||
end | end | ||
end | end | ||
end | end |