Модуль:Players: відмінності між версіями
Admin (обговорення | внесок) (Створена сторінка: local p = {} function p.fetchCategoryData(frame) local categoryName = "Учасники_спільноти_MCC" -- The category to fetch from local continue = nil local pages = {} repeat local query = mw.smw.ask('Category:' .. categoryName .. '|limit=500' .. (continue and '|continue=' .. continue or '')) for _, page in pairs(query) do table.insert(pages, page.fullText) end continue = query["...) |
(Немає відмінностей)
|
Версія за 20:42, 22 квітня 2024
Документацію для цього модуля можна створити у Модуль:Players/документація
local p = {}
function p.fetchCategoryData(frame)
local categoryName = "Учасники_спільноти_MCC" -- The category to fetch from
local continue = nil
local pages = {}
repeat
local query = mw.smw.ask('[[Category:' .. categoryName .. ']]|limit=500' .. (continue and '|continue=' .. continue or ''))
for _, page in pairs(query) do
table.insert(pages, page.fullText)
end
continue = query["query-continue-offset"] -- If more than 500 results, need to continue querying
until not continue
-- Start the wikitable
local output = '{| class="wikitable sortable" style="text-align:center;"\n! Учасник\n! Page Link\n'
-- Add rows to the wikitable
for _, pageTitle in ipairs(pages) do
output = output .. '|-\n| ' .. pageTitle .. '\n| [[' .. pageTitle .. ']]\n'
end
-- Close the wikitable
output = output .. '|}\n'
return output
end
return p