Module:Achievements

local Achievements = {} local HF = require('Module:HF') local getArgs = require('Dev:Arguments').getArgs local L = require('Dev:List')

function Achievements.category(frame) local args = getArgs(frame) local categorymain = args['maincategory'] if not categorymain then return nil end local categories = {} for category in mw.text.gsplit(categorymain, '%s*;%s*') do       table.insert(categories, HF.Link(category..' achievements',category)) end if not category[2] then return L._makeList('bulleted', categories) else return category[1] end end function Achievements.subcategory(frame) local args = getArgs(frame) local CM = args['maincategory'] local _SC = args['subcategory'] if not CM or not _SC then return nil end local subcategories = {} local out = {} local maincategories = mw.text.split(CM, '%s*;%s*') for subcat_group in mw.text.gsplit(_SC, '%s*;%s*') do       local subcats = mw.text.split(subcat_group) table.insert(subcategories, subcats) end if #subcategories == 1 and #subcategories[1] == 1 then return HF.Link end for MC,SC in ipairs(subcategories) do       for item in ipairs(SC) do            table.insert(out, HF.Link(category..' achievements',category) ..                (#maincategories > 1 and (' (%s)'):format(maincategories[MC]) or '')            ) end end return out and L._makeList('bulleted',out) end

return Achievements