Module:br-nom

Définition, traduction, prononciation, anagramme et synonyme sur le dictionnaire libre Wiktionnaire.

 Documentation[voir] [modifier] [historique] [purger]

Ce module permet de générer un tableau donnant les différentes formes, incluant les mutations éventuelles, pour les noms bretons.

Il utilise la fonction frame:getParent, il ne peut donc être appelé que par un modèle.

Modèles qui appellent ce module

Modèle Fonction activée Utilisation
{{br-nom}} boite_sp pour les noms ayant un singulier et/ou un, deux ou trois pluriels
{{br-nom-cs}} boite_cs pour les noms ayant un collectif et un singulatif
{{br-nom-csp}} boite_csp pour les noms ayant un collectif, un singulatif et un pluriel du singulatif
{{br-nom-duel}} boite_duel pour les noms ayant un duel
{{br-nom-pr}} boite_pr pour les noms propres

Voir ces modèles pour les paramètres et les exemples d’utilisation.

Modules utilisés


local p={}

local formes = require("Module:br-formes-mutees")

function ecritureLigne2Colonnes(txt,titre,m1,mot1)
	if m1 ~= mot1 then
		txt = txt ..
			'|-\n'..
			'! ' .. titre .. '\n'..
			'| [[' .. m1 .. '#br|' .. m1 .. ']]\n'
	end
	return txt
end

function ecritureLigne3Colonnes(txt,titre,m1,mot1,m2,mot2)
	if m1 ~= mot1 or m2 ~= mot2 then
		txt = txt ..
			'|-\n'..
			'! ' .. titre .. '\n'
		if m1 == mot1 then
			txt = txt .. "| ''inchangé''\n"
		else
			txt = txt .. '| [[' .. m1 .. '#br|' .. m1 .. ']]\n'
		end
		if m2 == mot2 then
			txt = txt .. "| ''inchangé''\n"
		else
			txt = txt .. '| [[' .. m2 .. '#br|' .. m2 .. ']]\n'
		end
	end
	return txt
end

function ecritureLigne4Colonnes(txt,titre,m1,mot1,m2,mot2,m3,mot3)
	if m1 ~= mot1 or m2 ~= mot2 or m3 ~= mot3 then
		txt = txt .. 
			'|-\n'..
			'! ' .. titre .. '\n'
		if m1 == mot1 then
			txt = txt .. "| ''inchangé''\n"
		else
			txt = txt .. '| [[' .. m1 .. '#br|' .. m1 .. ']]\n'
		end
		if m2 == mot2 then
			txt = txt .. "| ''inchangé''\n"
		else
			txt = txt .. '| [[' .. m2 .. '#br|' .. m2 .. ']]\n'
		end
		if m3 == mot3 then
			txt = txt .. "| ''inchangé''\n"
		else
			txt = txt .. '| [[' .. m3 .. '#br|' .. m3 .. ']]\n'
		end
	end
	return txt
end

function ecritureLigne5Colonnes(txt,titre,m1,mot1,m2,mot2,m3,mot3,m4,mot4)
	if m1 ~= mot1 or m2 ~= mot2 or m3 ~= mot3 or m4 ~= mot4 then
		txt = txt .. 
			'|-\n'..
			'! ' .. titre .. '\n'
		if m1 == mot1 then
			txt = txt .. "| ''inchangé''\n"
		else
			txt = txt .. '| [[' .. m1 .. '#br|' .. m1 .. ']]\n'
		end
		if m2 == mot2 then
			txt = txt .. "| ''inchangé''\n"
		else
			txt = txt .. '| [[' .. m2 .. '#br|' .. m2 .. ']]\n'
		end
		if m3 == mot3 then
			txt = txt .. "| ''inchangé''\n"
		else
			txt = txt .. '| [[' .. m3 .. '#br|' .. m3 .. ']]\n'
		end
		if m4 == mot4 then
			txt = txt .. "| ''inchangé''\n"
		else
			txt = txt .. '| [[' .. m4 .. '#br|' .. m4 .. ']]\n'
		end
	end
	return txt
end

