Module:Icon/data
This module stores icon data for Module:Icon.
Adding icons[edit]
To add a new icon, add a table in the following format:
code = {
image = "My image name.xyz",
tooltip = "My tooltip text",
link = true,
},
The code should be in lower case.
Fields[edit]
image
: the image to be displayed. This should be without theFile:
prefix. So, if you wanted to add File:Featured article star.svg, you would use"Featured article star.svg"
here. If any of the text you add has double quotes in, you will need to escape it with backslashes like this:"My \"quoted\" image.svg"
.tooltip
: the tooltip to be displayed when hovering the mouse above the image. This is optional, although it is recommended you include it.link
: if false, the link to the file description page is suppressed. You should only set this to false if the icon image is in the public domain, or is released under a license that does not require attribution (such as CC-0). For images released under licenses that require attribution such as CC-BY-SA and the GFDL, you should set this to true to preserve the link to the file description page.
Aliases[edit]
If you want to add aliases for the code, add an aliases
table as follows:
code = {
aliases = {"alias1", "alias2"},
image = "My image name.xyz",
tooltip = "My tooltip text",
link = true,
},
Please make sure that any codes and aliases that you add don't match any existing codes or aliases. If they do, one of them will be overwritten with the other (and it's not possible to say for certain which will be overwritten with which).
Removing icons[edit]
Removing icons is fairly easy. Just remove the relevant entry from the data table. You should not remove the _DEFAULT entry, as Module:Icon relies on it being there, and removing it will cause script errors.
-- This module stores icon data for [[Module:Icon]].
--------------------------------------------------------------------------------
-- Icon data
--------------------------------------------------------------------------------
local data = {
fa = {
image = "star-box.svg",
tooltip = "Featured article",
link = true,
},
ffa = {
aliases = {"dfa"},
image = "star-box-multiple.svg",
tooltip = "Former featured article",
link = true,
},
fac = {
aliases = {"fan"},
image = "file-star.svg",
tooltip = "Featured article candidate",
link = true,
},
fp = {
image = "star-box-outline.svg",
tooltip = "Featured picture",
link = true,
},
fpc = {
aliases = {"fpn"},
image = "file-star-outline.svg",
tooltip = "Featured picture candidate",
link = true,
},
ffp = {
image = "star-box-multiple-outline.svg",
tooltip = "Former featured picture",
link = true,
},
category = {
aliases = {"cat", "categ"},
image = "Symbol category class.svg",
tooltip = "Category",
link = false,
},
disambiguation = {
aliases = {"dab", "disamb", "disambig"},
image = "Symbol dab class.svg",
tooltip = "Disambiguation page",
link = true,
},
image = {
aliases = {"file"},
image = "file.svg",
tooltip = "File",
link = true,
},
needed = {
image = "creation.svg",
tooltip = "Needed article",
link = false,
},
portal = {
image = "Symbol portal class.svg",
tooltip = "Portal",
link = true,
},
project = {
image = "Symbol project class.svg",
tooltip = "Project page",
link = false,
},
redirect = {
aliases = {"red", "redir"},
image = "Symbol redirect vote2.svg",
tooltip = "Redirect",
link = true,
},
template = {
aliases = {"temp", "templ"},
image = "Symbol template class.svg",
tooltip = "Template",
link = false,
},
essay = {
image = "Essay.svg",
tooltip = "Essay",
link = false,
},
q = {
aliases = {"question"},
image = "help-circle.svg",
tooltip = "Question",
link = false,
},
cleanup = {
image = "Edit-clear.svg",
tooltip = "Cleanup work",
link = false,
},
tfa = {
image = "shield-star.svg",
tooltip = "Today's Featured Article",
link = true,
},
tfl = {
image = "shield-star-outline.svg",
tooltip = "Today's Featured Picture",
link = true,
},
wikiproject = {
image = "People icon.svg",
tooltip = "WikiProject",
link = false,
},
mediawiki = {
image = "MediaWiki-2020-icon.svg",
tooltip = "MediaWiki",
link = false,
},
meta = {
image = "Community Logo.svg",
tooltip = "Meta-wiki page",
link = false,
},
module = {
image = "Lua-logo-nolabel.svg",
tooltip = "Module",
link = false,
},
_DEFAULT = {
image = "help-circle.svg",
link = false,
}
}
--------------------------------------------------------------------------------
-- End icon data
--------------------------------------------------------------------------------
-- Make aliases work the same as normal keys, and remove the "aliases" subtables.
local ret= {}
for code, iconData in pairs(data) do
iconData.canonicalCode = code
if iconData.aliases then
for _, alias in ipairs(iconData.aliases) do
ret[alias] = iconData
end
iconData.aliases = nil
end
ret[code] = iconData
end
return ret