Модуль:Сущность: различия между версиями

Нет описания правки
Нет описания правки
Строка 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 e.cardTag and e.cardTag ~= "" then
                     if tagText ~= "" then
                         if not merged.tagSet[e.cardTag] then
                         if not merged.tagSet[tagText] then
                             merged.tagSet[e.cardTag] = true
                             merged.tagSet[tagText] = true
                             table.insert(merged.tags, e.cardTag)
                             table.insert(merged.tags, tagText)
                         end
                         end
                     end
                     end
Строка 364: Строка 368:


         local parsed = getTemplateMeta(frame, tplPath)
         local parsed = getTemplateMeta(frame, tplPath)
        if parsed and parsed.cardTag and parsed.cardTag ~= "" then
            parsed.cardTag = trim(frame:preprocess(parsed.cardTag))
        end
         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 cardTagValue = parsed and parsed.cardTag or nil


                     local entry
                     local entry
Строка 411: Строка 411:
                             tplLabel = tplLabelStr,
                             tplLabel = tplLabelStr,
                             tplContent = tplContentStr,
                             tplContent = tplContentStr,
                             cardTag = cardTagValue,
                             tplTag = tplTagStr,
                             source = { kind = kind, name = name, pathName = pathName, tplPath = tplPath },
                             source = { kind = kind, name = name, pathName = pathName, tplPath = tplPath },
                             priority = priority,
                             priority = priority,