Модуль:FetchData7: відмінності між версіями

83 байти додано ,  У понеділок о 19:46
нема опису редагування
Немає опису редагування
Немає опису редагування
Рядок 52: Рядок 52:
     end
     end
      
      
     local container = mw.html.create('div'):addClass('l-box')
     local html_parts = {}
   
    table.insert(html_parts, '<div class="l-box">')
      
      
     for i, section in ipairs(sections) do
     for i, section in ipairs(sections) do
         local item = container:tag('a')
         local last_class = ""
            :attr('href', '#' .. section.anchor)
            :addClass('l-box-item')
            :wikitext(section.display)
       
         if i == #sections then
         if i == #sections then
             item:addClass('l-box-item-last')
             last_class = " l-box-item-last"
         end
         end
       
        table.insert(html_parts, '<div class="l-box-item' .. last_class .. '">[[#' .. section.anchor .. '|' .. section.display .. ']]</div>')
     end
     end
      
      
     return tostring(container)
    table.insert(html_parts, '</div>')
   
     return table.concat(html_parts, '\n')
end
end


return p
return p