మాడ్యూల్:Portal: కూర్పుల మధ్య తేడాలు
Content deleted Content added
K.Venkataramana (చర్చ | రచనలు) చి en:Module:Portal నుండి 2 కూర్పులు |
imported>Matt Fitzpatrick semantic navigation region and list instead of table; get alt attributes from /images submodules |
||
పంక్తి 1:
--[==[ This module is a Lua implementation of the old {{Portal}} template. As of August 2013 it is used on nearly 5,000,000 articles.
-- Please take care when updating it! It outputs two functions: p.portal, which generates a
-- produces the image name for an individual portal.
పంక్తి 71:
-- Gets the image name for a given string.
if type(s) ~= 'string' or #s < 1 then
return 'Portal-puzzle.svg|link=|alt='
end
s = mw.ustring.lower(s)
return matchImagePage(s) or matchImagePage(getAlias(s)) or 'Portal-puzzle.svg|link=|alt='
end
పంక్తి 80:
-- This function builds the portal box used by the {{portal}} template.
local root = mw.html.create('div')
:
:attr('aria-label', 'Portals')
:addClass('noprint portal plainlist')
:addClass(args.left and 'tleft' or 'tright')
:css('border', 'solid #aaa 1px')▼
:css('margin', args.margin or (args.left == 'yes' and '0.5em 1em 0.5em 0') or '0.5em 0 0.5em 1em')
▲ :css('border', 'solid #aaa 1px')
:newline()
-- Start the table. This corresponds to the start of the wikitext table in the old [[Template:Portal]].▼
local tableroot = root:tag('table')▼
:css('background', '#f9f9f9')▼
:css('font-size', '85%')▼
:css('line-height', '110%')▼
:css('max-width', '175px')▼
:css('width', type(args.boxsize) == 'string' and (args.boxsize .. 'px') or nil)▼
-- If no portals have been specified, display an error and add the page to a tracking category.
if not portals[1] then
return tostring(root)
end
▲ -- Start the
:css('display', 'table')
:css('box-sizing', 'border-box')
:css('padding', '0.1em')
▲ :css('max-width', '175px')
▲ :css('width', type(args.boxsize) == 'string' and (args.boxsize .. 'px') or nil)
▲ :css('background', '#f9f9f9')
▲ :css('font-size', '85%')
▲ :css('line-height', '110%')
-- Display the portals specified in the positional arguments.
Line 104 ⟶ 112:
-- Generate the html for the image and the portal name.
listroot
:newline()
:tag('
:css('
:tag('
:css('display', 'table-cell')
:css('padding', '0.2em')
:css('vertical-align', 'middle')
:css('text-align', 'center')
:wikitext(string.format('[[File:%s|32x28px
:done()
:tag('
:css('
:css('padding', '0.2em 0.2em 0.2em 0.3em')
:css('vertical-align', 'middle')
▲ :css('font-style', 'italic')
▲ :css('font-weight', 'bold')
:wikitext(string.format('[[Portal:%s|%s%sportal]]', portal, portal, args['break'] and '<br />' or ' '))
end
|