<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="uk">
	<id>https://wiki.nuwm.edu.ua/index.php?action=history&amp;feed=atom&amp;title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%3APortal</id>
	<title>Модуль:Portal - Історія редагувань</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.nuwm.edu.ua/index.php?action=history&amp;feed=atom&amp;title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%3APortal"/>
	<link rel="alternate" type="text/html" href="https://wiki.nuwm.edu.ua/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Portal&amp;action=history"/>
	<updated>2026-05-13T04:18:29Z</updated>
	<subtitle>Історія редагувань цієї сторінки в вікі</subtitle>
	<generator>MediaWiki 1.36.0</generator>
	<entry>
		<id>https://wiki.nuwm.edu.ua/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Portal&amp;diff=1900&amp;oldid=prev</id>
		<title>Олександр Юрійович Старовєров: 1 версія</title>
		<link rel="alternate" type="text/html" href="https://wiki.nuwm.edu.ua/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Portal&amp;diff=1900&amp;oldid=prev"/>
		<updated>2015-09-17T08:10:08Z</updated>

		<summary type="html">&lt;p&gt;1 версія&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Нова сторінка&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Модуль для реалізації {{Портал}}&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
 &lt;br /&gt;
local HtmlError = require('Модуль:Error')&lt;br /&gt;
&lt;br /&gt;
-- This function generates the html code.&lt;br /&gt;
local function _portal(args)&lt;br /&gt;
&lt;br /&gt;
	local root = mw.html.create('div')&lt;br /&gt;
		:addClass('noprint portal')&lt;br /&gt;
		:addClass(args.left and 'tleft' or 'tright')&lt;br /&gt;
		:css('border', 'solid #aaa 1px')&lt;br /&gt;
		:css('margin', args.margin or (args.left == 'yes' and '0.5em 1em 0.5em 0') or '0.5em 0 0.5em 1em')&lt;br /&gt;
		:newline()&lt;br /&gt;
&lt;br /&gt;
	-- Start the table. This corresponds to the start of the wikitext table in the old [[Template:Portal]].&lt;br /&gt;
	local tableroot = root:tag('table')&lt;br /&gt;
		:css('background', '#f9f9f9')&lt;br /&gt;
		:css('font-size', '85%')&lt;br /&gt;
		:css('line-height', '110%')&lt;br /&gt;
		:css('max-width', '175px')&lt;br /&gt;
		:css('width', type(args.boxsize) == 'string' and (args.boxsize .. 'px') or nil)&lt;br /&gt;
    &lt;br /&gt;
    -- If no portals have been specified, display an error and add the page to a tracking category.&lt;br /&gt;
	if not args[1] then&lt;br /&gt;
		tableroot:wikitext('&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;No portals specified: please specify at least one portal&amp;lt;/strong&amp;gt;[[Category:Portal templates without a parameter]]')&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    -- Display the portals specified in the positional arguments.&lt;br /&gt;
    for i,v in ipairs(args) do&lt;br /&gt;
        v = mw.ustring.match(v, '^%s*(.*%S)') or ''  -- Trim whitespace.&lt;br /&gt;
        &lt;br /&gt;
        -- Portal image names are stored in subtemplates of [[Шаблон:Портал/Зображення]].&lt;br /&gt;
        -- The name of the subtemplate is the portal name in all lower case, but with&lt;br /&gt;
        -- the first character in upper case.&lt;br /&gt;
        &lt;br /&gt;
        -- Work out the image subtemplate location.&lt;br /&gt;
        local lang = mw.getContentLanguage()&lt;br /&gt;
        local imagetemplatename = 'Портал/Зображення/' .. lang:ucfirst(lang:lc(v))&lt;br /&gt;
