Jump to content

Module:Higher education task force/data: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
Tag: Reverted
mNo edit summary
Line 1: Line 1:
-- This module stores icon data for [[Module:Higher education task force]].
-- This module stores icon data for [[Module:Higher education task force]].

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Higher education task force data
-- Higher education task force data
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local function validateTaskForceData(data)
local requiredFields = {"image", "name", "nested", "category", "link"}
for code, taskForce in pairs(data) do
for _, field in ipairs(requiredFields) do
if not taskForce[field] then
error(string.format("Missing required field '%s' for task force '%s'", field, code))
end
end
end
end


local data = {
local data = {
student = {
student = {
image = "Nuvola apps edu languages.svg",
image = "Nuvola apps edu languages.svg",
name = "Student Affairs task force",
name ="Student Affairs task force",
nested = "Student Affairs",
nested ="Student Affairs",
category = "Student Affairs task force articles",
category = "Student Affairs task force articles",
link = "Wikipedia:WikiProject Higher education/Student Affairs",
link = "Wikipedia:WikiProject Higher education/Student Affairs",
},
aliases = {"student-affairs", "studentaffairs"}
cuny = {
},
image = "City University of New York wordmark.svg",
cuny = {
image = "City University of New York wordmark.svg",
name = "WikiProject City University of New York",
name = "WikiProject City University of New York",
nested = "City University of New York",
category = "WikiProject CUNY articles",
nested = "City University of New York",
link = "Wikipedia:WikiProject City University of New York",
category = "WikiProject CUNY articles",
},
link = "Wikipedia:WikiProject City University of New York",
uva = {
aliases = {"city-university", "nyc-university"}
image = "University of Virginia text logo.svg",
},
name = "WikiProject University of Virginia",
uva = {
image = "University of Virginia text logo.svg",
nested = "University of Virginia",
name = "WikiProject University of Virginia",
category = "WikiProject University of Virginia articles",
nested = "University of Virginia",
link = "Wikipedia:WikiProject University of Virginia",
}
category = "WikiProject University of Virginia articles",
link = "Wikipedia:WikiProject University of Virginia",
aliases = {"virginia", "u-va"}
}
}
}

-- Validate data before processing
validateTaskForceData(data)


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- End Higher education task force data
-- End Higher education task force data
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

-- Make aliases work the same as normal keys, and remove the "aliases" subtables.
-- Make aliases work the same as normal keys, and remove the "aliases" subtables.
local ret = {}
local ret= {}
for code, hetfData in pairs(data) do
for code, hetfData in pairs(data) do
hetfData.canonicalCode = code
hetfData.canonicalCode = code
if hetfData.aliases then
if hetfData.aliases then
for _, alias in ipairs(hetfData.aliases) do
for _, alias in ipairs(hetfData.aliases) do
ret[alias:lower()] = hetfData -- Case-insensitive alias lookup
ret[alias] = hetfData
end
end
hetfData.aliases = nil
hetfData.aliases = nil
end
end
ret[code] = hetfData
ret[code] = hetfData
end

-- Optional: Add a function to get all available task force codes
function ret.getAvailableCodes()
local codes = {}
for code, _ in pairs(data) do
table.insert(codes, code)
end
return codes
end
end



Revision as of 20:35, 26 March 2025

-- This module stores icon data for [[Module:Higher education task force]].

--------------------------------------------------------------------------------
-- Higher education task force data
--------------------------------------------------------------------------------

local data = {
	student = {
		image = "Nuvola apps edu languages.svg",
		name ="Student Affairs task force",
		nested ="Student Affairs",
		category = "Student Affairs task force articles",
		link = "Wikipedia:WikiProject Higher education/Student Affairs",
	},
	cuny = {
		image = "City University of New York wordmark.svg",
		name = "WikiProject City University of New York",
		nested = "City University of New York",
		category = "WikiProject CUNY articles",
		link = "Wikipedia:WikiProject City University of New York",
	},
	uva = {
		image = "University of Virginia text logo.svg",
		name = "WikiProject University of Virginia",
		nested = "University of Virginia",
		category = "WikiProject University of Virginia articles",
		link = "Wikipedia:WikiProject University of Virginia",
	}
}

--------------------------------------------------------------------------------
-- End Higher education task force data
--------------------------------------------------------------------------------

-- Make aliases work the same as normal keys, and remove the "aliases" subtables.
local ret= {}
for code, hetfData in pairs(data) do
	hetfData.canonicalCode = code
	if hetfData.aliases then
		for _, alias in ipairs(hetfData.aliases) do
			ret[alias] = hetfData
		end
		hetfData.aliases = nil
	end
	ret[code] = hetfData
end

return ret