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: Difference between revisions

From etna.foundation
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 = {}..."
 
No edit summary
Line 1: Line 1:
local p = {}
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)
function p.list(frame)
local out = {}
local out = {}
for id, ns in pairs(mw.site.namespaces) do
for id, ns in pairs(mw.site.namespaces) do
if not isHiddenOrUseless(id, ns) then
-- escludo namespace tecnici/strani
-- Link “home” del namespace: Nome:
if id >= 0 and ns.name and ns.name ~= '' and not ns.isTalk then
local home = string.format("[[%s:|%s:]]", ns.name, ns.name)
-- solo nome (testo), niente link
-- Link a tutte le pagine del namespace
table.insert(out, ns.name)
local allpages = string.format("[[Special:AllPages?namespace=%d|pagine]]", id)
 
table.insert(out, string.format("* %s (ID %d) – %s", home, id, allpages))
end
end
end
end
table.sort(out)
table.sort(out)
return table.concat(out, "\n")
return table.concat(out, "\n")

Revision as of 09:25, 6 February 2026

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

local p = {}

function p.list(frame)
	local out = {}

	for id, ns in pairs(mw.site.namespaces) do
		-- escludo namespace tecnici/strani
		if id >= 0 and ns.name and ns.name ~= '' and not ns.isTalk then
			-- solo nome (testo), niente link
			table.insert(out, ns.name)
		end
	end

	table.sort(out)
	return table.concat(out, "\n")
end

return p