local fun = {}
local wikidata = require( "Modul:Wikidata" )
function fun.genderChanger(name, gender)
local labelActivity = ""
if gender == 'Q6581072' then -- femme : chercher le libellé dans P2521 (libellé féminin)
labelActivity = wikidata.findClaims(name,'P2521')
elseif gender == 'Q6581097' then -- homme : chercher le libellé dans P3321 (libellé masculin)
labelActivity = wikidata.findClaims(name,'P3321')
end
return labelActivity
end
function fun.split(parameters)
local num = 0
local result = ""
local a = {}
for i in string.gmatch(parameters, '([^,]+)') do
a[num]=i
num = num + 1
end
return a
end
function fun.getActivitiesWithRightGender(parameters)
local labelActivities = ""
local listActivities = fun.split(parameters.args[1])
for i, name in ipairs(listActivities) do
labelActivities = labelActivities .. " "..fun.genderChanger(name, parameters.args[2])
end
return labelActivities
end
return fun