Модуль:Сущность: различия между версиями
Pok (обсуждение | вклад) Отмена версии 143877, сделанной Pok (обсуждение) Метка: отмена |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 402: | Строка 402: | ||
local entry | local entry | ||
if sw == "card" then | if sw == "card" then | ||
local cardTagStr = "" | |||
local okTag, expandedTag = pcall(function() | |||
return trim(frame:preprocess(makeTplCall(tplPath, "cardTag", key, id, extra) or "")) | |||
end) | |||
if okTag and expandedTag and expandedTag ~= "" then | |||
cardTagStr = expandedTag | |||
end | |||
entry = { | entry = { | ||
tplLabel = tplLabelStr, | tplLabel = tplLabelStr, | ||
tplContent = tplContentStr, | tplContent = tplContentStr, | ||
cardTag = | cardTag = finalCardTag, | ||
source = { kind = kind, name = name, pathName = pathName, tplPath = tplPath }, | source = { kind = kind, name = name, pathName = pathName, tplPath = tplPath }, | ||
priority = priority, | priority = priority, | ||
| Строка 483: | Строка 491: | ||
local entry | local entry | ||
if sw == "card" then | if sw == "card" then | ||
local cardTagStr = "" | |||
local okTag, expandedTag = pcall(function() | |||
return trim(frame:preprocess(makeTplCall(tplPath, "cardTag", key, "", "") or "")) | |||
end) | |||
if okTag and expandedTag and expandedTag ~= "" then | |||
cardTagStr = expandedTag | |||
end | |||
local finalCardTag = cardTagStr | |||
if finalCardTag == "" and parsed and parsed.cardTag ~= nil then | |||
if type(parsed.cardTag) == "table" then | |||
local maybe = parsed.cardTag[key] | |||
if maybe and type(maybe) ~= "table" then | |||
finalCardTag = tostring(maybe) | |||
else | |||
finalCardTag = "" | |||
end | |||
else | |||
finalCardTag = tostring(parsed.cardTag) | |||
end | |||
end | |||
entry = { | entry = { | ||
tplLabel = makeTplCall(tplPath, "cardLabel", key, ""), | tplLabel = makeTplCall(tplPath, "cardLabel", key, ""), | ||
tplContent = makeTplCall(tplPath, "cardContent", key, ""), | tplContent = makeTplCall(tplPath, "cardContent", key, ""), | ||
cardTag = finalCardTag, | |||
source = { kind = "", name = tplPath, pathName = tplPath, tplPath = tplPath }, | source = { kind = "", name = tplPath, pathName = tplPath, tplPath = tplPath }, | ||
priority = 1, | priority = 1, | ||