%nn; %apply;a_of_b_gr_eq_lev%with; [*descendants]%nn; %and; %if;(public_name != "")%public_name;%else;%first_name;%end; %if;(qualifier != "") %qualifier;%end; %sp;%surname; %end;

%include;css %include;hed %message_to_wizard;
%include;perso_utils %if;not cancel_links; %include;menubar %include;buttons %end; %define;input(xx) Filtre xx %end; %let;birth_symbol;%if;(bvar.birth_symbol != "")%bvar.birth_symbol;%else;°%end;%in; %let;death_symbol;%if;(bvar.death_symbol != "")%bvar.death_symbol;%else;†%end;%in; %let;l_v0;%if;(evar.v > max_desc_level)%max_desc_level;%else;%evar.v;%end;%in; %let;l_v;%if;(bvar.max_desc_level = "" or bvar.max_desc_level > l_v0)%l_v0;%else;%bvar.max_desc_level;%end;%in; %define;desc1(z1,z2,z3,z4,curlev,maxlev,sp_index) %let;l1;%if;(z3z4 = "00" or z3z4 = "01") ┊%else; %end;%in; %let;l2; %if;(curlev != 0) %if;(z2 = 0) %if;(z4 = 1)%l1;┗%elseif;(z4 = 0)%l1;┣%end;%if;(child_cnt < 10)━%end;%nn; %else; %if;(z4 = 1)%l1;└%elseif;(z4 = 0)%l1;├%end;%if;(child_cnt < 10)─%end;%nn; %end; %end; %in; %let;zl1; %if;(curlev != 0) %if;(z2 = 0) %if;(z4 = 1)z1%l1; %else;z1%l1;┃%end; %else; %if;(z4 = 1)z1%l1; %else;z1%l1;│%end; %end; %end; %in; %let;zl2;%sex;%in; %if;(has_families) %let;l21; %if;(curlev != 0) %if;(not cancel_links) %child_cnt;%nn; %else; %child_cnt;%nn; %end; %end; %in; %let;l22; %if;(browsing_with_sosa_ref and has_sosa) %if;(has_siblings)▶%else;▷%end; %end; %in; %foreach;family; %let;l211;%if;(is_male)━%else;─%end;%in; %let;l212;%if;(is_male)%if;(curlev < maxlev and has_children)┳%else;━%end;%else;%if;(curlev < maxlev and has_children)┬%else;─%end;%end;%in; %let;ifam;%family.index;%in; %let;zl3;%if;(family_cnt = nb_families)1%else;0%end;%in; %if;(nb_families > 1) %let;l3; %if;(curlev != 0 and family_cnt > 1) %if;(z2 = 0) %if;(z4 = 1)%l1; %elseif;(z4 = 0)%l1;┃%end;%if;(child_cnt <10) %end;%child_cnt;%nn; %else; %if;(z4 = 1)%l1; %elseif;(z4 = 0)%l1;│%end;%if;(child_cnt <10) %end;%child_cnt;%nn; %end; %else; %l2;%l21;%nn; %end; %in; z1%l3;%if;(family_cnt>0)%apply;letter(family_cnt)%end;%l212;%l22;%nn; %else; z1%l2;%l21;%l211;%l212;%l22;%nn; %end; %apply;add_in_sorted_list(index) %apply;add_in_sorted_listc(index) %if;(family_cnt > 1 or cancel_links) %self; %dates;%if;(self.title!=""), %self.title;%end;%nn; %elseif;(not cancel_links) %self; %if;wizard;%dates;%else;%dates;%end; %if;(self.title!=""), %self.title;%end;%nn; %end; %sp;%if;(wizard and not cancel_links)%end;%if;are_engaged;&%elseif;are_married;&%elseif;not are_married;&%else;?&%end;%if;(on_marriage_date!="" or 1=1)%family.date_s;%end;%if;(wizard and not cancel_links)%end;%sp; %if;(not cancel_links) %spouse; %if;wizard;%spouse.dates;%else;%spouses.dates;%end; %if;(spouse.title!=""), %spouse.title;%end;%nn; %else; %spouse; %spouse.dates;%if;(spouse.title!=""), %spouse.title;%end;%nn; %end; %if;(spouse.first_name!="?" and spouse.surname!="?" and not spouse.is_descendant) %apply;add_in_sorted_list(spouse.index) %end; %if;(spouse.is_descendant and evar.implx="") %if;(not cancel_links) (==) %else; (==) %end; %end;
%if;(curlev < maxlev) %reset_count; %foreach;sorted_listb_item; %if;("item.1"="ifam")%incr_count;%end; %end; %reset_count1; %foreach;sorted_listc_item; %if;("item.1"="index")%incr_count1;%end; %end; %if;has_children; %foreach;child; %reset_count2; %foreach;sorted_listc_item; %if;("item.1"="child.index")%incr_count2;%end; %end; %if;(count=0 or count1=0 or count2=0 or evar.implx="") %let;zl4;%if;(child_cnt = nb_children)1%else;0%end;%in; %apply;desc1(zl1,zl2,zl3,zl4,curlev+1,maxlev,spouse.index) %else; %apply;desc2(zl1,zl2,zl3,zl4,curlev+1,maxlev,spouse.index) %end; %end; %end; %end; %apply;add_in_sorted_listb(ifam) %end; %else; %let;l23; %if;(curlev != 0) %if;(not cancel_links) %child_cnt;%nn; %else; %child_cnt;%nn; %end; %end; %in; %let;l231;%if;(is_male)━%elseif(is_female)─%else;╍%end;%in; %let;l24; %if;(browsing_with_sosa_ref and has_sosa) %if;(has_siblings)◀%else;◁%end; %end; %in; z1%l2;%l23;%l231;%l24;%nn; %reset_count; %foreach;sorted_listc_item; %if;("item.1"="index")%incr_count;%end; %end; %if;(count>0) %l231;%nn; %end; %apply;add_in_sorted_list(index) %apply;add_in_sorted_listc(index) %if;(not cancel_links) %self;%if;(self.title!=""), %self.title;%end; %else; %self; %end; %dates;%nn;
%end; %end; %define;desc2(z1,z2,z3,z4,curlev,maxlev,sp_index) %let;l1;%if;(z3z4 = "00" or z3z4 = "01") ┊%else; %end;%in; %let;l2; %if;(curlev != 0) %if;(z2 = 0) %if;(z4 = 1)%l1;┗%elseif;(z4 = 0)%l1;┣%end;%if;(child_cnt < 10)━%end;%nn; %else; %if;(z4 = 1)%l1;└%elseif;(z4 = 0)%l1;├%end;%if;(child_cnt < 10)─%end;%nn; %end; %end; %in; %let;zl1; %if;(curlev != 0) %if;(z2 = 0) %if;(z4 = 1)z1%l1; %else;z1%l1;┃%end; %else; %if;(z4 = 1)z1%l1; %else;z1%l1;│%end; %end; %end; %in; %let;zl2;%sex;%in; %let;l231;%if;(is_male)━%elseif(is_female)─%else;━%end;%in; z1%l2; %( when there is an offset between implex generations, some descendants may be missing %) %( case: first occurence at generation n is married to generation n-1 spouse and has children %) %( these children will not appear even though asking for desc up to generation n %) %if;(not cancel_links) %nn; (==) %else; %nn; (==) %end;
%end; %mark_descendants; %empty_sorted_list;%( persons %) %empty_sorted_listb;%( families %) %empty_sorted_listc;%( descendants %) %let;maxlvl;%if;(static_max_anc_level>5)5%else;%static_max_anc_level;%end;%in; %if;(has_parents and evar.templ="")