function p.boite_sp(frame) -- pour les noms ayant une forme singulière, et/ou une, deux ou trois formes plurielles
	local args = frame:getParent().args
	local singulier, pluriel, pluriel2, pluriel3 = nil, nil, nil, nil
	singulier = args[1]
	pluriel   = args[2]
	pluriel2  = args[3]
	pluriel3  = args[4]
	local forme = args["forme"]
	forme = forme or "Forme"
	txt = ""
	local as, ap, ap2, ap3, ss, sp, sp2, sp3, ds, dp, dp2, dp3, ns, np, np2, np3 = 
		nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil -- formes mutées : adoucissante ; spirante ; durcissante ; nasale
		
	as, ss, ds = formes.formesMutees(singulier)
	if pluriel3 then
		ap3, sp3, dp3 = formes.formesMutees(pluriel3)
		ap2, sp2, dp2 = formes.formesMutees(pluriel2)
		ap,  sp,  dp  = formes.formesMutees(pluriel)
		txt =
		'{| class="flextable"\n'..
		'! Mutation\n'..
		'! Singulier\n'..
		'! Pluriel 1\n'..
		'! Pluriel 2\n'..
		'! Pluriel 3\n'..
		'|-\n'..
		'! Non muté\n'..
		'| [[' .. singulier .. '#br|' .. singulier .. ']]\n'..
		'| [[' .. pluriel .. '#br|' .. pluriel .. ']]\n'..
		'| [[' .. pluriel2 .. '#br|' .. pluriel2 .. ']]\n'..
		'| [[' .. pluriel3 .. '#br|' .. pluriel3 .. ']]\n'
		txt = ecritureLigne5Colonnes(txt,'Adoucissante',as,singulier,ap,pluriel,ap2,pluriel2,ap3,pluriel3)
		txt = ecritureLigne5Colonnes(txt,'Spirante',ss,singulier,sp,pluriel,sp2,pluriel2,sp3,pluriel3)
		txt = ecritureLigne5Colonnes(txt,'Durcissante',ds,singulier,dp,pluriel,dp2,pluriel2,dp3,pluriel3)
		if args["nasale"] then -- pour "dor" et ses dérivés
			local ns = "n" .. mw.ustring.sub(singulier,2)
			local np = "n" .. mw.ustring.sub(pluriel,2)
			local np2 = "n" .. mw.ustring.sub(pluriel2,2)
			local np3 = "n" .. mw.ustring.sub(pluriel3,2)
			txt = ecritureLigne5Colonnes(txt,'Nasale',ns,singulier,np,pluriel,np2,pluriel2,np3,pluriel3)
		end
		txt = txt .. '|}'
		if not(mw.ustring.match(txt,'Adoucissante') or
			   mw.ustring.match(txt,'Spirante') or
			   mw.ustring.match(txt,'Durcissante')) then
			txt =
				'{| class="flextable"\n'..
				'! Singulier\n'..
				'! Pluriel 1\n'..
				'! Pluriel 2\n'..
				'! Pluriel 3\n'..
				'|-\n'..
				'| [[' .. singulier .. '#br|' .. singulier .. ']]\n'..
				'| [[' .. pluriel .. '#br|' .. pluriel .. ']]\n'..
				'| [[' .. pluriel2 .. '#br|' .. pluriel2 .. ']]\n'..
				'| [[' .. pluriel3 .. '#br|' .. pluriel3 .. ']]\n'..
				'|}'
		end
	elseif pluriel2 then
		ap2, sp2, dp2 = formes.formesMutees(pluriel2)
		ap,  sp,  dp  = formes.formesMutees(pluriel)
		txt =
		'{| class="flextable"\n'..
		'! Mutation\n'..
		'! Singulier\n'..
		'! Pluriel 1\n'..
		'! Pluriel 2\n'..
		'|-\n'..
		'! Non muté\n'..
		'| [[' .. singulier .. '#br|' .. singulier .. ']]\n'..
		'| [[' .. pluriel .. '#br|' .. pluriel .. ']]\n'..
		'| [[' .. pluriel2 .. '#br|' .. pluriel2 .. ']]\n'
		txt = ecritureLigne4Colonnes(txt,'Adoucissante',as,singulier,ap,pluriel,ap2,pluriel2)
		txt = ecritureLigne4Colonnes(txt,'Spirante',ss,singulier,sp,pluriel,sp2,pluriel2)
		txt = ecritureLigne4Colonnes(txt,'Durcissante',ds,singulier,dp,pluriel,dp2,pluriel2)
		if args["nasale"] then -- pour "dor" et ses dérivés
			local ns = "n" .. mw.ustring.sub(singulier,2)
			local np = "n" .. mw.ustring.sub(pluriel,2)
			local np2 = "n" .. mw.ustring.sub(pluriel2,2)
			txt = ecritureLigne4Colonnes(txt,'Nasale',ns,singulier,np,pluriel,np2,pluriel2)
		end
		txt = txt .. '|}'
		if not(mw.ustring.match(txt,'Adoucissante') or
			   mw.ustring.match(txt,'Spirante') or
			   mw.ustring.match(txt,'Durcissante')) then
			txt =
				'{| class="flextable"\n'..
				'! Singulier\n'..
				'! Pluriel 1\n'..
				'! Pluriel 2\n'..
				'|-\n'..
				'| [[' .. singulier .. '#br|' .. singulier .. ']]\n'..
				'| [[' .. pluriel .. '#br|' .. pluriel .. ']]\n'..
				'| [[' .. pluriel2 .. '#br|' .. pluriel2 .. ']]\n'..
				'|}'
		end
	elseif pluriel then
		ap,  sp,  dp  = formes.formesMutees(pluriel)
		txt =
		'{| class="flextable"\n'..
		'! Mutation\n'..
		'! Singulier\n'..
		'! Pluriel\n'..
		'|-\n'..
		'! Non muté\n'..
		'| [[' .. singulier .. '#br|' .. singulier .. ']]\n'..
		'| [[' .. pluriel .. '#br|' .. pluriel .. ']]\n'
		txt = ecritureLigne3Colonnes(txt,'Adoucissante',as,singulier,ap,pluriel)
		txt = ecritureLigne3Colonnes(txt,'Spirante',ss,singulier,sp,pluriel)
		txt = ecritureLigne3Colonnes(txt,'Durcissante',ds,singulier,dp,pluriel)
		if args["nasale"] then -- pour "dor" et ses dérivés
			local ns = "n" .. mw.ustring.sub(singulier,2)
			local np = "n" .. mw.ustring.sub(pluriel,2)
			txt = ecritureLigne3Colonnes(txt,'Nasale',ns,singulier,np,pluriel)
		end
		txt = txt .. '|}'
		if not(mw.ustring.match(txt,'Adoucissante') or
			   mw.ustring.match(txt,'Spirante') or
			   mw.ustring.match(txt,'Durcissante')) then
			txt =
				'{| class="flextable"\n'..
				'! Singulier\n'..
				'! Pluriel\n'..
				'|-\n'..
				'| [[' .. singulier .. '#br|' .. singulier .. ']]\n'..
				'| [[' .. pluriel .. '#br|' .. pluriel .. ']]\n'..
				'|}'
		end
	else
		txt =
		'{| class="flextable"\n'..
		'! Mutation\n'..
		'! ' .. forme .. '\n'..
		'|-\n'..
		'! Non muté\n'..
		'| [[' .. singulier .. '#br|' .. singulier .. ']]\n'



		
		txt = ecritureLigne2Colonnes(txt,'Adoucissante',as,singulier)
		txt = ecritureLigne2Colonnes(txt,'Spirante',ss,singulier)
		txt = ecritureLigne2Colonnes(txt,'Durcissante',ds,singulier)
		if args["nasale"] then -- pour "dor" et ses dérivés
			local ns = "n" .. mw.ustring.sub(singulier,2)
			txt = ecritureLigne2Colonnes(txt,'Nasale',ns,singulier)
		end
		txt = txt .. '|}'
		if not(mw.ustring.match(txt,'Adoucissante') or
			   mw.ustring.match(txt,'Spirante') or
			   mw.ustring.match(txt,'Durcissante')) then
			txt =
				'{| class="flextable"\n'..
				'! ' .. forme .. '\n'..
				'|-\n'..
				'| [[' .. singulier .. '#br|' .. singulier .. ']]\n'..
				'|}'
		end

	end	
	return txt
