Module:SiteList: Difference between revisions

Jump to navigation Jump to search
780 bytes removed ,  23 July 2023
no edit summary
No edit summary
Tag: Reverted
No edit summary
Tag: Manual revert
}
 
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',
site.style,
siteType = siteType and siteType:gsub("^%l", string.upper) or 'Website',
site.linkOrLabel,
site.categoryLink,
site.alias,
site.notes
})
 
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.style,
site.siteType,
site.linkOrLabel,
site.categoryLink,
site.alias,
site.notes
) .. site.additionalInfo
end
return result
end
 

Navigation menu