La documentation pour ce module peut être créée à Module:conjugaison/Documentation
local m_langs = require("Module:langues")
local m_bases = require("Module:bases")
local m_table = require("Module:table")
local m_params = require("Module:paramètres")
local p = {}
local groups = { "Premier", "Deuxième", "Troisième", "Quatrième" }
local types = {
p = "parisyllabiques",
i = "imparisyllabiques",
c = "contractes",
}
local function getLangAppendixLink(groupNb, langName)
local groupName = groups or (tostring(groupNb) .. "e")
local exp = mw.getCurrentFrame():expandTemplate { title = (groupNb == 1 and "er" or "e") }
return mw.ustring.format(
"]",
langName,
groupName,
groupNb,
exp
)
end
function p._conjugaison(verb, group, group2, langCode, type, pronominal, defective, section, noCat)
local wikicode = ""
local langName = m_langs.getName(langCode)
local categories = {}
if group then
wikicode = wikicode .. getLangAppendixLink(group, langName)
if group2 then
wikicode = wikicode .. " ou " .. getLangAppendixLink(group2, langName)
end
end
if pronominal then
if group then
wikicode = wikicode .. ", "
end
wikicode = wikicode .. "'']''"
table.insert(categories, "Verbes pronominaux en " .. langName)
end
if defective then
if group or pronominal then
wikicode = wikicode .. ", "
end
wikicode = wikicode .. "'']''"
table.insert(categories, "Verbes défectifs en " .. langName)
end
local text = '<span style="font-size: 100%; font-weight: bold; font-variant: small-caps">voir la conjugaison</span>'
if wikicode ~= "" then
wikicode = wikicode .. " "
end
pattern = ""
if m_bases.page_existe(mw.ustring.format("Conjugaison:%s/%s", langName, verb)) then
pattern = "(])"
elseif m_bases.page_existe(mw.ustring.format("Conjugaison:%s/%s", langName, verb)) then
pattern = "(])"
else
pattern = "(])"
end
wikicode = wikicode .. mw.ustring.format(
pattern,
langName,
verb,
section and ("#" .. section) or "",
text
)
if group then
table.insert(categories, mw.ustring.format(
"Verbes du %s groupe en %s",
groups and mw.ustring.lower(groups) or (tostring(group) .. "e"),
langName
))
end
if group2 then
table.insert(categories, mw.ustring.format(
"Verbes du %s groupe en %s",
groups and mw.ustring.lower(groups) or (tostring(group2) .. "e"),
langName
))
end
if type then
table.insert(categories, mw.ustring.format("Verbes %s en %s", types, langName))
end
if not m_bases.page_existe(mw.ustring.format("Conjugaison:%s/%s", langName, verb)) and not m_bases.page_existe(mw.ustring.format("Conjugaison:%s/%s", langName, verb)) then
table.insert(categories, "Wiktionnaire:Conjugaisons manquantes en " .. langName)
end
if not noCat then
wikicode = wikicode .. table.concat(m_table.map(categories, m_bases.fait_categorie_contenu), "\n")
end
return wikicode
end
function p.conjugaison(frame)
local function groupChecker(nb)
return nb >= 1
end
local args = m_params.process(frame:getParent().args, {
= { type = m_params.INT, checker = groupChecker },
= { alias_of = "groupe" },
= { type = m_params.INT, checker = groupChecker },
= { alias_of = "groupe2" },
= { checker = function(v)
return m_langs.getName(v)
end },
= { alias_of = "lang" },
= { checker = function(v)
return types
end },
= { type = m_params.BOOLEAN, default = false },
= { type = m_params.BOOLEAN, default = false },
= { default = mw.title.getCurrentTitle().text },
= { alias_of = "verbe" },
= {},
= { type = m_params.BOOLEAN, default = false },
})
return p._conjugaison(
args,
args,
args,
args or "fr",
args,
args,
args,
args,
args
)
end
return p