Module:Portal bar/sandbox: Difference between revisions

Content deleted Content added
self rv 1 edit, cc-by-sa requires this noise
revert to old version for testing
Line 5:
local p = {}
 
local buildNavbox = require( 'Module:Navbox' )._navbox
local getImageName = require( 'Module:Portal' ).image
local yesno = require( 'Module:Yesno' )
Line 11 ⟶ 12:
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( 'text-align', 'center' )
:css( 'font-size', '88%' )
:css( 'font-weight', 'bold' )
if yesno( args.border ) == false then
nav
:css( 'padding', '0.1em 1.7em' )
else
nav
:css( 'margin-top', '1em' )
:css( 'border', '1px solid #aaa' )
:css( 'padding', '0.4em 2em' )
:css( 'background', '#fdfdfd' )
end
local list = mw.html.create( 'ul' )
:css( 'margin', '0' )
for _, portal in ipairs( portals ) do
list
Line 41 ⟶ 22:
:wikitext( string.format( '[[File:%s|24x21px]]', getImageName{ portal } ) )
:done()
:tag( 'span' )
:wikitext( string.format( '[[Portal:%s|%s portal]]', portal, portal ) )
: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( nav )
local nav = mw.html.create( 'div' )
:addClass( 'noprint metadata' )
:css( 'margin-topwidth', '1em100%' )
:css( 'text-align', 'center' )
:css( 'padding', '0.1em 1.7em1px' )
:css( 'font-size', '88%' )
:node( list )
)
else
return buildNavbox{
navbar = 'off',
bodyclass = 'noprint',
list1 = tostring( list )
}
end
nav
:node( list )
return tostring( nav )
end