Module:CareerList: Difference between revisions
Content deleted Content added
PeaceDeadC (talk | contribs) Undo revision 2321 by PeaceDeadC (talk) Tag: Undo |
PeaceDeadC (talk | contribs) No edit summary |
||
Line 1:
-- загрузка конфигурационного файла
-- функция определения ссылки на сайт
▲local cfg = mw.loadData('Module:CareerList/config')
local function getSiteLink(site, id)▼
-- проверка наличия значения в конфигурационном файле
▲local function getSiteLink(site)
if not config.sites[site] then
error(string.format('Сайт %s не найден в конфигурационном файле', site))
local url = cfg[site].url or ''▼
-- замена переменной $1 на значение id
local function makeCell(args, bgcolor)▼
-- возврат ссылки
▲ return string.format([[
end
-- функция создания ячейки таблицы
-- определение цвета фона ячейки 1
if
elseif site == 'Website' then
bg = '#E7E7E7'
else
error(string.format('Значение site (%s) должно быть "Studio" или "Website"', site))
▲ end
▲ end
-- определение значения alias
if alias == ''
alias = config.sites[site].name
end
-- определение значения notes
if notes == ''
notes =
end
-- создание ячейки
local cell = string.format('|-\n| style="background-color: %s;" | %s\n| %s\n| %s\n| %s', bg, site, getSiteLink(site, id), alias, notes)
end
-- экспорт функций
▲return p
return {
getSiteLink = getSiteLink,
makeCell = makeCell
}
| |||