Module:Portal bar/sandbox: Difference between revisions

Content deleted Content added
revert to old version for testing
readding navbox class
Line 5:
local p = {}
 
local buildNavbox = require( 'Module:Navbox' )._navbox
local getImageName = require( 'Module:Portal' ).image
local yesno = require( 'Module:Yesno' )
Line 12 ⟶ 11:
function p._main( portals, args )
if #portals < 1 then return '' end -- Don't display a blank navbox if no portals were specified.
local nav = mw.html.create( 'div' )
:addClass( 'noprint metadata' )
:attr( 'role', 'navigation' )
:attr( 'aria-label' , 'Portals' )
:css( 'font-weight', 'bold' )
if yesno( args.border ) == false then
nav
:css( 'padding', '1px0.1em 1.7em' )
else
nav
:addClass( 'navbox' )
:css( 'widthpadding', '100%0.4em 2em' )
end
local list = mw.html.create( 'ul' )
:css( 'font-sizemargin', '88%0' )
for _, portal in ipairs( portals ) do
list
Line 22 ⟶ 37:
:wikitext( string.format( '[[File:%s|24x21px]]', getImageName{ portal } ) )
:done()
:wikitext( string.format( '[[Portal:%s|%s portal]]', portal, portal ) )
:tag( 'span' )
:css( 'font-weight', 'bold' )
:wikitext( string.format( '[[Portal:%s|%s portal]]', portal, portal ) )
end
if yesno( args.border ) == false then -- Don't display a border if args.border is "no", "n", "false", 0 or false.
return tostring(
mw.html.create( 'div' )
:addClass( 'noprint metadata' )
:css( 'width', '100%' )
:css( 'text-align', 'center' )
:css( 'padding', '1px' )
:css( 'font-size', '88%' )
:node( list )
)
else
return buildNavbox{
navbar = 'off',
bodyclass = 'noprint',
list1 = tostring( list )
}
end
nav
:node( list )
return tostring( nav )
end