Module:CasinoList

From

local p = {}

function p.renderCategoryPages(frame)

   local category = frame.args.category or "Casino_Providers"
   local maxPages = tonumber(frame.args.maxPages) or 30
   local pagesPerRow = tonumber(frame.args.pagesPerRow) or 3
   local pages = mw.site.pagesInCategory(category)
   local output = {}
   local counter = 0
   for _, page in ipairs(pages) do
       if counter >= maxPages then break end
       local title = page.title
       local image = page.file or "DefaultImage.jpg"
       if counter % pagesPerRow == 0 then

table.insert(output, '

')
       end
       table.insert(output, string.format(
'',
           image, title
       ))
       counter = counter + 1
       if counter % pagesPerRow == 0 then
table.insert(output, '

')

       end
   end
   if counter % pagesPerRow ~= 0 then

table.insert(output, '') -- Закрити останній ряд

   end
   return table.concat(output, "\n")

end

return p