Module:ClassCategoryList

-- See the talk page for documentation. local get_classes = require('Module:ReflectionMetadataHelpers').get_classes local class_link = require('Module:Superclass')._class_link

local p = {}

--% This function generates a list of classes by their categories. --: (string) the list of classes function p.generate_list_of_classes_by_category local categories = {} local uncategorized_classes = {} for _, class_data in pairs(get_classes.Item) do       if class_data._attr.class == "ReflectionMetadataClass" then -- Find the class name. local class_name local class_category for _, property in pairs(class_data.Properties.string) do               if property._attr and property._attr.name then if property._attr.name == "Name" then class_name = property[1] elseif property._attr.name == "ClassCategory" then class_category = property[1] end end end if class_name and class_category then if not categories[class_category] then categories[class_category] = {} end table.insert(categories[class_category], class_name) end end end local output = "" local first = true for category, classes in pairs(categories) do       if not first then output = output .. "\n" end first = false output = output .. "== " .. category .. " ==\n" for _, class in pairs(classes) do           output = output .. "\n* " .. class_link{class=class} end end return output end

return p