Module:CareerList: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
PeaceDeadC (talk | contribs) No edit summary |
PeaceDeadC (talk | contribs) No edit summary Tag: Reverted |
||
| Line 39: | Line 39: | ||
return string.format([=[ |
return string.format([=[ |
||
{| class="wikitable" |
{| class="wikitable" style="width:100%; max-width:100%; margin:auto; table-layout:fixed;" |
||
|+ %s |
|+ %s |
||
! Категория |
! style="width:25%%;" | Категория |
||
! Ссылка |
! style="width:25%%;" | Ссылка |
||
! Псевдоним |
! style="width:25%%;" | Псевдоним |
||
! Заметки |
! style="width:25%%;" | Заметки |
||
%s]=], args.title or '', list) |
%s]=], args.title or '', list) |
||
end |
end |
||
Revision as of 18:40, 12 March 2023
Documentation for this module may be created at Module:CareerList/doc
local p = {}
function p.CareerList(frame)
local args = frame.args
local site = string.lower(args.site)
local id = args.id or ''
local alias = args.alias or args[1]
local notes = args.notes or 'N/A'
-- получаем конфигурацию сайтов
local sites = mw.loadData('Module:CareerList/config')
local siteData = sites[site]
if not siteData then
return ''
end
-- заменяем переменную $1 в URL на значение id
local url = siteData.url:gsub('%$1', id)
-- формируем ссылку
local link = string.format('[%s %s]', url, args.site)
-- формируем ячейки таблицы
local cells = {
siteData.label,
link,
alias,
notes
}
-- возвращаем сформированную строку таблицы
return string.format('|-\n| %s || %s || %s || %s', unpack(cells))
end
function p.CareerListTop(frame)
local args = frame.args
local list = args.list or ''
return string.format([=[
{| class="wikitable" style="width:100%; max-width:100%; margin:auto; table-layout:fixed;"
|+ %s
! style="width:25%%;" | Категория
! style="width:25%%;" | Ссылка
! style="width:25%%;" | Псевдоним
! style="width:25%%;" | Заметки
%s]=], args.title or '', list)
end
return p