&lt;br /&gt;
        -- Check the image template name. We need three checks: 1) check with pcall to see if&lt;br /&gt;
        -- we are over the expensive function call limit; 2) check if the proposed image template&lt;br /&gt;
        -- name uses invalid characters (mw.title.new returns nil if this is the case); and 3) &lt;br /&gt;
        -- check if the image subtemplate exists.&lt;br /&gt;
        local goodtitlecall, imagetemplateobject = pcall(mw.title.new, imagetemplatename, 'Шаблон')&lt;br /&gt;
        if not (goodtitlecall and imagetemplateobject and imagetemplateobject.exists) then&lt;br /&gt;
            imagetemplatename = 'Портал/Зображення/За замовчуванням'&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        -- Expand the image subtemplate to get the image name&lt;br /&gt;
        local imagename = mw.getCurrentFrame():expandTemplate{ title = imagetemplatename }&lt;br /&gt;
            &lt;br /&gt;
        -- Generate the html for the image and the portal name.&lt;br /&gt;
		tableroot&lt;br /&gt;
			:newline()&lt;br /&gt;
			:tag('tr')&lt;br /&gt;
				:css('vertical-align', 'middle')&lt;br /&gt;
				:tag('td')&lt;br /&gt;
					:css('text-align', 'center')&lt;br /&gt;
					:wikitext('[[Файл:' .. imagename .. '|32x28px|alt=Значок порталу]]')&lt;br /&gt;
					:done()&lt;br /&gt;
				:tag('td')&lt;br /&gt;
					:css('padding', '0 0.2em')&lt;br /&gt;
					:css('vertical-align', 'middle')&lt;br /&gt;
					:css('font-style', 'italic')&lt;br /&gt;
					:css('font-weight', 'bold')&lt;br /&gt;
					:wikitext('[[Портал:' .. v .. '|Портал' .. ((args['break'] == 'yes' and '&amp;lt;br /&amp;gt;') or ' ') .. '«' .. v .. '»]]')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- This function gets the arguments passed to the module and passes them&lt;br /&gt;
-- to the _portal() function above.&lt;br /&gt;
function p.portal(frame)&lt;br /&gt;
    local orig_args&lt;br /&gt;
    if frame == mw.getCurrentFrame() then&lt;br /&gt;
        -- We're being called via #invoke. If the invoking template passed any arguments,&lt;br /&gt;
        -- use them. Otherwise, use the arguments that were passed into the template.&lt;br /&gt;
        orig_args = frame:getParent().args&lt;br /&gt;
        for k, v in pairs(frame.args) do&lt;br /&gt;
            orig_args = frame.args&lt;br /&gt;
            break&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        -- We're being called from another module or from the debug console, so assume&lt;br /&gt;
        -- the arguments are passed in directly.&lt;br /&gt;
        orig_args = frame&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- We want to list all the portals in the order they were passed to the template. &lt;br /&gt;
    -- We also want to be able to deal with positional arguments passed explicitly, &lt;br /&gt;
    -- for example {{portal|2=Politics}}. However, pairs() doesn't guarantee the correct &lt;br /&gt;
    -- order, and ipairs() will stop after the first nil value. To get around this, we &lt;br /&gt;
    -- create a new table of arguments where nil values have been removed, so that we &lt;br /&gt;
    -- can traverse the numerical arguments using ipairs(). We also remove values which &lt;br /&gt;
    -- only consist of whitespace. ParserFunctions considers these to be false, and by&lt;br /&gt;
    -- removing them Lua will consider them false too.&lt;br /&gt;
    &lt;br /&gt;
    local args = {} -- Arguments table.&lt;br /&gt;
    local name_args = {} -- Temporary table for named arguments.&lt;br /&gt;
    for k, v in pairs(orig_args) do&lt;br /&gt;
        if mw.ustring.match(v, '%S') then -- Remove values that are only whitespace.&lt;br /&gt;
            if type(k) == 'number' then&lt;br /&gt;
                table.insert(args, k) -- Put positional argument keys into the arguments table so we can sort them.&lt;br /&gt;
            else&lt;br /&gt;
                -- Put named argument values in their own table while we sort the positional arguments,&lt;br /&gt;
                -- so that we don't have to cycle through all the original arguments again.&lt;br /&gt;
                name_args[k] = v &lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    table.sort(args) -- Sort the positional argument keys into numerical order.&lt;br /&gt;
    for i,v in ipairs(args) do&lt;br /&gt;
        args[i] = orig_args[v] -- Replace positional argument keys with their corresponding values.&lt;br /&gt;
    end&lt;br /&gt;
    for k,v in pairs(name_args) do&lt;br /&gt;
        args[k] = v -- Add named arguments to the args table&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return _portal(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Олександр Юрійович Старовєров</name></author>
	</entry>
</feed>