Module:br-forme-mut

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

local p={}

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

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

function p.boite(frame)
	local args = frame:getParent().args
	local forme = args["forme"]
	forme = forme or "Forme"
	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]
	end
	local a, s, d = nil -- formes mutées : adoucissante ; spirante ; durcissante
	a, s, d = formes.formesMutees(mot)
	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,'Spirante',s,mot)
	txt = ecritureLigne(txt,'Durcissante',d,mot)
	txt = txt .. '|}'
	return txt
end

return p