Module:Portal: Difference between revisions

Content deleted Content added
extend image function to take border argument
reduce surface of plainlist to support templatestyles by using Module:List, remove support for barely-used width parameter (which is bad for mobile)
Line 185:
:attr('role', 'navigation')
:attr('aria-label', 'Portals')
:addClass('noprint plainlist')
:addClass(sandboxVersion('portalbox'))
:addClass(args.border and sandboxVersion('portalborder') or '')
Line 213:
end
 
local formatted_list = {}
-- Start the list. This corresponds to the start of the wikitext table in the old [[Template:Portal]].
local listroot = root:tag('ul')
:css('width', (tonumber(args.boxsize) or 0) > 0 and (args.boxsize .. 'px') or args.boxsize)
 
-- Display the portals specified in the positional arguments.
for _, portal in ipairs(portals) do
table.insert(formatted_list, string.format(
local image = getImageName(portal)
'<span>[[File:%s|32x28px|class=noviewer]]</span><span>[[Portal:%s|%s%sportal]]</span>',
local image = getImageName(portal),
portal,
portal,
args.addBreak and '<br />' or ' '
))
end
local list = require('Module:List').unbulleted(formatted_list)
 
return tostring(root:wikitext(list))
-- Generate the html for the image and the portal name.
listroot
:newline()
:tag('li')
:tag('span')
:wikitext(string.format('[[File:%s|32x28px|class=noviewer]]', image))
:done()
:tag('span')
:wikitext(string.format('[[Portal:%s|%s%sportal]]', portal, portal, args.addBreak and '<br />' or ' '))
end
return tostring(root)
end