Module:Infobox: Difference between revisions

1,579 bytes removed ,  23 March
Remove the bottomlinks feature - disabled in 100% of RSC/OSRS Templates and 75% of RS3 templates
(Simplify the table_class param)
(Remove the bottomlinks feature - disabled in 100% of RSC/OSRS Templates and 75% of RS3 templates)
Line 168:
infoboxname = nil, -- template name
appendStrs = {},
bottomlinks = { -- template bottom links
links = {
{ 'Template talk:%s', 'talk' },
{ 'Template:%s', 'view' }
},
colspan = 2
},
catdata = {}, -- meta category data
catlist = {}, -- defined table of category names (strings)
Line 295 ⟶ 288:
end
 
-- Defines the bottom links of the infobox
-- pass a table whose elements are tables that define a link and a label
-- {
-- { 'link', 'label },
-- ...
-- }
-- The template name can be substituted into the tables using '%s'
-- If we wanted Template:InFooBar to link to it's /doc page with a "doc" label:
-- { ...
-- { 'Template:%s/doc', 'doc' },
-- ... }
-- The template's name can only be called 5 times
function Infobox:defineLinks(arg)
if type(arg) == 'table' then
if arg.colspan then
self.bottomlinks.colspan = arg.colspan
end
if arg.links then
if type(arg.links) == 'table' then
self.bottomlinks.links = arg.links
end
end
if arg.hide then
self.bottomlinks.hide = arg.hide
end
end
end
 
-- Change max number of buttons before switching to menu
Line 1,019 ⟶ 985:
 
-- Add view and talk links to infobox
-- Only done if a name is defined
if self.infoboxname and not self.bottomlinks.hide then
local bottom_links = {}
for _, v in ipairs(self.bottomlinks.links) do
table.insert(bottom_links,
string.format(
table.concat({'[[',
v[1],
'|',
v[2],
']]'}),
self.infoboxname,
self.infoboxname,
self.infoboxname,
self.infoboxname,
self.infoboxname)
)
end
 
bottom_links = table.concat(bottom_links,' • ')
self.rtable:tag('tr'):tag('td')
:addClass('infobox-template-links')
:attr('colspan', self.bottomlinks.colspan)
:wikitext(bottom_links)
:done()
end
-- Define as finished
self.__finished = true