%include;ancsosa_deslist
%define;one_ancestor()
%apply;link1("ancestor","ancestor")
%apply;somebody_info1("ancestor")
%apply;somebody_info2("ancestor")
%end;
%define;one_child()
%let;l1;%child.sosa_in_list;%in;
%if;(l1 != "" and evar.only != "on" and level != 2)
%apply;link1("child",lchild)
%child.title;%child.dates;
%sp;(⇒
%l1;%nn;
.)%nn;
%else;
%apply;link1("child",lchild)
%apply;somebody_info1("child")
%apply;somebody_info2("child")
%if;(evar.spouse = "on")
%foreach;child.family;
%apply;marriage_info()
%apply;link1("spouse","spouse")
%apply;somebody_info1("spouse")
%apply;somebody_spouse_parent()
%apply;somebody_info2("spouse")
%end;
%end;
%end;
%end;
%define;other_family(z1)
%if;(evar.spouse = "on" and evar.siblings = "on" and ancestor.nb_families > 1)
-
%foreach;ancestor.family;
%if;(spouse.index != ancestor.spouse.index)
%family.z1.sosa_in_list;
-(X%family_cnt;) :
%apply;link1("spouse","spouse")
%apply;somebody_info1("spouse")
%apply;somebody_spouse_parent()
%apply;somebody_info2("spouse")
%apply;marriage_info()
%if;(nb_children > 0)
%foreach;child;
-
%apply;one_child()%nn;
%end;
%end;
%end;
%end;
%end;
%end;
%define;ancestor_families()
%if;(ancestor.anc_sosa.v % 2 = 0)
%apply;other_family("father")
%else;
%foreach;ancestor.family;
%if;(family.index = ancestor.family.index)
%apply;marriage_info()
%foreach;child;
%if;(evar.siblings = "on")
- %apply;one_child()
%elseif;(child.sosa_in_list != "")
- %apply;one_child()
%end;
%end;
%end;
%end;
%apply;other_family("mother")
%end;
%end;
%define;tGup()
%( ;t=G;i1=index; up to somebody %)
[*up to] %pvar.1; %pvar.1.dates;
%reset_count;
%pvar.1.mark_descendants;
%foreach;ancestor_level;
%apply;lazy_print%with;
[*generation/generations]0 %level;
%end;
%if;(level <= evar.l + 1)
%foreach;ancestor;
%if;(level != 1 and ancestor.same = "" and (ancestor.is_descendant or ancestor.spouse.is_descendant))
%lazy_force;
%apply;link_parents()
%nn;.%sp;
%apply;one_ancestor()
%apply;ancestor_families()
%end;
%end;
%end;
%end;
%end;
%define;tG()
%( ;t=G; long display %)
%reset_count;
%if;(evar.only != "on")
%apply;togen()
%end;
%foreach;ancestor_level(l_v)
%if;(level != 1 and (evar.only != "on" or level = l_v))
[*generation/generations]0 %level;
%foreach;ancestor;
%if;(ancestor.same = "")
%apply;link_parents()
%nn;.%sp;
%apply;one_ancestor()
%if;(ancestor.index != self.index)
%apply;ancestor_families()
%end;
%else;
%ancestor.anc_sosa;.
%if;(not cancel_links)
%ancestor;
%ancestor.title;%ancestor.dates; (==
%ancestor.same;.)
%else;
%ancestor; %ancestor.title;%ancestor.dates; (== %ancestor.same;.)
%end;
%end;
%end;
%end;
%end;
%end;
%( main %)
%if;(l_up = 1)
%apply;tGup()
%else;
%apply;tG()
%end;