« Module:Nsm » : différence entre les versions

Contenu supprimé Contenu ajouté
Youni Verciti (discussion | contributions)
Youni Verciti (discussion | contributions)
Aucun résumé des modifications
Ligne 1 :
local p = require("Module:Lib namespace monitor") -- Bibliothèque
--TEST Charger toutes les tablbles ? Preload ?
local data10 = require("Module:Nsm/Table/10") -- Table espace de nom
local data11 = require("Module:Nsm/Table/11") -- Table espace de discussion
 
--TESTS
local t_prop = data10.t_prop --ATTENTION
 
-- REDIR tx (mw.site ?) number(x_prop.redirection ?)
function p.nsm(frame)
local parent_frame = frame:getParent()
if parent_frame.args[1] ~= nil then frame.args = parent_frame.args end
local r = ''
local ns_id = tonumber(frame.args[1]) -- nil si impossible number désigne id
--if frame.args[t] == 'taux' then ns_prop = talk_pages else ns_prop = t_prop end
iflocal ns_name = tostring(frame.args[1]) ==-- 'nombre'string then r = t_prop.redirectiondésigne endlabel
local t = {} -- table des résulats
if frame.args[1] == 'taux' then r = redir_tx(t_prop) end
if ns_id == nil then -- si ns_id est nul
return r
t = mw.site.namespaces[ns_name] -- reçoit le label
end
else -- si ns_id existe
 
t = mw.site.namespaces[ns_id] -- reçoit l'identifiant
function redir_tx(t) -- sous-fonction pour calcul du taux de redirection
end
local n = t_prop.redirection
return rt.name
local q = t_prop.total - n
local x = q/n
local r = x .. ' % '
return r
end
return p