Module:Icon/data
File:Full-protection-shackle.svg | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
This Lua module is used on approximately 574,000 pages, or roughly 40112% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This module stores icon data for Module:Icon.
Adding icons
To add a new icon, add a table in the following format:
<syntaxhighlight lang="lua"> code = { image = "My image name.xyz", tooltip = "My tooltip text", link = true, }, </syntaxhighlight>
The code should be in lower case.
Fields
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
Usage
Wraps a short span of text in <syntaxhighlight>
tags (see mw:Extension:SyntaxHighlight). This template should be used for short samples; longer content should use <pre>...</pre>
or <syntaxhighlight>...</syntaxhighlight>
. See Help:Wiki markup for an explanation of what the various tags do.
If the content includes an equals sign (=), you must specify the parameter explicitly: {{code|1=date=30 Feb 2010}}
.
The template uses the <syntaxhighlight>
tag with the attribute inline=1
. This works like the combination of the <code>
and <nowiki>
tags, applied to the expanded wikitext. For example, {{code|some '''wiki''' text}}
will not render the word "wiki" in bold, and will render the tripled-single-quotes:
- Template loop detected: Template:Code
However, {{code|a {{template}} call}}
will still invoke the template:
- Template loop detected: Template:Code
Use <nowiki>...</nowiki>
around the template name to avoid this problem:
- Template loop detected: Template:Code
When used inline with regular text, {{code}}
generally looks best and is easiest to read when it is explicitly spaced apart from the regular text:
- Template loop detected: Template:Code
is well spaced:
- foo Template loop detected: Template:Code quux.
versus:
- Template loop detected: Template:Code
which is going to be visually confusing for many:
- foo Template loop detected: Template:Code quux.
because "foo" and "Template loop detected: Template:Code" will seem more closely associated than "Template loop detected: Template:Code" and "Template loop detected: Template:Code"; the width of the space character in a monospaced font is almost always larger than in a proportional font.
Use parameter lua (unnamed, as |2=
, or more explicitly as |lang=
) to specify a language for mw:Extension:SyntaxHighlight. This option defaults to plain-text, i.e. no highlighting. There is no highlighting option for wikitext as a markup language, though Template loop detected: Template:Code and Template loop detected: Template:Code are valid values, as are Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code and many others. Attempting to use an invalid one causes a list of valid ones to be displayed in place of the template output, when the page is previewed or saved.
This template does not need to be substituted.
Examples
Markup | Renders asScript error: No such module "For loop". |
---|---|
Included templates
Embedded templates do not function as expected inside {{code}}; for longer, free-form blocks of code, which can contain templates such as {{var}} and {{samp}}, use <code>...</code>
as a wrapper instead of this template.
Templates used inside {{code}} expose the rendered HTML— this can be useful. For example:
Markup | Renders asScript error: No such module "For loop". |
---|---|
The above example shows the HTML rendered by the citation template, including the hidden metadata.
TemplateData
TemplateData for Icon
See also
- {{codett}}, wrapper for this template that removes background and border styling
- {{mono}}, monospaced font only
- {{param value}}, monospaced; friendly handling for blank space
- {{Syntaxhighlight}}
- {{kbd}}, for keyboard input
- Help:Wiki markup
Usage
Wraps a short span of text in <syntaxhighlight>
tags (see mw:Extension:SyntaxHighlight). This template should be used for short samples; longer content should use <pre>...</pre>
or <syntaxhighlight>...</syntaxhighlight>
. See Help:Wiki markup for an explanation of what the various tags do.
If the content includes an equals sign (=), you must specify the parameter explicitly: {{code|1=date=30 Feb 2010}}
.
The template uses the <syntaxhighlight>
tag with the attribute inline=1
. This works like the combination of the <code>
and <nowiki>
tags, applied to the expanded wikitext. For example, {{code|some '''wiki''' text}}
will not render the word "wiki" in bold, and will render the tripled-single-quotes:
- Template loop detected: Template:Code
However, {{code|a {{template}} call}}
will still invoke the template:
- Template loop detected: Template:Code
Use <nowiki>...</nowiki>
around the template name to avoid this problem:
- Template loop detected: Template:Code
When used inline with regular text, {{code}}
generally looks best and is easiest to read when it is explicitly spaced apart from the regular text:
- Template loop detected: Template:Code
is well spaced:
- foo Template loop detected: Template:Code quux.
versus:
- Template loop detected: Template:Code
which is going to be visually confusing for many:
- foo Template loop detected: Template:Code quux.
because "foo" and "Template loop detected: Template:Code" will seem more closely associated than "Template loop detected: Template:Code" and "Template loop detected: Template:Code"; the width of the space character in a monospaced font is almost always larger than in a proportional font.
Use parameter lua (unnamed, as |2=
, or more explicitly as |lang=
) to specify a language for mw:Extension:SyntaxHighlight. This option defaults to plain-text, i.e. no highlighting. There is no highlighting option for wikitext as a markup language, though Template loop detected: Template:Code and Template loop detected: Template:Code are valid values, as are Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code and many others. Attempting to use an invalid one causes a list of valid ones to be displayed in place of the template output, when the page is previewed or saved.
This template does not need to be substituted.
Examples
Markup | Renders asScript error: No such module "For loop". |
---|---|
Included templates
Embedded templates do not function as expected inside {{code}}; for longer, free-form blocks of code, which can contain templates such as {{var}} and {{samp}}, use <code>...</code>
as a wrapper instead of this template.
Templates used inside {{code}} expose the rendered HTML— this can be useful. For example:
Markup | Renders asScript error: No such module "For loop". |
---|---|
The above example shows the HTML rendered by the citation template, including the hidden metadata.
TemplateData
TemplateData for Icon
See also
- {{codett}}, wrapper for this template that removes background and border styling
- {{mono}}, monospaced font only
- {{param value}}, monospaced; friendly handling for blank space
- {{Syntaxhighlight}}
- {{kbd}}, for keyboard input
- Help:Wiki markup
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
If you want to add aliases for the code, add an aliases
table as follows:
<syntaxhighlight lang="lua">
code = {
aliases = {"alias1", "alias2"},
image = "My image name.xyz",
tooltip = "My tooltip text",
link = true,
},
</syntaxhighlight>
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
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 = "Featured article star.svg", tooltip = "Featured article", link = true, }, far = { image = "Cscr-star piece.png", tooltip = "Featured article review", link = true, }, farc = { image = "Cscr-star piece.png", tooltip = "Featured article removal candidate", link = true, }, ffa = { aliases = {"dfa"}, image = "Featured article star - cross.svg", tooltip = "Former featured article", link = true, }, fac = { aliases = {"fan"}, image = "Cscr-candidate.svg", tooltip = "Featured article candidate", link = true, }, ffac = { aliases = {"nofa"}, image = "Featured article star - cross.svg", tooltip = "Failed featured article candidate", link = true, }, fl = { image = "Featured article star.svg", tooltip = "Featured list", link = true, }, flrc = { aliases = {"flr"}, image = "Cscr-star piece.png", tooltip = "Featured list removal candidate", link = true, }, ffl = { aliases = {"dfl"}, image = "Cscr-featured-strike.svg", tooltip = "Former featured list", link = true, }, flc = { aliases = {"fln"}, image = "Cscr-candidate.svg", tooltip = "Featured list candidate", link = true, }, fflc = { aliases = {"nofl"}, image = "Cscr-former.svg", tooltip = "Failed featured list candidate", link = true, }, a = { image = "Symbol a class.svg", tooltip = "A-Class article", link = true, }, dac = { aliases = {"daa"}, image = "Symbol unsupport A vote.svg", tooltip = "Demoted A-Class article", link = true, }, acc = { aliases = {"acn", "aac"}, image = "A candidate.svg", tooltip = "A-Class article candidate", link = true, }, noac = { aliases = {"faac"}, image = "Symbol unsupport A vote.svg", tooltip = "Failed A-Class article candidate", link = true, }, ga = { image = "Symbol support vote.svg", tooltip = "Good article", link = false, }, gar = { image = "GA Candidate Neutral vote(ChaosNil).svg", tooltip = "Good article reassessment", link = false, }, dga = { image = "Symbol unsupport vote.svg", tooltip = "Delisted good article", link = false, }, gan = { aliases = {"gac"}, image = "GA candidate.svg", tooltip = "Good article nominee", link = false, }, ga2 = { image = "Symbol neutral vote.svg", tooltip = "Good article, 2nd opinion", link = false, }, gah = { image = "Symbol wait.svg", tooltip = "Good article on hold", link = false, }, fgan = { aliases = {"noga", "gaf", "gf"}, image = "Symbol oppose vote.svg", tooltip = "Failed good article nominee", link = false, }, fp = { image = "Cscr-featured.svg", tooltip = "Featured picture", link = true, }, fpc = { aliases = {"fpn"}, image = "Cscr-candidate.svg", tooltip = "Featured picture candidate", link = true, }, ffp = { image = "Cscr-former.svg", tooltip = "Former featured picture", link = true, }, vp = { image = "ENWP VP Logo.svg", tooltip = "Valued picture", link = true, }, vpc = { image = "Valued pics 1.svg", tooltip = "Valued picture candidate", link = true, }, fs = { image = "Cscr-featured.svg", tooltip = "Featured sound", link = true, }, ffs = { image = "Cscr-former.svg", tooltip = "Former featured sound", link = true, }, fsc = { image = "Cscr-candidate.svg", tooltip = "Featured sound candidate", link = true, }, fpo = { image = "Linecons big-star.svg", tooltip = "Before the featured portal process ceased in 2017, this had been designated as a featured portal.", link = true, }, fpor = { image = "Cscr-star piece.png", tooltip = "Featured portal review", link = true, }, ffpo = { image = "Featured article star - cross.svg", tooltip = "Former featured portal", link = true, }, fpoc = { image = "Cscr-candidate.svg", tooltip = "Featured portal candidate", link = true, }, ft = { image = "Cscr-featuredtopic.svg", tooltip = "Featured topic", link = true, }, ftrc = { image = "Cscr-star piece.png", tooltip = "Featured topic removal candidate", link = true, }, fft = { aliases = {"dft"}, image = "DFT candidate_cluster.svg", tooltip = "Former featured topic", link = true, }, ftc = { aliases = {"ftn"}, image = "FT candidate cluster.svg", tooltip = "Featured topic candidate", link = false, }, gt = { image = "Support cluster.svg", tooltip = "Good topic", link = false, }, gtrc = { image = "Symbol unsupport vote.svg", tooltip = "Good topic removal candidate", link = false, }, gtc = { aliases = {"gtn"}, image = "GA candidate cluster.svg", tooltip = "Good topic candidate", link = false, }, bplus = { aliases = {"b+"}, image = "Symbol bplus class.svg", tooltip = "Bplus-Class article", link = true, }, b = { image = "Symbol b class.svg", tooltip = "B-Class article", link = true, }, br = { aliases = {"bcr"}, image = "Bclass-checklist.svg", tooltip = "B-Class review", link = true, }, c = { image = "Symbol c class.svg", tooltip = "C-Class article", link = true, }, start = { image = "Symbol start class.svg", tooltip = "Start-Class article", link = true, }, stub = { image = "Symbol stub class.svg", tooltip = "Stub-Class article", link = true, }, list = { aliases = {"comparison"}, image = "Symbol list class.svg", tooltip = "List-Class article", link = false, }, no = { image = "Crystal button cancel.svg", tooltip = "Unknown-Class article", link = true, }, book = { image = "Symbol book class2.svg", tooltip = "Wikipedia book", 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 = "Symbol file class.svg", tooltip = "File", link = true, }, needed = { image = "Symbol needed class.svg", tooltip = "Needed article", link = false, }, outline = { image = "Global thinking.svg", tooltip = "Outline", 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, }, na = { image = "Symbol na class.svg", tooltip = "Non-article page", link = true, }, aa = { image = "Yes check.svg", tooltip = "Audited article of limited subject matter", link = false, }, da = { image = "Symbol oppose vote.svg", tooltip = "Demoted article", link = false, }, dyk = { image = "Symbol question.svg", tooltip = "Did You Know?", link = false, }, dyk2 = { image = "DYK questionmark icon.svg", tooltip = "Did You Know?", link = false, }, pr = { image = "Nuvola apps kedit.png", tooltip = "Peer review", link = true, }, ppr = { image = "Nuvola apps kedit.png", tooltip = "Portal peer review", link = true, }, q = { aliases = {"question"}, image = "Symbol question.svg", tooltip = "Question", link = false, }, cleanup = { image = "Edit-clear.svg", tooltip = "Cleanup work", link = false, }, qi = { image = "Quality images logo.svg", tooltip = "Quality image on Wikimedia Commons", link = false, }, vi = { image = "Valued image seal.svg", tooltip = "Valued image on Wikimedia Commons", link = false, }, tfa = { image = "Wikipedia-logo.svg", tooltip = "Today's Featured Article", link = true, }, tfl = { image = "Wikipedia-logo.svg", tooltip = "Today's Featured List", link = true, }, itn = { image = "Globe current.svg", tooltip = "In The News", link = true, }, otd = { image = "Nuvola apps date.svg", tooltip = "On This Day", link = true, }, wikiproject = { image = "People icon.svg", tooltip = "WikiProject", link = false, }, goce = { image = "Writing Magnifying.PNG", tooltip = "Guild of Copy Editors", link = true, }, wikipedia = { image = "Wikipedia-logo.svg", tooltip = "Wikipedia page", link = true, }, commons = { image = "Commons-logo.svg", tooltip = "Commons page", link = false, }, wikiquote = { image = "Wikiquote-logo.svg", tooltip = "Wikiquote page", link = false, }, wikiversity = { image = "Wikiversity logo 2017.svg", tooltip = "Wikiversity page", link = true, }, wikibooks = { image = "Wikibooks-logo.svg", tooltip = "Wikibooks page", link = true, }, wikisource = { image = "Wikisource-logo.svg", tooltip = "Wikisource page", link = true, }, wiktionary = { image = "Wiktionary-logo.svg", tooltip = "Wiktionary page", link = true, }, wikinews = { image = "Wikinews-logo.svg", tooltip = "Wikinews page", link = true, }, wikispecies = { image = "Wikispecies-logo.svg", tooltip = "Wikispecies page", link = true, }, wikidata = { image = "Wikidata-logo.svg", tooltip = "Wikidata page", link = false, }, wikivoyage = { image = "Wikivoyage-logo.svg", tooltip = "Wikivoyage page", link = true, }, mediawiki = { image = "MediaWiki-2020-icon.svg", tooltip = "MediaWiki", link = false, }, phabricator = { aliases = {"phab"}, image = "Favicon-Phabricator-WM.svg", tooltip = "Phabricator", link = false, }, wikitech = { image = "Wikitech-2021-blue-icon.svg", tooltip = "Wikitech", link = false, }, meta = { image = "Wikimedia Community Logo.svg", tooltip = "Meta-wiki page", link = false, }, four = { aliases = {"4a"}, image = "Four Award.svg", tooltip = "Four Award", link = false, }, million = { image = "Million award logo.svg", tooltip = "Million Award", link = true, }, module = { image = "Lua-logo-nolabel.svg", tooltip = "Module", link = false, }, vital = { image = "Círculos_Concéntricos.svg", tooltip = "Vital article", link = false, }, potd = { image = "Wikipedia-logo.svg", tooltip = "Picture of the Day", link = true, }, _DEFAULT = { image = "Symbol question.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