%include;perso_utils
%define;get_ip(n)
%evar.in;
%end;
%define;get_var(vv, i)
%evar_cur.vv.i;
%end;
%define;get_pl(i)
%evar.pi;
%end;
%define;get_sub(nn,ss)
%substr_start.nn.ss;
%end;
%( %qvar.index.marriage_places; renvoie une chaine avec les places de mariage, séparées par des | %)
%define;get_marriage(index)
%qvar.index.marriage_places;
%end;
%define;get_value(index,param)
%qvar.index.param;
%end;
%let;nb;%evar.nb;%in;
[*list/list (ancestors)] [of] [person/persons]1%if;(evar.surn!="") [by] [surname/surnames]0%end; [by] [place]
%let;opt;%nn;
%if;(evar.bi="on")&bi=on%end;%nn;
%if;(evar.bp="on")&bp=on%end;%nn;
%if;(evar.ma="on")&ma=on%end;%nn;
%if;(evar.de="on")&de=on%end;%nn;
%if;(evar.bu="on")&bu=on%end;%nn;
%if;(evar.long="on")&long=on%end;%nn;
%if;(evar.f_sort="on")&f_sort=on%end;%in;
%let;k;%if;(evar.k!="")%evar.k;%end;%in;
%let;nbs;%if;(evar.nbs!="")&nbs=%evar.nbs;%else;nbs=3%end;%in;
%define;book_of(xx)[*book of %s:::xx]%end;
%if;(evar.surn!="")[*surname/surnames]0[:] %evar.surn;.%end;
[*event/events]1%if;(evar.date_sort="on")
%sp;[sorted by]%sp;
%if;(evar.date_sort="on")[date/dates]1%nn;
%else;[sort by/branch/alphabetic order]2 ([first name/first names]1)%nn;
%end;
%end;[:]%sp;
%define;evt(vv,tt,ii)
%if;("vv"!="bi"), %end;tt ii%nn;
%end;
%apply;evt("bi",[birth],"N")
%apply;evt("bp",[baptism],"B")
%apply;evt("ma",[marriage event],"M")
%apply;evt("de",[death],"D")
%apply;evt("bu",[burial],"S").
%define;nbmds(xx,yy,tt,kk)
%if;(xx is_substr "kk" or xx="kk")yy%nn;
%else;%if;("tt"=1) %end;
%end;
%end;
%define;tags(xx,tt,ss)
%let;index;xx%in;
%let;birthplace;%apply;get_value(index, "birth_place")%in;
%let;baptismplace;%apply;get_value(index, "baptism_place")%in;
%let;marriageplace;%apply;get_marriage(index)%in;
%let;deathplace;%apply;get_value(index, "death_place")%in;
%let;burialplace;%apply;get_value(index, "burial_place")%in;
%apply;nbmds("birthplace","N","tt","ss")%nn;
%apply;nbmds("baptismplace","B","tt","ss")%nn;
%apply;nbmds("marriageplace","M","tt","ss")%nn;
%apply;nbmds("deathplace","D","tt","ss")%nn;
%apply;nbmds("burialplace","S","tt","ss")%nn;
%end;
%let;max_rlm_nbr;%if;(evar.max_rlm_nbr!="")%evar.max_rlm_nbr;%elseif;(bvar.max_rlm_nbr!="")%bvar.max_rlm_nbr;%else;80%end;%in;
%( RLM commence a i1 et non i0 on décale i(0) en i(nb), à défaut on pourrait aussi tout décaller à i+1 %)
%if;(nb < max_rlm_nbr)
%if;(nb!=1)
%nn;
[*multi relations graph] (%nb;)%nn;
%end;
%else;
[*multi relations graph] (%nb;)
[*rlm_nbr too large]
%end;
%empty_sorted_list
%for;i;0;nb;
%let;index;%apply;get_ip(i)%in;
%let;first_name;%apply;get_value(index, "first_name")%in;
%let;surname;%apply;get_value(index, "surname")%in;
%let;occ;%apply;get_value(index, "occ")%in;
%let;dates;%apply;get_value(index, "dates_sort")%in;
%let;s;%apply;get_var("p", i)%in;
%let;so;%if;(s="")%k;%else;%s;%end;%in;
%if;(evar.date_sort="on")
%apply;add_in_sorted_list%with;
%so;%and;
%dates;%and;
%index;%and;
%i;%and;
%end;
%else;
%apply;add_in_sorted_list%with;
%so;%and;
%if;(evar.surn="")%surname;%end;%first_name;%occ;%and;
%index;%and;
%i;%and;
%end;
%end;
%end;
%foreach;sorted_list_item;
%let;sub;%apply;get_sub(3,item.1)%in;
%if;(item.1!=prev_item.1 or prev_item.1="")
%if;(k!="")%item.1;%end;
%if;wizard;
%end;
%end;
%let;index;%item.3;%in;
%let;so;%item.1;%in;
%let;access;%apply;get_value(index, "access")%in;
%let;sex;%apply;get_value(index, "sex")%in;
%apply;tags(index,"1",item.1)%nn;
%nn;
%apply;get_value(index, "first_name")%sp;
%apply;get_value(index, "surname")%nn;
%( Occurence number is hidden of those lists for the moment
%let;occ;%apply;get_value(index, "occ")%in;%nn;
%if;(occ!="0")%sp;%[%occ;%]%end;%)%nn;
%if;(evar.dates="on")
%apply;get_value(index, "dates")%nn;
%end;
%if;(evar.parents="on")
%let;fa;%apply;get_value(index, "father")%in;
%let;mo;%apply;get_value(index, "mother")%in;
%if;(fa!="" or mo!=""), %sp;
%let;fa;%if;(fa="")?%else;%fa;%end;%in;
%let;mo;%if;(mo="")?%else;%mo;%end;%in;
%apply;a_of_b%with;
%if;(sex=0)[son/daughter/child]0
%elseif;(sex=1)[son/daughter/child]1
%else;[son/daughter/child]2%end;
%and;%fa; [and] %mo;
%end;
%end;
%end;
%end;
%include;trl
%include;copyr
%include;js