Модуль:Сущность: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 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 | ||
merged.labelSets[section] = merged.labelSets[section] or {} | |||
if not merged.labelSets[section][compositeKey] then | |||
merged.labelSets[section][compositeKey] = true | |||
local cur = merged.labelLists[section] or {} | |||
table.insert(cur, compositeKey) | |||
merged.labelLists[section] = cur | |||
end | end | ||
end | end | ||