Модуль:List
Документацію для цього модуля можна створити у Модуль:List/документація
local p = {}
function p.FetchData(frame)
-- This function fetches pages from a category and extracts information from the 'MCC Player' template.
local categoryName = "Учасники_спільноти_MCC" -- Set the correct category name
local continue = nil
local pages = {}
-- Fetching pages from the category
repeat
local query = mw.title.makeTitle(14, categoryName):categoryMembers{continue = continue}
for _, page in ipairs(query) do
table.insert(pages, page.title)
end
continue = query.continue
until not continue
-- Start the wikitable
local output = '{| class="wikitable"\n'
output = output .. '! Nickname !! Prize Pool !! Date Added !! Recruiter\n'
-- Process each page
for _, pageTitle in ipairs(pages) do
local page = mw.title.new(pageTitle)
local content = page:getContent()
-- Extract data using patterns (very basic pattern matching, customize as needed)
local nickname = content:match("| nickname = ([^\n]+)")
local prizePool = content:match("| prize_pool = ([^\n]+)")
local dateAdded = content:match("| date_added = ([^\n]+)")
local recruiterLink = content:match("| recruiter = %[%[([^|%]]+)")
local recruiter = recruiterLink and mw.title.new(recruiterLink):getPrefixedText() or 'N/A'
-- Append to the table
output = output .. '|-\n'
output = output .. string.format('| %s || %s || %s || %s\n', nickname or 'N/A', prizePool or 'N/A', dateAdded or 'N/A', recruiter)
end
-- Close the wikitable
output = output .. '|}'
return output
end
return p