end

function p.boite_cs(frame) -- pour les noms ayant deux formes : collectif ; singulatif
	local args = frame:getParent().args
	local collectif  = args[1]
	local singulatif = args[2]
	singulatif = singulatif or collectif .. "enn"
	local ac, as, sc, ss, dc, ds = 
		nil, nil, nil, nil, nil, nil -- formes mutées : adoucissante ; spirante ; durcissante
	
	ac, sc, dc = formes.formesMutees(collectif)
	as, ss, ds = formes.formesMutees(singulatif)
	local txt =
		'{| class="flextable"\n'..
		'! Mutation\n'..
		'! Collectif\n'..
		'! Singulatif\n'..
		'|-\n'..
		'! Non muté\n'..
		'| [[' .. collectif .. '#br|' .. collectif .. ']]\n'..
		'| [[' .. singulatif .. '#br|' .. singulatif .. ']]\n'
	txt = ecritureLigne3Colonnes(txt,'Adoucissante',ac,collectif,as,singulatif)
	txt = ecritureLigne3Colonnes(txt,'Spirante',sc,collectif,ss,singulatif)
	txt = ecritureLigne3Colonnes(txt,'Durcissante',dc,collectif,ds,singulatif)
	txt = txt .. '|}'
	if not(mw.ustring.match(txt,'Adoucissante') or
		   mw.ustring.match(txt,'Spirante') or
		   mw.ustring.match(txt,'Durcissante')) then
		txt =
			'{| class="flextable"\n'..
			'! Collectif\n'..
			'! Singulatif\n'..
			'|-\n'..
			'| [[' .. collectif .. '#br|' .. collectif .. ']]\n'..
			'| [[' .. singulatif .. '#br|' .. singulatif .. ']]\n'..
			'|}'
	end
	return txt
