Модуль:Сущность: различия между версиями

мНет описания правки
мНет описания правки
Строка 363: Строка 363:
         local content = load_template_content(tplPath)
         local content = load_template_content(tplPath)
         if not content then
         if not content then
             if hasWhitelist then
             if hasWhitelist then return end
                return
             local typeStr = (kind and (kind:sub(1, 1):upper() .. kind:sub(2)) or "") .. (isStore and "Store" or "")
            end
             table.insert(errors, "{{сущность/infobox|тип=" .. typeStr .. "|название=" .. name .. "|ссылка=Template:" .. tplPath .. "}}")
             local classType = (kind and (kind:sub(1, 1):upper() .. kind:sub(2)) or "")
            local className = name .. classType
            local tplLabel = "Template:" .. tplPath
             table.insert(errors,
                "{{сущность/infobox|тип=" .. classType .. "|название=" .. className .. "|ссылка=" .. tplLabel .. "}}")
             return
             return
         end
         end
         local parsed = getTemplateMeta(frame, tplPath)
         local parsed = getTemplateMeta(frame, tplPath)
         local dataPage = (kind .. "/" .. pathName) .. ".json"
         local dataPage = (kind .. "/" .. pathName) .. ".json"
         local entities = isStore and storeEntities or { id }
         local entityIds = isStore and storeEntities or { id }
        local switchesToProcess = isStore and { "card" } or switches


        if isStore then
         for _, sw in ipairs(switches) do
            parsed = parsed or {}
            if isStore and sw ~= "card" then break end
            if not parsed.card or #parsed.card == 0 then
                parsed.card = { (kind == "component") and "ComponentStore" or "PrototypeStore" }
            end
        end
 
         for _, sw in ipairs(switchesToProcess) do
             local keys = parsed[sw] or {}
             local keys = parsed[sw] or {}
             for _, key in ipairs(keys) do
             for _, key in ipairs(keys) do
Строка 399: Строка 387:
                         table.insert(switchKeyOrder[sw], key)
                         table.insert(switchKeyOrder[sw], key)
                     end
                     end
                     for _, entityId in ipairs(entities) do
                     for _, entityId in ipairs(entityIds) do
                         local extra = ""
                         local extra = ""
                         if ok and dp and dp.flattenField then
                         if ok and dp and dp.flattenField then