Module:Navboxes: Difference between revisions
From Melvor Idle
Inconvenient (talk | contribs) mNo edit summary |
Inconvenient (talk | contribs) mNo edit summary |
||
Line 20: | Line 20: | ||
local result = '{| class="wikitable" style="margin:auto; clear:both; width: 100%"' | local result = '{| class="wikitable" style="margin:auto; clear:both; width: 100%"' | ||
result = result..'\r\n![[File:Cape_of_Completion_(item).svg|25px|link=Skillcapes]] [[Skillcapes]]' | result = result..'\r\n![[File:Cape_of_Completion_(item).svg|25px|link=Skillcapes]] [[Skillcapes]]' | ||
result = result..'\r\n|-\r\n|'..table.concat(capeList, ' • ') | result = result..'\r\n|-\r\n|style="text-align:center;"|'..table.concat(capeList, ' • ') | ||
result = result..'\r\n|}' | result = result..'\r\n|}' | ||
return result | return result |
Revision as of 11:06, 8 June 2021
Documentation for this module may be created at Module:Navboxes/doc
-- New module to stop navbox generators cluttering other modules
local p = {}
local ItemData = mw.loadData('Module:Items/data')
local Shared = require('Module:Shared')
local Icons = require('Module:Icons')
function p.getSkillcapeNavbox(frame)
local capeList = {}
for i, item in pairs(ItemData.Items) do
if Shared.contains(item.name, 'Skillcape') or item.name == 'Cape of Completion' then
table.insert(capeList, Icons.Icon({item.name, type='item'}))
end
end
table.sort(capeList, function(a,b)
return a < b
end)
local result = '{| class="wikitable" style="margin:auto; clear:both; width: 100%"'
result = result..'\r\n![[File:Cape_of_Completion_(item).svg|25px|link=Skillcapes]] [[Skillcapes]]'
result = result..'\r\n|-\r\n|style="text-align:center;"|'..table.concat(capeList, ' • ')
result = result..'\r\n|}'
return result
end
return p