La documentation pour ce module peut être créée à Module:lorrain/Documentation

local p = {}
local m_table = require("Module:table")


function p.patois(frame)
	local args = frame:getParent().args
	local list = {}
	local cats = {}
	for i = 1, m_table.length(args) do
		if args[i] == 'Fentsch' then
			table.insert(list, "[[Annexe:Délimitation des patois romans lorrains de Moselle par Zéliqzon#Patois de la Fentsch|de la Fentsch]]")
			if not args['nocat'] and mw.title.getCurrentTitle().namespace == 0 then	table.insert(cats, "[[Catégorie:patois de la Fentsch]]") end
		elseif args[i] == 'Pays-Haut' then
			table.insert(list, "[[Annexe:Délimitation des patois romans lorrains de Moselle par Zéliqzon#Patois du Pays-Haut|du Pays-Haut]]")
			if not args['nocat'] and mw.title.getCurrentTitle().namespace == 0 then table.insert(cats, "[[Catégorie:patois du Pays-Haut]]") end
		elseif args[i] == 'messin' then
			table.insert(list, "[[Annexe:Délimitation des patois romans lorrains de Moselle par Zéliqzon#Patois messin|messin]]")
			if not args['nocat'] and mw.title.getCurrentTitle().namespace == 0 then table.insert(cats, "[[Catégorie:patois messin]]") end
		elseif args[i] == 'Isle' then
			table.insert(list, "[[Annexe:Délimitation des patois romans lorrains de Moselle par Zéliqzon#Patois de l’Isle|de l’Isle]]")
			if not args['nocat'] and mw.title.getCurrentTitle().namespace == 0 then table.insert(cats, "[[Catégorie:patois de l’Isle]]") end
		elseif args[i] == 'Nied' then
			table.insert(list, "[[Annexe:Délimitation des patois romans lorrains de Moselle par Zéliqzon#Patois de la Nied|de la Nied]]")
			if not args['nocat'] and mw.title.getCurrentTitle().namespace == 0 then table.insert(cats, "[[Catégorie:patois de la Nied]]") end
		elseif args[i] == 'Saulnois' then
			table.insert(list, "[[Annexe:Délimitation des patois romans lorrains de Moselle par Zéliqzon#Patois du Saulnois|du Saulnois]]")
			if not args['nocat'] and mw.title.getCurrentTitle().namespace == 0 then table.insert(cats, "[[Catégorie:patois du Saulnois]]") end
		elseif args[i] == 'vosgien' then
			table.insert(list, "[[Annexe:Délimitation des patois romans lorrains de Moselle par Zéliqzon#Patois vosgien|vosgien]]")
			if not args['nocat'] and mw.title.getCurrentTitle().namespace == 0 then table.insert(cats, "[[Catégorie:patois vosgien]]") end
		end
	end
	
	return '<span id="région">\'\'(Patois ' .. (table.concat(list, ", ")) .. ')\'\'</span>' .. (table.concat(cats, ""))
end

return p