Модуль:Сущность: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 141: | Строка 141: | ||
local displayLabel = trim(frame:preprocess(e.tplLabel or "") or "") | 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 "") | ||
local tagText = "" | |||
if e.tplTag then | |||
tagText = trim(frame:preprocess(e.tplTag or "") or "") | |||
end | |||
local compositeKey = (callKey:find("_", 1, true)) and callKey or ("Сущность_" .. callKey) | local compositeKey = (callKey:find("_", 1, true)) and callKey or ("Сущность_" .. callKey) | ||
local section = (callKey:find("_", 1, true)) and callKey:match("^([^_]+)") or "Сущность" | local section = (callKey:find("_", 1, true)) and callKey:match("^([^_]+)") or "Сущность" | ||
| Строка 168: | Строка 172: | ||
merged.labelLists[section] = cur | merged.labelLists[section] = cur | ||
end | end | ||
if | if tagText ~= "" then | ||
if not merged.tagSet[ | if not merged.tagSet[tagText] then | ||
merged.tagSet[ | merged.tagSet[tagText] = true | ||
table.insert(merged.tags, | table.insert(merged.tags, tagText) | ||
end | end | ||
end | end | ||
| Строка 364: | Строка 368: | ||
local parsed = getTemplateMeta(frame, tplPath) | local parsed = getTemplateMeta(frame, tplPath) | ||
for _, sw in ipairs(switches) do | for _, sw in ipairs(switches) do | ||
local keys = parsed[sw] or {} | local keys = parsed[sw] or {} | ||
| Строка 387: | Строка 388: | ||
end | end | ||
local tplStr | local tplStr | ||
local tplLabelStr, tplContentStr | local tplLabelStr, tplContentStr, tplTagStr | ||
if sw == "card" then | if sw == "card" then | ||
tplLabelStr = makeTplCall(tplPath, "cardLabel", key, id, extra) | tplLabelStr = makeTplCall(tplPath, "cardLabel", key, id, extra) | ||
tplContentStr = makeTplCall(tplPath, "cardContent", key, id, extra) | tplContentStr = makeTplCall(tplPath, "cardContent", key, id, extra) | ||
tplTagStr = makeTplCall(tplPath, "cardTag", key, id, extra) | |||
else | else | ||
tplStr = makeTplCall(tplPath, sw, key, id, extra) | tplStr = makeTplCall(tplPath, sw, key, id, extra) | ||
| Строка 403: | Строка 405: | ||
end | end | ||
end | end | ||
local entry | local entry | ||
| Строка 411: | Строка 411: | ||
tplLabel = tplLabelStr, | tplLabel = tplLabelStr, | ||
tplContent = tplContentStr, | tplContent = tplContentStr, | ||
tplTag = tplTagStr, | |||
source = { kind = kind, name = name, pathName = pathName, tplPath = tplPath }, | source = { kind = kind, name = name, pathName = pathName, tplPath = tplPath }, | ||
priority = priority, | priority = priority, | ||