La documentation pour ce module peut être créée à Module:ga-mutation/Documentation
local m_params = require("Module:paramètres")
local m_ga_common = require("Module:ga-common")
local export = {}
local function replace(forms, param)
local form = forms
if param ~= "normal" and form == forms then
return "''pas applicable''"
end
local ret = "]"
if param == "len" and forms.an ~= forms.normal then
ret = ret .. "<br/>''après an'', ]"
end
return ret
end
local table_cons = [=[
{| class="wikitable centre"
|-
! colspan="3" | ]
|-
! Radical
! ]
! ]
|-
| {{{normal}}}
| {{{len}}}
| {{{ecl}}}
|-
| colspan="3" | <small style="font-size:85%;">''Note :'' Toutes les formes mutées d'un mot ne sont pas nécessairement utilisées.</small>
|}]=]
function export.mut_cons(frame)
local params = {
= { required = true, default = "{{{1}}}" },
= { required = true, default = "{{{2}}}" },
}
local args = m_params.process(frame:getParent().args, params)
local forms = m_ga_common.mutations(args .. args)
return (mw.ustring.gsub(table_cons, "{{{(+)}}}", function(param)
return replace(forms, param)
end))
end
local table_vowel = [=[
{| class="wikitable centre"
|-
! colspan="4" | ]
|-
! Radical !! ] !! ] en « h » !! ] en « t »
|-
| {{{normal}}}
| {{{ecl}}}
| {{{hpro}}}
| {{{tpro}}}
|-
| colspan="4" | <small style="font-size:85%;">''Note :'' Toutes les formes mutées d'un mot ne sont pas nécessairement utilisées.</small>
|}]=]
function export.mut_vowel(_)
local forms = m_ga_common.mutations(mw.title.getCurrentTitle().subpageText, "msn")
return (mw.ustring.gsub(table_vowel, "{{{(+)}}}", function(param)
return replace(forms, param)
end))
end
function export.mut(frame)
local params = {
= {},
= {}
}
local args = m_params.process(frame:getParent().args, params)
local word = mw.title.getCurrentTitle().subpageText
if args then
word = args
end
local forms = m_ga_common.mutations(word, args)
local wikicode = mw.ustring.find(mw.ustring.lower(word), "^") and table_vowel or table_cons
return (mw.ustring.gsub(wikicode, "{{{(+)}}}", function(param)
return replace(forms, param)
end))
end
return export