end

function p.boite_csp(frame) -- pour les noms ayant trois formes : collectif ; singulatif ; pluriel
	local args = frame:getParent().args
	local collectif  = args[1]
	local singulatif = args[2]
	local pluriel    = args[3]
	singulatif = singulatif or collectif .. "enn"
	pluriel = pluriel or singulatif .. "où"
	local ac, as, ap, sc, ss, sp, dc, ds, dp = 
		nil, nil, nil, nil, nil, nil, nil, nil, nil -- formes mutées : adoucissante ; spirante ; durcissante
	
	ac, sc, dc = formes.formesMutees(collectif)
	as, ss, ds = formes.formesMutees(singulatif)
	ap, sp, dp = formes.formesMutees(pluriel)
	local txt =
		'{| class="flextable"\n'..
		'! Mutation\n'..
		'! Collectif\n'..
		'! Singulatif\n'..
		'! Pluriel\n'..
		'|-\n'..
		'! Non muté\n'..
		'| [[' .. collectif .. '#br|' .. collectif .. ']]\n'..
		'| [[' .. singulatif .. '#br|' .. singulatif .. ']]\n'..
		'| [[' .. pluriel .. '#br|' .. pluriel .. ']]\n'
	txt = ecritureLigne4Colonnes(txt,'Adoucissante',ac,collectif,as,singulatif,ap,pluriel)
	txt = ecritureLigne4Colonnes(txt,'Spirante',sc,collectif,ss,singulatif,sp,pluriel)
	txt = ecritureLigne4Colonnes(txt,'Durcissante',dc,collectif,ds,singulatif,dp,pluriel)
	txt = txt .. '|}'
	if not(mw.ustring.match(txt,'Adoucissante') or
		   mw.ustring.match(txt,'Spirante') or
		   mw.ustring.match(txt,'Durcissante')) then
		txt =
			'{| class="flextable"\n'..
			'! Collectif\n'..
			'! Singulatif\n'..
			'! Pluriel\n'..
			'|-\n'..
			'| [[' .. collectif .. '#br|' .. collectif .. ']]\n'..
			'| [[' .. singulatif .. '#br|' .. singulatif .. ']]\n'..
			'| [[' .. pluriel .. '#br|' .. pluriel .. ']]\n'..
			'|}'
	end
	return txt
end

