Модуль:Сущность: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 98: | Строка 98: | ||
-- содержимое полей | -- содержимое полей | ||
for compositeKey, | for compositeKey, displayLabel in pairs(merged.labelOverrides or {}) do | ||
if | if displayLabel and displayLabel ~= "" then | ||
parts[#parts + 1] = mw.text.encode(compositeKey .. "_label") .. "=" .. | parts[#parts + 1] = mw.text.encode(compositeKey .. "_label") .. "=" .. displayLabel | ||
end | end | ||
end | end | ||
| Строка 127: | Строка 127: | ||
tagSet = {} | tagSet = {} | ||
} | } | ||
for _, | for _, callKey in ipairs(keyOrder or {}) do | ||
local entries = keyToTemplates[ | local entries = keyToTemplates[callKey] or {} | ||
if #entries > 0 then | if #entries > 0 then | ||
table.sort(entries, function(a, b) | table.sort(entries, function(a, b) | ||
| Строка 135: | Строка 135: | ||
end) | end) | ||
for _, e in ipairs(entries) do | for _, e in ipairs(entries) do | ||
local | local displayLabel = trim(frame:preprocess(e.tplLabel or "") or "") | ||
local content = trim(frame:preprocess(e.tplContent or "") or "") | local content = trim(frame:preprocess(e.tplContent or "") or "") | ||
if | local compositeKey = (callKey:find("_", 1, true)) and callKey or ("Сущность_" .. callKey) | ||
local section = (callKey:find("_", 1, true)) and callKey:match("^([^_]+)") or "Сущность" | |||
if displayLabel ~= "" or content ~= "" then | |||
if not merged.sectionsMap[section] then | if not merged.sectionsMap[section] then | ||
merged.sectionsMap[section] = true | merged.sectionsMap[section] = true | ||
table.insert(merged.sections, section) | table.insert(merged.sections, section) | ||
end | end | ||
merged.labelOverrides[compositeKey] = displayLabel | |||
merged.labelOverrides[compositeKey] = | |||
merged.contentByKey[compositeKey] = content | merged.contentByKey[compositeKey] = content | ||