Модуль:Players: відмінності між версіями
| Admin (обговорення | внесок) Немає опису редагування | Admin (обговорення | внесок)  Немає опису редагування | ||
| Рядок 3: | Рядок 3: | ||
| function p.fetchCategoryData(frame) | function p.fetchCategoryData(frame) | ||
|      local categoryName = "Учасники_спільноти_MCC"  -- The category to fetch from |      local categoryName = "Учасники_спільноти_MCC"  -- The category to fetch from | ||
|      local  |      local category = mw.title.makeTitle(14, categoryName)  -- Namespace 14 for Category | ||
|      local  |      local members = category:getCategoryMembers() | ||
|     local output = '{| class="wikitable sortable" style="text-align:center;"\n! Учасник\n! Page Link\n' | |||
|      --  |      -- Iterate through each member of the category | ||
|      local  |      for _, member in ipairs(members) do | ||
|         local title = member.fullText  -- Get the full text of the page title | |||
|          output = output .. '|-\n| ' .. title .. '\n| [[' .. title .. ']]\n' | |||
|          output = output .. '|-\n| ' .. title | |||
|      end |      end | ||
Версія за 20:48, 22 квітня 2024
Документацію для цього модуля можна створити у Модуль:Players/документація
local p = {}
function p.fetchCategoryData(frame)
    local categoryName = "Учасники_спільноти_MCC"  -- The category to fetch from
    local category = mw.title.makeTitle(14, categoryName)  -- Namespace 14 for Category
    local members = category:getCategoryMembers()
    local output = '{| class="wikitable sortable" style="text-align:center;"\n! Учасник\n! Page Link\n'
    -- Iterate through each member of the category
    for _, member in ipairs(members) do
        local title = member.fullText  -- Get the full text of the page title
        output = output .. '|-\n| ' .. title .. '\n| [[' .. title .. ']]\n'
    end
    -- Close the wikitable
    output = output .. '|}\n'
    return output
end
return p