Module:Portal bar/sandbox: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
sync
Jackmcbarn (talk | contribs)
use mw.html
Line 3:
local p = {}
 
local htmlBuilder = require( 'Module:HtmlBuilder' )
local buildNavbox = require( 'Module:Navbox' )._navbox
local getImageName = require( 'Module:Portal' ).image
Line 11 ⟶ 10:
function p._main( portals, args )
if #portals < 1 then return '' end -- Don't display a blank navbox if no portals were specified.
local list = htmlBuildermw.html.create( 'ul' )
for i, portal in ipairs( portals ) do
list
.:tag( 'li' )
.:css( 'display', 'inline' )
.:css( 'white-space', 'nowrap' )
.:tag( 'span' )
.:css( 'margin', 'auto 0.5em' )
.:wikitext( mw.ustring.format( '[[File:%s|24x21px]]', getImageName{ portal } ) )
.:done()
.:tag( 'span' )
.:css( 'font-weight', 'bold' )
.:wikitext( mw.ustring.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.
local root = htmlBuildermw.html.create( 'div' )
root
.:addClass( 'noprint' )
.:addClass( 'metadata' )
.:css( 'width', '100%' )
.:css( 'text-align', 'center' )
.:css( 'padding', '1px' )
.:css( 'font-size', '88%' )
.:wikitext( tostring( list ) )
return tostring( root )
else