Модуль:CategoryList
Для документации этого модуля может быть создана страница Модуль:CategoryList/doc
local p = {}
function p.show(frame)
local categories = mw.title.getCurrentTitle().categories
if #categories == 0 then return "" end
local res = {}
for _, cat in ipairs(categories) do
-- Оформляем каждую категорию как стильный "чип" (тег)
local tag = '<span style="display:inline-block; background:#eaf3ff; color:#36c; padding:4px 12px; border-radius:100px; margin:4px; font-size:0.9em; font-weight:500; border:1px solid #d1e2ff;">'
.. '[[:Категория:' .. cat .. '|' .. cat .. ']]</span>'
table.insert(res, tag)
end
return table.concat(res, "")
end
return p