Module:Ahnentafel

--     This module uses SMW queries to assemble an array of ancestors, which it passes to the specified template.      The first parameter is the name of the target page. The second parameter is the name of the template to use

local p = {}

function p.main(frame) local a1 = frame.args[1] local templatename = frame.args[2] local a = {}   -- table to store the ancestors

a[1] = a1   for i = 1, 15 do        if a[i] == "" then a[2*i] = "" a[2*i+1] = "" else a[2*i]  = frame:expandTemplate{ title = 'getfact', args = { 'father', page = a[i] } } a[2*i+1] = frame:expandTemplate{ title = 'getfact', args = { 'mother', page = a[i] } } end end

return frame:expandTemplate{ title = templatename, args = a } end

return p