Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Namespaces

From etna.foundation
Revision as of 09:14, 6 February 2026 by Cranio is thinking (talk | contribs) (Created page with "local p = {} local function isHiddenOrUseless(id, ns) -- escludi roba tecnica/di sistema if id < 0 then return true end if ns.name == '' then return true end -- spesso non serve elencare Talk if ns.isTalk then return true end -- escludi namespace tipici di sistema (puoi togliere ciò che vuoi) local blacklist = { ["Special"] = true, ["MediaWiki"] = true, } if blacklist[ns.name] then return true end return false end function p.list(frame) local out = {}...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

local function isHiddenOrUseless(id, ns)
	-- escludi roba tecnica/di sistema
	if id < 0 then return true end
	if ns.name == '' then return true end
	-- spesso non serve elencare Talk
	if ns.isTalk then return true end
	-- escludi namespace tipici di sistema (puoi togliere ciò che vuoi)
	local blacklist = {
		["Special"] = true,
		["MediaWiki"] = true,
	}
	if blacklist[ns.name] then return true end
	return false
end

function p.list(frame)
	local out = {}
	for id, ns in pairs(mw.site.namespaces) do
		if not isHiddenOrUseless(id, ns) then
			-- Link “home” del namespace: Nome:
			local home = string.format("[[%s:|%s:]]", ns.name, ns.name)
			-- Link a tutte le pagine del namespace
			local allpages = string.format("[[Special:AllPages?namespace=%d|pagine]]", id)

			table.insert(out, string.format("* %s (ID %d) – %s", home, id, allpages))
		end
	end
	table.sort(out)
	return table.concat(out, "\n")
end

return p