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

мНет описания правки
Нет описания правки
 
(не показана 1 промежуточная версия этого же участника)
Строка 120: Строка 120:
end
end


local function cardWrapper(frame, keyOrder, keyToTemplates, keySources, entityId)
local function cardWrapper(frame, keyOrder, keyToTemplates, keySources, entityId, noHeaders)
     local merged = {
     local merged = {
         sections = {},
         sections = {},
Строка 168: Строка 168:
                         merged.labelLists[section] = cur
                         merged.labelLists[section] = cur
                     end
                     end
                        if e.cardTag and e.cardTag ~= "" then
                    if e.cardTag and e.cardTag ~= "" then
                            if not merged.tagSet[e.cardTag] then
                        if not merged.tagSet[e.cardTag] then
                                merged.tagSet[e.cardTag] = true
                            merged.tagSet[e.cardTag] = true
                                table.insert(merged.tags, e.cardTag)
                            table.insert(merged.tags, e.cardTag)
                            end
                         end
                         end
                     end
                     end
                end
             end
             end
         end
         end
     end
     end
    if noHeaders then
        local hasLabel = false
        for _, v in pairs(merged.labelOverrides or {}) do
            if v and v ~= "" then hasLabel = true break end
        end
        if not hasLabel then
            for _, lst in pairs(merged.labelLists or {}) do
                if #lst > 0 then hasLabel = true break end
            end
        end
        local hasContent = false
        for _, v in pairs(merged.contentByKey or {}) do
            if v and v ~= "" then hasContent = true break end
        end
        if not hasLabel and not hasContent then
            return ""
        end
    end
     return buildCardCall(merged, entityId)
     return buildCardCall(merged, entityId)
end
end
Строка 229: Строка 251:
         local cfg = configs[sw] or {}
         local cfg = configs[sw] or {}
         if cfg.fullCard and sw == "card" then
         if cfg.fullCard and sw == "card" then
             local outStr = cfg.wrapper(frame, keyOrder[sw], keyToTemplates[sw], keySources[sw], entityId)
             local outStr = cfg.wrapper(frame, keyOrder[sw], keyToTemplates[sw], keySources[sw], entityId, noHeaders)
             if outStr and outStr ~= "" then table.insert(outLocal, outStr) end
             if outStr and outStr ~= "" then table.insert(outLocal, outStr) end
         else
         else