Модуль:Сущность: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 124: | Строка 124: | ||
srcStr = " " .. table.concat(srcParts, " ") | srcStr = " " .. table.concat(srcParts, " ") | ||
end | end | ||
return "{{ | return "{{карточка/Сущность|" .. mw.text.encode(key) .. "|" .. calls .. srcStr .. "}}" | ||
end | end | ||
}, | }, | ||
| Строка 145: | Строка 145: | ||
local errors = {} | local errors = {} | ||
local function | local function processEntity(kind, name) | ||
local pathName = lcfirst(name) | local pathName = lcfirst(name) | ||
local tplPath = kind .. "/" .. pathName | local tplPath = kind .. "/" .. pathName | ||
local content = load_template_content(tplPath) | local content = load_template_content(tplPath) | ||
if not content then | if not content then | ||
local | local classType = (kind == "component" and "Component" or "Prototype") | ||
local className = name .. classType | |||
local tplLabel = "Template:" .. tplPath | local tplLabel = "Template:" .. tplPath | ||
table.insert(errors, | |||
"{{сущность/infobox|тип=" .. classType .. "|название=" .. className .. "|ссылка=" .. tplLabel .. "}}") | |||
return | return | ||
end | end | ||
| Строка 187: | Строка 183: | ||
for compName, _ in pairs(foundComponents) do table.insert(items, { kind = "component", name = compName }) end | for compName, _ in pairs(foundComponents) do table.insert(items, { kind = "component", name = compName }) end | ||
for protoName, _ in pairs(foundPrototypes) do table.insert(items, { kind = "prototype", name = protoName }) end | for protoName, _ in pairs(foundPrototypes) do table.insert(items, { kind = "prototype", name = protoName }) end | ||
for _, it in ipairs(items) do | for _, it in ipairs(items) do processEntity(it.kind, it.name) end | ||
local out = {} | local out = {} | ||
for _, e in ipairs(errors) do table.insert(out, | for _, e in ipairs(errors) do table.insert(out, e) end | ||
for _, sw in ipairs(switches) do | for _, sw in ipairs(switches) do | ||
local cfg = switchConfigs[sw] or {} | local cfg = switchConfigs[sw] or {} | ||