Module:data/namespaces

From Linguifex
Revision as of 10:18, 8 August 2024 by Sware (talk | contribs) (Created page with "local data = {} local gsub = string.gsub local next = next local ulower = require("Module:string utilities").lower for _, namespace in next, mw.site.namespaces do local prefix = ulower((gsub(namespace.name, "_", " "))) data[prefix] = prefix for _, alias in next, namespace.aliases do data[ulower((gsub(alias, "_", " ")))] = prefix end end return data")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:data/namespaces/doc

local data = {}

local gsub = string.gsub
local next = next
local ulower = require("Module:string utilities").lower

for _, namespace in next, mw.site.namespaces do
	local prefix = ulower((gsub(namespace.name, "_", " ")))
	data[prefix] = prefix
	for _, alias in next, namespace.aliases do
		data[ulower((gsub(alias, "_", " ")))] = prefix
	end
end

return data