Модуль:Portal: відмінності між версіями

[неперевірена версія][неперевірена версія]
Вилучено вміст Додано вміст
мНемає опису редагування
Немає опису редагування
Рядок 3:
local p = {}
local HtmlBuilder = require('Модуль:HtmlBuilder')
local HtmlError = require('Модуль:Error')
 
Рядок 9 ⟶ 8:
local function _portal(args)
 
local root = HtmlBuildermw.html.create('div')
. :addClass('noprint portal')
:addClass(args.left and 'tleft' or 'tright')
root
. :css('border', 'solid #aaa 1px')
.addClass('noprint')
:css('margin', args.margin or .addClass((args.left == 'yes' and 'tleft0.5em 1em 0.5em 0') or 'tright0.5em 0 0.5em 1em')
. :newline()
.addClass('portal')
.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')
.newline()
 
-- Start the table. This corresponds to the start of the wikitext table in the old [[Template:Portal]].
local tableroot = root.:tag('table')
-- in the old [[Template:Portal]].
:css('background', '#f9f9f9')
local tableroot = root.tag('table')
. :css('backgroundfont-size', '#f9f9f985%')
. :css('fontline-sizeheight', '85110%')
. :css('linemax-heightwidth', '110%175px')
. :css('width', type(args.boxsize) == 'string' and (args.boxsize .. 'px') or nil)
.css('max-width', '175px')
.css('width', args.boxsize and (args.boxsize .. 'px'))
-- If no portals have been specified, display an error and add the page to a tracking category.
if not argsportals[1] then
tableroot:wikitext('<strong class="error">No portals specified: please specify at least one portal</strong>[[Category:Portal templates without a parameter]]')
tableroot.wikitext(
end
tostring(HtmlError.error{'Не вибрано порталів: будь ласка, вкажіть хоча б один'})
.. '[[Категорія:Шаблони порталів без параметра]]'
)
end
 
-- Display the portals specified in the positional arguments.
Рядок 61 ⟶ 53:
-- Generate the html for the image and the portal name.
tableroot
. :newline()
. :tag('tr')
.attr :css('valignvertical-align', 'middle')
. :tag('td')
. :css('text-align', 'center')
. :wikitext(string.format('[[ФайлFile:' .. imagename .. '%s|32x28px|alt=ЗначокPortal порталуicon|class=noviewer]]', image))
. :done()
. :tag('td')
. :css('padding', '0 0.2em')
. :css('vertical-align', 'middle')
. :css('font-style', 'italic')
. :css('font-weight', 'bold')
:wikitext(string.wikitextformat('[[ПорталPortal:%s|%s%sportal]]', ..portal, vportal, .. '|Портал' .. ((args['break'] == 'yes' and '<br />') or ' ') .. '«' .. v .. '»]]')
end