Module:Discontinued Feature Categories

local p = {} --p stands for package local data = { feature = mw.loadData( 'Module:Discontinued Feature Categories/Feature' ), version = nil }

has_missing_categories = false missing_categories = {} missing_category_fields = {} invalid_categories = {}

function p.parse(frame) local parent = frame:getParent return parse_categories(parent.args, "feature") end

function get_category(str, _type) category = data[_type][string.gsub(str," ", "_")] if not category then has_missing_categories = true invalid_categories[#invalid_categories+1] = str return {} end list = {str} if category.parents then if type(category.parents) =="string" then list = add_array(list, get_categories(category.parents, _type)) end if type(category.parents) =="table" then for i = 1, #category.parents do               list = add_array(list, get_categories(category.parents[i], _type)) end end end return list end

function get_categories(list, _type) categories = get_category(list[_type],_type) for i=2,5 do           cat = list[_type .. i]           if cat then categories = add_array(categories, parse_category(cat,_type)) end end return categories end

function parse_categories(categories, _type) list = get_categories(categories, _type) if #list == 0 then return '' end return "" end

function add_array(arr1,arr2) for i=1,#arr2 do      arr1[#arr1+1] = arr2[i] end return arr1 end

return p