Module:Correction syntaxique

De Lagny-sur-Marne Wiki
Aller à la navigation Aller à la recherche

local p = {}

function p.verifierLesArguments(frame)

   local passed_args = frame:getParent().args
   local modele_args = frame.args
   local rv = ""
   local nombre = 0
   for a,b in pairs(passed_args) do
       if (modele_args[a] == nil and b ~= "") then
           nombre = nombre + 1

rv = rv .. '

"

       end
   end
   if (nombre > 0) then
       local categorie
       if (modele_args["_catégorie"] and modele_args["_catégorie"] ~= "") then
           categorie = tostring(mw.title.new(modele_args["_catégorie"], "Catégorie"))
       else
           categorie = "Catégorie:Page appelant un modèle avec un paramètre inconnu"
       end
       if (nombre > 10) then
           rv = rv .. "+"
       else
           rv = rv .. "" .. categorie .. ""
       end
   end
   return rv

end

return p