Module:Icon/table
From Kenshi Wiki
More actions
This module creates a test case template using data aggregated from Module:Icon/data and Module:Icon/data/sandbox. It is intended to be displayed at Template:Icon/testcases.
Usage
{{#invoke:icon/table|main}}
Output
| Icon | Description | Code | Aliases |
|---|---|---|---|
| File:Symbol a class.svg | A-Class article | {{icon|a}}
|
|
| Audited article of limited subject matter | {{icon|aa}}
|
||
| File:A candidate.svg | A-Class article candidate | {{icon|acc}}
|
aac, acn
|
| File:Wikipedia Administrator.svg | Administrator | {{icon|admin}}
|
mop
|
| File:OOjs UI icon alert.svg | Black alert | {{icon|alert}}
|
|
| File:OOjs UI icon alert destructive black-darkred.svg | Black, white, and red alert | {{icon|alert-blackred}}
|
|
| File:OOjs UI icon alert-constructive.svg | Green alert | {{icon|alert-constructive}}
|
|
| File:OOjs UI icon alert image warning.svg | Alert | {{icon|alert-imagewarning}}
|
|
| File:Symbol b class.svg | B-Class article | {{icon|b}}
|
|
| File:Original Barnstar.png | Original barnstar | {{icon|barnstar}}
|
|
| File:Original Barnstar Hires.svg | Original barnstar hires | {{icon|barnstar2}}
|
|
| File:Symbol book class2.svg | Wikipedia book | {{icon|book}}
|
|
| File:Symbol bplus class.svg | Bplus-Class article | {{icon|bplus}}
|
b+
|
| File:Bclass-checklist.svg | B-Class review | {{icon|br}}
|
bcr
|
| File:Symbol c class.svg | C-Class article | {{icon|c}}
|
|
| Category | {{icon|category}}
|
cat, categ
| |
| Cleanup work | {{icon|cleanup}}
|
||
| File:Commons-logo.svg | Commons page | {{icon|commons}}
|
|
| File:Symbol oppose vote.svg | Demoted article | {{icon|da}}
|
|
| File:Symbol unsupport A vote.svg | Demoted A-Class article | {{icon|dac}}
|
daa
|
| File:Symbol unsupport vote.svg | Delisted good article | {{icon|dga}}
|
|
| File:Symbol dab class.svg | Disambiguation page | {{icon|disambiguation}}
|
dab, disamb, disambig
|
| File:Echo edit-user-talk icon.svg | Discussion | {{icon|discussionnotificaion}}
|
|
| File:Symbol draft class.svg | Draft-Class article | {{icon|draft}}
|
|
| Did You Know? | {{icon|dyk}}
|
||
| Did You Know? | {{icon|dyk2}}
|
||
| Essay | {{icon|essay}}
|
||
| File:Featured article star.svg | Featured article | {{icon|fa}}
|
|
| File:Cscr-candidate.svg | Featured article candidate | {{icon|fac}}
|
fan
|
| File:Cscr-star piece.png | Featured article review | {{icon|far}}
|
|
| File:Cscr-star piece.png | Featured article removal candidate | {{icon|farc}}
|
|
| File:Featured article star - cross.svg | Former featured article | {{icon|ffa}}
|
dfa
|
| File:Cscr-former.svg | Former featured article candidate | {{icon|ffac}}
|
nofa
|
| File:Cscr-featured-strike.svg | Former featured list | {{icon|ffl}}
|
dfl
|
| File:Cscr-former.svg | Former featured list candidate | {{icon|fflc}}
|
nofl
|
| File:Cscr-former.svg | Former featured picture | {{icon|ffp}}
|
|
| File:Featured article star - cross.svg | Former featured portal | {{icon|ffpo}}
|
|
| File:Cscr-former.svg | Former featured sound | {{icon|ffs}}
|
|
| File:DFT candidate cluster.svg | Former featured topic | {{icon|fft}}
|
dft
|
| File:Symbol oppose vote.svg | Failed good article nominee | {{icon|fgan}}
|
gaf, gf, noga
|
| File:Featured article star.svg | Featured list | {{icon|fl}}
|
|
| File:Cscr-candidate.svg | Featured list candidate | {{icon|flc}}
|
fln
|
| File:Cscr-star piece.png | Featured list removal candidate | {{icon|flrc}}
|
flr
|
| File:Four Award.svg | Four Award | {{icon|four}}
|
4a
|
| File:Cscr-featured.svg | Featured picture | {{icon|fp}}
|
|
| File:Cscr-candidate.svg | Featured picture candidate | {{icon|fpc}}
|
fpn
|
| File:Linecons big-star.svg | Before the featured portal process ceased in 2017, this had been designated as a featured portal. | {{icon|fpo}}
|
|
| File:Cscr-candidate.svg | Featured portal candidate | {{icon|fpoc}}
|
|
| File:Cscr-star piece.png | Featured portal review | {{icon|fpor}}
|
|
| File:Cscr-featured.svg | Featured sound | {{icon|fs}}
|
|
| File:Cscr-candidate.svg | Featured sound candidate | {{icon|fsc}}
|
|
| File:Cscr-featuredtopic.svg | Featured topic | {{icon|ft}}
|
|
| File:FT candidate cluster.svg | Featured topic candidate | {{icon|ftc}}
|
ftn
|
| File:Cscr-star piece.png | Featured topic removal candidate | {{icon|ftrc}}
|
|
| File:Symbol support vote.svg | Good article | {{icon|ga}}
|
|
| File:Symbol neutral vote.svg | Good article, 2nd opinion | {{icon|ga2}}
|
|
| Good article on hold | {{icon|gah}}
|
||
| File:GA candidate.svg | Good article nominee | {{icon|gan}}
|
gac
|
| File:GA Candidate Neutral vote(ChaosNil).svg | Good article reassessment | {{icon|gar}}
|
|
| File:Writing Magnifying.PNG | Guild of Copy Editors | {{icon|goce}}
|
|
| File:Support cluster.svg | Good topic | {{icon|gt}}
|
|
| File:GA candidate cluster.svg | Good topic candidate | {{icon|gtc}}
|
gtn
|
| File:Symbol unsupport vote.svg | Good topic removal candidate | {{icon|gtrc}}
|
|
| File:Symbol file class.svg | File | {{icon|image}}
|
file
|
| Information | {{icon|info}}
|
||
| File:Globe current.svg | In The News | {{icon|itn}}
|
|
| File:Symbol list class.svg | List-Class article | {{icon|list}}
|
comparison
|
| MediaWiki | {{icon|mediawiki}}
|
||
| File:Wikimedia Community Logo.svg | Meta-wiki page | {{icon|meta}}
|
|
| File:Million award logo.svg | Million Award | {{icon|million}}
|
|
| Module | {{icon|module}}
|
||
| File:Symbol na class.svg | Non-article page | {{icon|na}}
|
|
| File:Symbol needed class.svg | Needed article | {{icon|needed}}
|
|
| File:Crystal button cancel.svg | Unknown-Class article | {{icon|no}}
|
|
| File:Symbol unsupport A vote.svg | Failed A-Class article candidate | {{icon|noac}}
|
faac
|
| File:Nuvola apps date.svg | On This Day | {{icon|otd}}
|
|
| File:Global thinking.svg | Outline | {{icon|outline}}
|
|
| File:Favicon-Phabricator-WM.svg | Phabricator | {{icon|phabricator}}
|
phab
|
| File:Symbol portal class.svg | Portal | {{icon|portal}}
|
|
| File:Wikipedia-logo.svg | Picture of the Day | {{icon|potd}}
|
|
| File:Nuvola apps kedit.png | Portal peer review | {{icon|ppr}}
|
|
| File:Nuvola apps kedit.png | Peer review | {{icon|pr}}
|
|
| File:Symbol project class.svg | Project page | {{icon|project}}
|
|
| Question | {{icon|q}}
|
question
| |
| File:Quality images logo.svg | Quality image on Wikimedia Commons | {{icon|qi}}
|
|
| File:Symbol redirect vote2.svg | Redirect | {{icon|redirect}}
|
red, redir
|
| File:Symbol start class.svg | Start-Class article | {{icon|start}}
|
|
| File:Symbol stub class.svg | Stub-Class article | {{icon|stub}}
|
|
| File:Symbol template class pink.svg | Template | {{icon|template}}
|
temp, templ
|
| File:Wikipedia-logo.svg | Today's Featured Article | {{icon|tfa}}
|
|
| File:Wikipedia-logo.svg | Today's Featured List | {{icon|tfl}}
|
|
| File:Symbol user class.svg | User-Class article | {{icon|user}}
|
|
| File:Valued image seal.svg | Valued image on Wikimedia Commons | {{icon|vi}}
|
|
| File:Círculos Concéntricos.svg | Vital article | {{icon|vital}}
|
|
| File:ENWP VP Logo.svg | Valued picture | {{icon|vp}}
|
|
| File:Valued pics 1.svg | Valued picture candidate | {{icon|vpc}}
|
|
| File:Wikibooks-logo.svg | Wikibooks page | {{icon|wikibooks}}
|
|
| File:Wikidata-logo.svg | Wikidata page | {{icon|wikidata}}
|
|
| File:Wikinews-logo.svg | Wikinews page | {{icon|wikinews}}
|
|
| File:Wikipedia-logo.svg | Wikipedia page | {{icon|wikipedia}}
|
|
| File:People icon.svg | WikiProject | {{icon|wikiproject}}
|
|
| File:Wikiquote-logo.svg | Wikiquote page | {{icon|wikiquote}}
|
|
| File:Wikisource-logo.svg | Wikisource page | {{icon|wikisource}}
|
|
| File:Wikispecies-logo.svg | Wikispecies page | {{icon|wikispecies}}
|
|
| File:Wikitech-2021-blue-icon.svg | Wikitech | {{icon|wikitech}}
|
|
| File:Wikiversity logo 2017.svg | Wikiversity page | {{icon|wikiversity}}
|
|
| File:Wikivoyage-logo.svg | Wikivoyage page | {{icon|wikivoyage}}
|
|
| File:Wiktionary-logo.svg | Wiktionary page | {{icon|wiktionary}}
|
-- Create a table of icons to display on the template test case page
require('strict')
local p = {}
local m_iconData = mw.loadData("Module:Icon/data")
local m_iconSandboxData = mw.loadData("Module:Icon/data/sandbox")
local function mergeTables(...)
local ret = {}
for _, t in ipairs{...} do
for k, v in pairs(t) do
ret[k] = v
end
end
return ret
end
local function reconstituteAliases(iconDataCollection)
local ret = {}
for code, iconData in pairs(iconDataCollection) do
local outputData = ret[iconData.canonicalCode] or {
aliases = {},
image = iconData.image,
tooltip = iconData.tooltip,
link = iconData.link,
}
if code ~= iconData.canonicalCode then
table.insert(outputData.aliases, code)
end
ret[iconData.canonicalCode] = outputData
end
return ret
end
local function makeTableData(iconDataCollection)
local ret = {}
for code, iconData in pairs(reconstituteAliases(iconDataCollection)) do
if code ~= '_DEFAULT' then
table.insert(ret, {code = code, description = iconData.tooltip, aliases = iconData.aliases})
end
end
table.sort(
ret,
function(t1, t2)
return t1.code < t2.code
end
)
for _, t in ipairs(ret) do
table.sort(t.aliases)
end
return ret
end
function p.testcases(frame)
local tableData = makeTableData(mergeTables(m_iconData, m_iconSandboxData))
local ret = {
'{| class="wikitable sortable"',
'! Code',
'! [[Template:Icon|Template]]',
'! [[Template:Icon/sandbox|Sandbox]]',
'! Description',
}
local function addRow(code, description)
table.insert(ret, '|-')
table.insert(ret, '| <code>' .. mw.text.nowiki('{{icon|' .. code .. '}}') .. '</code>')
table.insert(ret, '| style="text-align: center" | ' .. frame:expandTemplate{title = 'icon', args = {code}})
table.insert(ret, '| style="text-align: center" | ' .. frame:expandTemplate{title = 'icon/sandbox', args = {code}})
table.insert(ret, '| ' .. description)
end
for _, rowData in ipairs(tableData) do
addRow(rowData.code, rowData.description)
for _, alias in ipairs(rowData.aliases) do
addRow(alias, rowData.description)
end
end
table.insert(ret, '|}')
return table.concat(ret, '\n')
end
function p.main(frame)
local tableData = makeTableData(m_iconData)
local ret = {
'{| class="wikitable sortable"',
'! Icon',
'! Description',
'! Code',
'! Aliases'
}
for _, rowData in ipairs(tableData) do
table.insert(ret, '|-')
table.insert(ret, '| style="text-align: center" | ' .. frame:expandTemplate{title = 'icon', args = {rowData.code}})
table.insert(ret, '| ' .. rowData.description)
table.insert(ret, '| <code>' .. mw.text.nowiki('{{icon|' .. rowData.code .. '}}') .. '</code>')
local aliasText = {}
for _, alias in ipairs(rowData.aliases) do
table.insert(aliasText, '<code>' .. alias .. '</code>')
end
table.insert(ret, '| ' .. table.concat(aliasText, ', '))
end
table.insert(ret, '|}')
return table.concat(ret, '\n')
end
return p