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

мНет описания правки
мНет описания правки
Строка 83: Строка 83:
     -- секции карточки
     -- секции карточки
     if merged.sections and #merged.sections > 0 then
     if merged.sections and #merged.sections > 0 then
         table.sort(merged.sections)
         table.sort(merged.sections, function(a, b)
            if a == "Сущность" then return true end
            if b == "Сущность" then return false end
            return a < b
        end)
         parts[#parts + 1] = "sections=" .. table.concat(merged.sections, ", ")
         parts[#parts + 1] = "sections=" .. table.concat(merged.sections, ", ")
         for _, section in ipairs(merged.sections) do
         for _, section in ipairs(merged.sections) do
Строка 141: Строка 145:


                 if displayLabel ~= "" or content ~= "" then
                 if displayLabel ~= "" or content ~= "" then
                    if not merged.sectionsMap[section] then
                        merged.sectionsMap[section] = true
                        table.insert(merged.sections, section)
                    end
                     merged.labelOverrides[compositeKey] = displayLabel
                     merged.labelOverrides[compositeKey] = displayLabel
                     merged.contentByKey[compositeKey] = content
                     merged.contentByKey[compositeKey] = content
                     if section ~= "Сущность" then
 
                        if not merged.sectionsMap[section] then
                     merged.labelSets[section] = merged.labelSets[section] or {}
                            merged.sectionsMap[section] = true
                    if not merged.labelSets[section][compositeKey] then
                            table.insert(merged.sections, section)
                        merged.labelSets[section][compositeKey] = true
                        end
                        local cur = merged.labelLists[section] or {}
                        merged.labelSets[section] = merged.labelSets[section] or {}
                        table.insert(cur, compositeKey)
                        if not merged.labelSets[section][compositeKey] then
                        merged.labelLists[section] = cur
                            merged.labelSets[section][compositeKey] = true
                            local cur = merged.labelLists[section] or {}
                            table.insert(cur, compositeKey)
                            merged.labelLists[section] = cur
                        end
                     end
                     end
                 end
                 end