Jump to content

Editing Module:Card

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
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 28: Line 28:
name = 'quality',
name = 'quality',
alias = 'rarity',
alias = 'rarity',
default = 'Common',
default = 'Gray',
},
},
{
{
Line 86: Line 86:
alias = 'UP',
alias = 'UP',
type = '1',
type = '1',
},
{
name = 'galaxy',
},
},
{
{
Line 99: Line 102:


return p._main(args)
return p._main(args)
end
local function getDataByName(dataType, dataTable, name)
local data = dataTable[name]
if data then
return data
end
local normalizedType = tostring(dataType or ''):lower()
if normalizedType == 'neighbor' or normalizedType == 'neighbors' then
return nil
end
for quality, names in pairs(dataTable) do
if type(names) == 'table' then
for _, itemName in ipairs(names) do
if itemName == name then
return {
quality = quality
}
end
end
end
end
return nil
end
end


Line 137: Line 113:


if lib.isEmpty(requestedType) or dataType == requestedType then
if lib.isEmpty(requestedType) or dataType == requestedType then
local data = getDataByName(dataType, dataTable, name)
local data = dataTable[name]


if data then
if data then
Line 172: Line 148:


if lib.isEmpty(quality) then
if lib.isEmpty(quality) then
quality = 'Common'
quality = 'Gray'
end
end


Line 265: Line 241:
if not (out.nonDefaults and out.nonDefaults.quality) then
if not (out.nonDefaults and out.nonDefaults.quality) then
out.quality = out.data.quality
out.quality = out.data.quality
end
end
if out.data.galaxy then
out.defaults.galaxy = out.data.galaxy
if not (out.nonDefaults and out.nonDefaults.galaxy) then
out.galaxy = out.data.galaxy
end
end
end
end
Line 417: Line 401:
else
else
imageContainer:wikitext(a.image_wikitext)
imageContainer:wikitext(a.image_wikitext)
end
-- Galaxy icon
if not a.mini and ne(a.galaxy) then
node_card:tag('span')
:addClass('card-icon-galaxy')
:wikitext(
'[[File:' ..
a.galaxy ..
' Icon.png|alt=' ..
a.galaxy ..
'|link=' ..
a.galaxy ..
'|20px]]'
)
end
end


Please note that all contributions to The Petit Planet Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see Petit Planet 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)
Preview page with this template
Below are commonly used wikitext from MediaWiki:Edittools. Click on any to insert them in the edit box.
File Pages==Summary====Licensing=={{Fairuse}}{{File|}}
Dynamic Page List¦²«»²{¦}²«»«/»«!----»
Array in DPL¹^2{}^2^2{¹}^2
Parser Functions{{#if:||}}
{{#ifeq:|||}}
{{#expr:}}
{{#switch:||#default=}}
{{#replace:||}}
{{#titleparts:}}
{{#tag:|}}
Markup{{}}|[][[]][[Category:]]#REDIRECT [[]] [[Category:Redirect Pages]]<code></code><includeonly></includeonly><noinclude></noinclude><nowiki></nowiki><!----><br>§
Notices{{Stub|}}{{Stub Dialogue}}{{Upcoming}}{{Under Construction}}{{Placeholder|}}
Magic Words{{!}}{{formatnum:}}{{lc:}}{{uc:}}{{PAGENAME}}{{FULLPAGENAME}}{{ROOTPAGENAME}}{{BASEPAGENAME}}{{SUBPAGENAME}}{{DISPLAYTITLE:|noreplace}}__TOC____NOTOC____EXPECTUNUSEDCATEGORY____HIDDENCAT__
HTML Entities&mdash;&nbsp;&comma;&shy;