##### [*choose an ancestor]

%foreach;ancestor_level(maxlvl) %if;(level!=0)
%nn; %if;(level=1)[*parents] %elseif;(level=2)[*grand-parents] %elseif;(level=3)[*great-grand-parents] %elseif;(level=4)[*great-great-grandparents] %end;%nn;
%reset_count; %foreach;ancestor; %incr_count; %if;(count%2!=0)
%end;
%nn; %if;(ancestor.first_name!="?" and ancestor.surname!="?") %ancestor.first_name; %ancestor.surname;%if;(ancestor.dates!="") %ancestor.dates;%end; %end;
%if;(count%2=0)
%end; %end; %end; %end; %(
%if;(static_max_anc_level>5)+ %expr(static_max_anc_level-maxlvl-1) [generation/generations]1%end;
%)
%end;

### %nn; %apply;a_of_b_gr_eq_lev%with;[*descendants]%and; %if;(public_name!="")%public_name;%else;%first_name;%end; %surname; %end; %apply;togend(l_v)

[*filter by][:]%nn; %apply;input(1)%apply;input(2)%apply;input(3)%apply;input(4)%apply;input(5)
%if;(has_parents and evar.templ="" and not cancel_links)
^
%end; %apply;desc1(" 0",sex,"0","0","0",l_v,0)
%reset_count; %foreach;sorted_list_item; %incr_count; %end;
[*total][:] %apply;desc_count(max_desc_level) [descendants] (%count; [person/persons]1 [with] [spouse/spouses]1)
%base_trailer; %include;copyr
%include;js