Module:bac à sable/get content
Apparence
La documentation pour ce module peut être créée à Module:bac à sable/get content/Documentation
local p = {}
function p.taille_page(frame)
local contenu = mw.title.getCurrentTitle():getContent()
return mw.ustring.len(contenu)
end
function p.codes_langues(frame)
local contenu = mw.title.getCurrentTitle():getContent()
local lignes = mw.text.split(contenu, '\n');
local codesl = {};
-- Lit chaque ligne et cherche une section de langue
for i, l in ipairs(lignes) do
local code = mw.ustring.match(l, '%{%{langue%|(.+)%}%}');
if code ~= nil then
table.insert(codesl, code);
end
end
return table.concat(codesl, ' ; ');
end
return p