Module:br-verbe-mut

La documentation pour ce module peut être créée à Module:br-verbe-mut/Documentation

local p={}

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

function ecritureLigne(txt,titre,motMut,mot)
	txt = txt ..
		'|-\n'..
		'! ' .. titre .. '\n'..
		'| [[' .. motMut .. '#br|' .. motMut .. ']]\n'
	return txt
end

function p.boite(frame)
	local args = frame:getParent().args
	local mot = ""
	if args[2] then -- pour prendre en compte l'ancienne syntaxe du modèle:br-forme-mut
		mot = args[1] .. args[2]
	else
		mot = args[1] or args["nm"] or mw.title.getCurrentTitle().text -- forme non mutée passée dans l'argument 1 ou "nm"
	end
	local a, s, d, m = nil, nil, nil, nil -- formes mutées : adoucissante ; spirante ; durcissante ; mixte
	a, s, d, m = formes.formesMutees(mot)
	a = args["ad"] or a               -- forme adoucie passée dans l'argument "ad"
	m = args["mi"] or args["sr"] or m -- forme mixte passée dans l'argument "mi" ou "sr"
	local txt =
		'{| class="flextable"\n'..
		'! Mutation\n'..
		'! Forme\n'..
		'|-\n'..
		'! Non muté\n'..
		'| [[' .. mot .. '#br|' .. mot .. ']]\n'
	txt = ecritureLigne(txt,'Adoucissante',a,mot)
	txt = ecritureLigne(txt,'Mixte',m,mot)
	txt = txt .. '|}'
	return txt
end

return p