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

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


-- Обработка GroupSelector
-- Обработка GroupSelector
-- Обработка GroupSelector
handleGroupSelector = function(groupSelector, parentDivOpened)
handleGroupSelector = function(groupSelector)
     local result = ''
     local result = ''
 
      
     -- Проверка на существование children
     if not groupSelector.children then
     if not groupSelector.children then
         return ""
         return ""
Строка 175: Строка 173:


     local weight = groupSelector.weight or "default"
     local weight = groupSelector.weight or "default"
 
   
     result = result .. string.format('<div class="together" id="%s">', weight)
     if not parentDivOpened then
        result = result .. string.format('<div class="together" id="%s">', weight)
    end


     for _, child in ipairs(groupSelector.children) do
     for _, child in ipairs(groupSelector.children) do
         if child["!type"] == "GroupSelector" then
         if child["!type"] == "GroupSelector" then
             result = result .. handleGroupSelector(child)
             result = result .. handleGroupSelector(child, true)
         elseif child["!type"] == "AllSelector" then
         elseif child["!type"] == "AllSelector" then
             result = result .. string.format('<div class="AllSelector">')
             result = result .. string.format('<div class="AllSelector">')
             result = result .. handleAllSelector(child)
             result = result .. handleAllSelector(child)
             result = result .. '</div>'
             result = result .. '</div>'  
         elseif child.id then
         elseif child.id then
             result = result .. formatContent(child)
             result = result .. formatContent(child)
Строка 192: Строка 192:
     end
     end
      
      
     result = result .. '</div>'
     if not parentDivOpened then
        result = result .. '</div>'
    end


     return result
     return result