Module:ProjectGallery

From Makerpedia

local p = {}

function p.generateGallery(frame)

   local category = "Projects"
   local pages = mw.site.categoryMembers(category, "all") -- Get all project pages
   local gallery = {}
   for _, page in ipairs(pages) do
       local title = page.title
       local content = mw.title.new(title):getContent()
       local img = content and content:match("img1=(https://[^\n|}%s]+)") or nil
       if img then
           table.insert(gallery, string.format(

'

%s
%s

',

               img, title, title, title
           ))
       end
   end

return '

'

end

return p