Модуль:Сущность: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 131: | Строка 131: | ||
tagSet = {} | tagSet = {} | ||
} | } | ||
for _, callKey in ipairs(keyOrder or {}) do | for _, callKey in ipairs(keyOrder or {}) do | ||
local entries = keyToTemplates[callKey] or {} | local entries = keyToTemplates[callKey] or {} | ||
| Строка 186: | Строка 168: | ||
merged.labelLists[section] = cur | merged.labelLists[section] = cur | ||
end | end | ||
if e.cardTag and e.cardTag ~= "" then | |||
if not merged.tagSet[e.cardTag] then | |||
merged.tagSet[e.cardTag] = true | |||
table.insert(merged.tags, e.cardTag) | |||
if not merged.tagSet[ | |||
merged.tagSet[ | |||
table.insert(merged.tags, | |||
end | end | ||
end | end | ||
| Строка 426: | Строка 400: | ||
end | end | ||
end | end | ||
local cardTagValue = parsed.cardTag | |||
if sw == "card" and cardTagValue and cardTagValue ~= "" and extra and extra ~= "" then | |||
local params = {} | |||
for chunk in string.gmatch(extra, "[^|]+") do | |||
local pk, pv = chunk:match("^(.-)=(.*)$") | |||
if pk and pv then | |||
params[trim(pk)] = pv | |||
end | |||
end | |||
cardTagValue = cardTagValue:gsub("{{{([^}]+)}}}", function(name) | |||
name = trim(name or "") | |||
return params[name] or "" | |||
end) | |||
end | |||
local entry | local entry | ||
if sw == "card" then | if sw == "card" then | ||
| Строка 431: | Строка 420: | ||
tplLabel = tplLabelStr, | tplLabel = tplLabelStr, | ||
tplContent = tplContentStr, | tplContent = tplContentStr, | ||
cardTag = | cardTag = cardTagValue, | ||
source = { kind = kind, name = name, pathName = pathName, tplPath = tplPath }, | source = { kind = kind, name = name, pathName = pathName, tplPath = tplPath }, | ||
priority = priority, | priority = priority, | ||
| Строка 471: | Строка 460: | ||
local out = {} | local out = {} | ||
if #errors > 0 then | if #errors > 0 then | ||
table.insert(out, '{{сущность/infobox|' .. table.concat(errors, "\n") .. '}}') | table.insert(out, '{{сущность/infobox|' .. table.concat(errors, "\n") .. '}}') | ||