Module:RelatedCategories

local function exists(page) local success, title = pcall(mw.title.new, page) return success and title and title.exists or false end

local p = {}

function p._main(args) local cats = {} local num = 0

for arg in args do		local param = string.gsub(arg, "[%[%]]*", "") if Category then if exists(param) then table.insert(cats, param) num = num + 1 end end end if num ~= 0 then local catlist = {} for r in cats do			table.insert(catlist, string.format('', r, r)) end return string.format(			' Related Categories: %s ', catlist		) end return '' end function p.main(frame) local args = {} for k, v in pairs(frame:getParent.args) do		v = v:match('^%s*(.-)%s*$') if v ~= '' then args[k] = v		end end return p._main(args) end

return p