Module:Mots rishonnants
I gn a nén co di dzo-pådje /doc pol notule d’ esplikêyes. Clitchîz cial po l’ ahiver.
-- This module makes link for each argument
-- Only use with Modele:MR as :
-- {{MR|arg1|arg2|...}}
local p = {}
local builder = require("Module:Builder");
local function in_array (arr, val)
for i, v in ipairs(arr) do
if v == val then
return true
end
end
return false
end
function box(words, is_letter)
local info = "Loukîz eto"
return '<div class="mr noprint"><i>' .. info..' :</i> ' ..words .. '.</div>'
end
-- Entry point of the module
function p.init(frame)
local args = mw.getCurrentFrame():getParent().args
local pagename = mw.title.getCurrentTitle().text
local hash = {}
local words = {}
builder.init(frame)
for key,val in ipairs(args) do
val = mw.text.trim(val)
if (val ~= pagename) then
-- check duplicated word
if (not hash[val]) then
hash[val] = true
table.insert( words, "[["..mw.text.trim(val).."]]" )
else
builder.add_category("Årtikes avou des doblons dins l' modele MR")
end
end
end
words = table.concat(words, ", ")
-- make box
builder.add_content(box(words, is_letter))
return builder.get_content()
end
return p