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

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


return p
return p