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

мНет описания правки
Нет описания правки
Строка 70: Строка 70:
             result = result .. formatContent(child)
             result = result .. formatContent(child)
         elseif child["!type"] == "NestedSelector" and child.tableId then
         elseif child["!type"] == "NestedSelector" and child.tableId then
             result = result .. getTableOutput(child.tableId)
             result = result .. handleNestedSelector(child, true)
         elseif child["!type"] == "GroupSelector" then
         elseif child["!type"] == "GroupSelector" then
             result = result .. handleGroupSelector(child)
             result = result .. handleGroupSelector(child)
Строка 138: Строка 138:
                 for _, child in ipairs(children) do
                 for _, child in ipairs(children) do
                     if child["!type"] == "NestedSelector" and child.tableId then
                     if child["!type"] == "NestedSelector" and child.tableId then
                         result = result .. handleNestedSelector(child)
                         result = result .. handleNestedSelector(child, false)
                     elseif child["!type"] == "GroupSelector" then
                     elseif child["!type"] == "GroupSelector" then
                         result = result .. handleGroupSelector(child)
                         result = result .. handleGroupSelector(child)
Строка 203: Строка 203:
     for _, child in ipairs(allSelector.children) do
     for _, child in ipairs(allSelector.children) do
         if child["!type"] == "NestedSelector" and child.tableId then
         if child["!type"] == "NestedSelector" and child.tableId then
             result = result .. handleNestedSelector(child)
             result = result .. handleNestedSelector(child, true)
         elseif child.id then
         elseif child.id then
             result = result .. formatContent(child)
             result = result .. formatContent(child)
Строка 213: Строка 213:


-- Обработка NestedSelector
-- Обработка NestedSelector
handleNestedSelector = function(nestedSelector)
handleNestedSelector = function(nestedSelector, wrap)
     local result = ''
     local result = ''
     local tableId = nestedSelector.tableId
     local tableId = nestedSelector.tableId
Строка 228: Строка 228:
     end
     end


     -- Обёртка div с классами
     -- Обёртка div с классами, если wrap включен
     local classString = table.concat(classes, ' ')
     if wrap then
    result = result .. string.format('<div class="%s">', classString)
        local classString = table.concat(classes, ' ')
        result = result .. string.format('<div class="%s">', classString)
    end
 
     result = result .. getTableOutput(tableId)
     result = result .. getTableOutput(tableId)
     result = result .. '</div>'
 
     if wrap then
        result = result .. '</div>'
    end


     return result
     return result