Модуль:Serialization/EntityTableSelector: различия между версиями

Нет описания правки
Нет описания правки
Строка 138: Строка 138:


local function getSelectorValue(selector)
local function getSelectorValue(selector)
    if type(selector) == "number" or type(selector) == "string" then
        return selector
    end
     selector = normalizeSelector(selector) or selector
     selector = normalizeSelector(selector) or selector
     if type(selector) ~= "table" then
     if type(selector) ~= "table" then
Строка 234: Строка 230:


     return table.concat(result)
     return table.concat(result)
end
local function renderPlainEntry(entry)
    if type(entry) ~= "table" or trim(entry.id) == "" then
        return ""
    end
    return formatContent(entry)
end
end


Строка 283: Строка 287:
     end
     end


     local content = renderTableById(selector.tableId, visited, (depth or 0) + 1)
     local content = renderTableById(selector.tableId, visited, depth)
     if wrapped and suffix ~= "" then
     if wrapped and suffix ~= "" then
         return wrapCollapsible("Группа предметов" .. suffix, content, depth)
         return wrapCollapsible("Группа предметов" .. suffix, content, depth)
Строка 387: Строка 391:
     local selector = normalizeSelector(data)
     local selector = normalizeSelector(data)
     if not selector then
     if not selector then
        local plainEntry = renderPlainEntry(data)
        if plainEntry ~= "" then
            return frame:preprocess(plainEntry)
        end
         local plainEntries = renderPlainEntries(data)
         local plainEntries = renderPlainEntries(data)
         if plainEntries ~= "" then
         if plainEntries ~= "" then