}
function p.site(argsframe)
local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template: SiteListTopSiteList'}) ▼
local site = getSite(args.site)
end
local result = ''string.format(
'|-\n| style="%s" | %s\n| style="text-align:center;vertical-align:middle;" | %s%s\n| style="text-align:center;vertical-align:middle;" | %s\n| style="text-align:center;vertical-align:middle;" | %s\n| style="width: 0px; padding: 0px; border: none;" |\n', ▼
siteType = siteType and siteType:gsub("^%l", string.upper) or 'Website', ▼
local ns = mw.title.getCurrentTitle().namespace
if ns == 0 then
end
return {result
style = style,
▲ siteType = siteType and siteType:gsub("^%l", string.upper) or 'Website',
linkOrLabel = linkOrLabel,
categoryLink = categoryLink,
alias = alias,
notes = notes,
additionalInfo = result
else
return string.format('|-\n| colspan="4" style="text-align:center;vertical-align:middle;color:red;font-weight:bold;" | Error: invalid site parameter: %s. See [[PBC:SiteList|PBC:SiteList for documentation]] \n| style="width: 0px; padding: 0px; border: none;" |\n', args.site)
return nil
end
end
function p.siteList(frame)
▲ local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:SiteListTop'})
local sites = {}
for i, site in ipairs(args.list) do
if site then -- Проверяем, что элемент не равен nil
local siteData = p.site({site = site, id = args.id, sceneid = args.sceneid, alias = args.alias, notes = args.notes})
if siteData then
table.insert(sites, siteData)
end
end
end
-- Сортируем массив сайтов по linkOrLabel
table.sort(sites, function(a, b) return a.linkOrLabel < b.linkOrLabel end)
-- Создаем итоговую строку
local result = ''
for _, site in ipairs(sites) do
result = result .. string.format(
▲ '|-\n| style="%s" | %s\n| style="text-align:center;vertical-align:middle;" | %s%s\n| style="text-align:center;vertical-align:middle;" | %s\n| style="text-align:center;vertical-align:middle;" | %s\n| style="width: 0px; padding: 0px; border: none;" |\n',
site.siteType,
) .. site.additionalInfo
end
return result
end
|