local function getValue(param, year)
result = ""
for i=1,maxInterval do
currentYear = args["anno" .. i]
if currentYear > year then break end
temp = args[param .. i]
if temp ~=nil then
result = args[param .. i]
end
end
return result
end
function p.get(frame)
local pframe = frame:getParent()
for k, v in pairs( pframe.args ) do
-- mappo gli argomenti del template
if v ~=nil then args[k] = v end
-- cerco l'intervallo più recente in base al numero più alto fra "nomeN", "voceN" e "immN"
num = string.match(k, "(?:nome|voce|imm)(%d+)$")
if num then
if tonumber(num) > maxInterval then
maxInterval = num
end
end
end
end
local year = args["anno"]
if year == nil then year = getValue("anno", maxInterval) end
print(frame.args[1])
return getValue(frame.args[1], year)
end
|