Модуль:Players: відмінності між версіями
| Admin (обговорення | внесок) Немає опису редагування | Admin (обговорення | внесок)  Немає опису редагування | ||
| Рядок 2: | Рядок 2: | ||
| function p.fetchCategoryData(frame) | function p.fetchCategoryData(frame) | ||
|      local categoryName = "Учасники_спільноти_MCC" |      local categoryName = "Учасники_спільноти_MCC"  -- The category to fetch from | ||
|      local  |      local count = mw.site.stats.pagesInCategory(categoryName, 'all')  -- Get the number of pages | ||
|     local pages = mw.site.pagesInCategory(categoryName, 'all', count)  -- Fetch all pages in the category | |||
|     -- Start the wikitable | |||
|      local output = '{| class="wikitable sortable" style="text-align:center;"\n! Учасник\n! Page Link\n' |      local output = '{| class="wikitable sortable" style="text-align:center;"\n! Учасник\n! Page Link\n' | ||
|      for  | |||
|     -- Add rows to the wikitable | |||
|          output = output .. '|-\n| ' .. title .. '\n| [[' .. title .. ']]\n' |      for title in pages do | ||
|          output = output .. '|-\n| ' .. title.fullText .. '\n| [[' .. title.fullText .. ']]\n' | |||
|      end |      end | ||
|     -- Close the wikitable | |||
|      output = output .. '|}\n' |      output = output .. '|}\n' | ||
|      return output |      return output | ||
Версія за 20:47, 22 квітня 2024
Документацію для цього модуля можна створити у Модуль:Players/документація
local p = {}
function p.fetchCategoryData(frame)
    local categoryName = "Учасники_спільноти_MCC"  -- The category to fetch from
    local count = mw.site.stats.pagesInCategory(categoryName, 'all')  -- Get the number of pages
    local pages = mw.site.pagesInCategory(categoryName, 'all', count)  -- Fetch all pages in the category
    -- Start the wikitable
    local output = '{| class="wikitable sortable" style="text-align:center;"\n! Учасник\n! Page Link\n'
    
    -- Add rows to the wikitable
    for title in pages do
        output = output .. '|-\n| ' .. title.fullText .. '\n| [[' .. title.fullText .. ']]\n'
    end
    -- Close the wikitable
    output = output .. '|}\n'
    return output
end
return p