function p.boite_duel(frame) -- pour les noms ayant une forme duelle
	local args = frame:getParent().args
	local singulier = args[1]
	local duel      = args[2]
	local pluriel   = args[3]
	local plurDuel  = args[4]
	mot = {nil, nil, nil, nil}
	n = 1
	local txt1, txt2, txt3 = "", "", ""
	if singulier ~= "" then
		mot[n] = singulier
		n = n + 1
		txt1 = txt1 .. '! Singulier\n'
	end
		mot[n] = duel
		n = n + 1
		txt1 = txt1 .. '! Duel\n'
	if pluriel and (pluriel ~= "")  then
		mot[n] = pluriel
		n = n + 1
		txt1 = txt1 .. '! Pluriel\n'
	end
	if plurDuel then
		mot[n] = plurDuel
		n = n + 1
		txt1 = txt1 .. '! Pluriel duel\n'
	end
	
	local a1, a2, a3, a4, s1, s2, s3, s4, d1, d2, d3, d4 = 
		nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil -- formes mutées : adoucissante ; spirante ; durcissante
	
	a1, s1, d1 = formes.formesMutees(mot[1])
	if n == 2 then
		txt2 = 
		'| [[' .. mot[1] .. '#br|' .. mot[1] .. ']]\n'
		
		txt3 = ecritureLigne2Colonnes(txt3,'Adoucissante',a1,mot[1])
		txt3 = ecritureLigne2Colonnes(txt3,'Spirante',s1,mot[1])
		txt3 = ecritureLigne2Colonnes(txt3,'Durcissante',d1,mot[1])
	
	elseif n == 3 then
		a2, s2, d2 = formes.formesMutees(mot[2])
		txt2 = 
		'| [[' .. mot[1] .. '#br|' .. mot[1] .. ']]\n'..
		'| [[' .. mot[2] .. '#br|' .. mot[2] .. ']]\n'
		
		txt3 = ecritureLigne3Colonnes(txt3,'Adoucissante',a1,mot[1],a2,mot[2])
		txt3 = ecritureLigne3Colonnes(txt3,'Spirante',s1,mot[1],s2,mot[2])
		txt3 = ecritureLigne3Colonnes(txt3,'Durcissante',d1,mot[1],d2,mot[2])
	
	elseif n == 4 then
		a2, s2, d2 = formes.formesMutees(mot[2])
		a3, s3, d3 = formes.formesMutees(mot[3])
		txt2 = 
		'| [[' .. mot[1] .. '#br|' .. mot[1] .. ']]\n'..
		'| [[' .. mot[2] .. '#br|' .. mot[2] .. ']]\n'..
		'| [[' .. mot[3] .. '#br|' .. mot[3] .. ']]\n'
		
		txt3 = ecritureLigne4Colonnes(txt3,'Adoucissante',a1,mot[1],a2,mot[2],a3,mot[3])
		txt3 = ecritureLigne4Colonnes(txt3,'Spirante',s1,mot[1],s2,mot[2],s3,mot[3])
		txt3 = ecritureLigne4Colonnes(txt3,'Durcissante',d1,mot[1],d2,mot[2],d3,mot[3])
	
	elseif n == 5 then
		a2, s2, d2 = formes.formesMutees(mot[2])
		a3, s3, d3 = formes.formesMutees(mot[3])
		a4, s4, d4 = formes.formesMutees(mot[4])
		txt2 = 
		'| [[' .. mot[1] .. '#br|' .. mot[1] .. ']]\n'..
		'| [[' .. mot[2] .. '#br|' .. mot[2] .. ']]\n'..
		'| [[' .. mot[3] .. '#br|' .. mot[3] .. ']]\n'..
		'| [[' .. mot[4] .. '#br|' .. mot[4] .. ']]\n'
		
		txt3 = ecritureLigne5Colonnes(txt3,'Adoucissante',a1,mot[1],a2,mot[2],a3,mot[3],a4,mot[4])
		txt3 = ecritureLigne5Colonnes(txt3,'Spirante',s1,mot[1],s2,mot[2],s3,mot[3],s4,mot[4])
		txt3 = ecritureLigne5Colonnes(txt3,'Durcissante',d1,mot[1],d2,mot[2],d3,mot[3],d4,mot[4])
		
	end
	
	if txt3 == "" then
		txt = '{| class="flextable"\n' .. txt1 .. '|-\n' .. txt2 .. '|}'
	else
		txt =
		'{| class="flextable"\n'..
		'! Mutation\n'..
		txt1 ..
		'|-\n'..
		'! Non muté\n'..
		txt2 ..
		txt3 ..
		'|}'
	end
	return txt
end

function p.boite_pr(frame) -- pour les noms propres
	local args = frame:getParent().args
	local nom  = args[1] or mw.title.getCurrentTitle().text
    local forme = args["forme"]
	forme = forme or "Nom"
	local an, sn, dn = nil, nil, nil -- formes mutées : adoucissante ; spirante ; durcissante
	an, sn, dn = formes.formesMutees(nom)
	local txt =
		'{| class="flextable"\n'..
		'! Mutation\n'..
        '! ' .. forme .. '\n'..
		'|-\n'..
		'! Non muté\n'..
		'| [[' .. nom .. '#br|' .. nom .. ']]\n'
	txt = ecritureLigne2Colonnes(txt,'Adoucissante',an,nom)
	txt = txt .. '|}'
	if not(mw.ustring.match(txt,'Adoucissante')) then
		txt =
			'{| class="flextable"\n'..
			'! Invariable\n'..
			'|-\n'..
			'| [[' .. nom .. '#br|' .. nom .. ']]\n'..
			'|}'
	end
	return txt
end

return p