Module:Portal bar/sandbox: Difference between revisions

Content deleted Content added
single related boolean
better implementation of nbsp
 
(19 intermediate revisions by 4 users not shown)
Line 1:
-- This module implements {{portal bar}}.
 
require('Module:No globalsstrict')
 
-- determine whether we're being called from a sandbox
Line 49:
end
 
local headerrelated = nav:tagyesno('span'args.related)
if not isRelatedrelated then
header:addClass(sandboxVersion('portal-bar-header'))
nav:addClass(sandboxVersion('portal-bar-related'))
local isRelated = yesno(args.related)
else
if not isRelated then
local header = nav:tag('span')
header:addClass(sandboxVersion('portal-bar-header'))
header:wikitext('[[Wikipedia:Contents/Portals|Portal]]')
if #portals > 1 then
Line 59 ⟶ 61:
header:wikitext(':')
end
local container = nav:tag('divul')
container:addClass(sandboxVersion('portal-bar-content'))
if related then
local size = isRelated and '33x30px' or '21x19px'
container:addClass(sandboxVersion('portal-bar-logo'..content-related'))
local related = isRelated and '-related' or ''
end
local size = isRelatedrelated and '33x30px27x25px' or '21x19px'
for _, portal in ipairs( portals ) do
container
:tag( 'divli' )
:addClass(sandboxVersion('portal-bar-item'..related))
:wikitext( string.format('<span class="nowrap">[[File:%s|%s]] </span>[[Portal:%s|%s]]', portal, portal))
:tag( 'span' )
'[[File:%s|%s]]', getImageName(portal,true), size, portal, portal))
:addClass(sandboxVersion('portal-bar-logo'..related))
:wikitext( string.format(
'[[File:%s|%s]]', getImageName(portal,true), size
) )
:done()
:tag('span')
:addClass(sandboxVersion('portal-bar-link'..related))
:wikitext( string.format('[[Portal:%s|%s]]', portal, portal))
end