%( $Id: deslist_list.txt mickroue(a)yahoo.fr 20140513 templ=templm %)

%( %import;ancsosa_deslist %)
%( begin $Id: ancsosa_deslist.txt mickroue(a)yahoo.fr 20140513 templ=templm %)

%let;birth_symbol;%if;(bvar.birth_symbol != "")%bvar.birth_symbol;%else;&deg;%end;%in;
%let;death_symbol;%if;(bvar.death_symbol != "")%bvar.death_symbol;%else;&dagger;%end;%in;

%define;married_to(is_male, date_place)
  %if;("is_male" = 1)
    %if;are_married;[married%t to:::date_place]0%nn;
    %elseif;are_not_married;[relationship%t to:::date_place]0%nn;
    %elseif;are_engaged;[engaged%t to:::date_place]0%nn;
    %elseif;is_no_sexes_check;[relationship%t to:::date_place]0%nn;
    %elseif;is_no_mention;date_place [with]%nn;
    %end;
  %else;
    %if;are_married;[married%t to:::date_place]1%nn;
    %elseif;are_not_married;[relationship%t to:::date_place]1%nn;
    %elseif;are_engaged;[engaged%t to:::date_place]1%nn;
    %elseif;is_no_sexes_check;[relationship%t to:::date_place]1%nn;
    %elseif;is_no_mention;date_place [with]%nn;
    %end;
  %end;
  %if;are_divorced;… [divorced]%divorce_date;%nn;
  %elseif;are_separated;… [separated]%nn;
  %end;
%end;

%define;married(xx)
  %if;(evar.sd = "on")
    %apply;link_marriage("xx")%nn;
    %if;are_divorced;… [divorced]%divorce_date;%nn;
    %elseif;are_separated;… [separated]%nn;
    %end;
  %else;
    %apply;married_to%with
      %xx.is_male;
    %and;
      %if;(on_marriage_date != "") %on_marriage_date;%end;
      %if;(marriage_place != "") [in (place)] %marriage_place;%end;
    %end;
  %end;
%end;

%define;link1(xx,yy,fff)
  <strong>%nn;
  %if;(cancel_links or xx.is_restricted)
    <a id="ifff" href="">%yy;</a>%nn;
  %else;
    <a id="ifff" href="%prefix;%xx.access;">%yy;</a>%nn;
  %end;
  </strong>%nn;
%end;

%define;link2(xx,yy)
  %if;(cancel_links or xx.is_restricted)%yy;
  %else;
    <a href="%prefix;%xx.access;">%yy;</a>%nn;
  %end;
  %xx.title;%if;(evar.sd = "on")%apply;link_dates("xx")%nn;%else;%xx.dates;%end;
  %if;(xx.sosa_in_list != "" and evar.only != "on" and level != 2)
    %sp;(&rArr;
    <strong>
      <a href="#i%xx.sosa_in_list;" title="[see] %xx.sosa_in_list;">%xx.sosa_in_list;</a>%nn;
    </strong>.)%nn;
  %end;
%end;

%define;somebody_long_info(xx)
  %if;xx.has_qualifiers;
    %apply;lazy_print(", ")
    %foreach;xx.qualifier;
      %if;not is_first;
        %if;(lazy_printed)/%end;
        %lazy_force;
        %qualifier;%nn;
      %end;
    %end;
  %end;
  %if;xx.has_aliases;
    %apply;lazy_print(", ")
    %foreach;xx.alias;
      %if;(lazy_printed)/%end;
      %lazy_force;
      <em><strong>%alias;</strong></em>%nn;
    %end;
  %end;
  %if;(xx.has_nobility_titles)
    <em>%foreach;xx.nobility_title;, %nobility_title;%end;</em>%nn;
  %end;
  %if;(xx.has_linked_pages and xx.has_linked_page.HEAD), %xx.linked_page.HEAD;%end;
  %if;(xx.has_public_name or xx.has_qualifiers), <em>(%xx.first_name; %xx.surname;)</em>%end;
  %if;(evar.alias="on")
    <small>%nn;
    %if;xx.has_first_names_aliases;
      %apply;lazy_print(", ")
      %foreach;xx.first_name_alias;
        %if;(lazy_printed)/%end;
        %lazy_force;
        %first_name_alias;%nn;
      %end;
    %end;
    %if;xx.has_surnames_aliases;
      %apply;lazy_print(", ")
      %foreach;xx.surname_alias;
        %if;(lazy_printed)/%end;
        %lazy_force;
        %surname_alias;%nn;
      %end;
    %end;
    </small>%nn;
  %end;
  %if;(xx.computable_age), %xx.age;%end;
  %if;(evar.sd = "on")
    , %apply;link_dates("xx")%nn;
  %else;
    %if;(xx.has_birth_date or xx.has_birth_place)
      , %if;xx.is_male;[born]0%elseif;xx.is_female;[born]1%else;[born]2%end;
      %if;xx.has_birth_date; %xx.on_birth_date;%end;
      %if;xx.has_birth_place; [in (place)] %xx.birth_place;%end;
    %end;
    %if;(xx.has_baptism_date or xx.has_baptism_place)
      , %if;xx.is_male;[baptized]0%elseif;xx.is_female;[baptized]1%nn;
      %else;[baptized]2%end;
      %if;xx.has_baptism_date; %xx.on_baptism_date;%end;
      %if;xx.has_baptism_place; [in (place)] %xx.baptism_place;%end;
    %end;
    %if;xx.is_dead;, %xx.died;
      %if;(xx.has_death_date) %xx.on_death_date;%end;
      %if;(xx.has_death_place) [in (place)] %xx.death_place;%end;
    %end;
    %if;xx.is_buried;,
      %if;xx.is_male;[buried]0%else;[buried]1%end;
      %if;xx.has_burial_date; %xx.on_burial_date;%end;
      %if;xx.has_burial_place; [in (place)] %xx.burial_place;%end;
    %end;
    %if;xx.is_cremated;,
      %if;xx.is_male;[cremated]0%else;[cremated]1%end;
      %if;xx.has_cremation_date; %xx.on_cremation_date;%end;
      %if;xx.has_cremation_place; [in (place)] %xx.cremation_place;%end;
    %end;
  %end;
  %if;(xx.has_linked_pages and xx.has_linked_page.DEATH), %xx.linked_page.DEATH;%end;
  %if;(xx.computable_death_age)
    , [age at death:] %xx.death_age;%nn;
  %end;
%end;

%define;somebody_extra_info(xx)
  %if;xx.has_occupation;, <span class="highlight1">%xx.occupation;</span>%end;
  %if;(xx.has_linked_pages and xx.has_linked_page.OCCU), %xx.linked_page.OCCU;%end;
  %if;(evar.rel = "on" and xx.has_relations)
    %foreach;xx.relation;%nn;
       ; %relation_type; :
      %if;has_relation_him;
        %apply;link2("relation_him","relation_him")
      %end;
      %if;has_relation_her;
        %if;has_relation_him;, %end;
        %apply;link2("relation_her","relation_her")
      %end;
    %end;
    %foreach;xx.related;%nn;
      %if;(related_type != [foster son/foster daughter/foster child]0
         and related_type != [foster son/foster daughter/foster child]1
         and related_type != [foster son/foster daughter/foster child]2)
         ; %related_type; :
         %apply;link2("related","related")
      %end;
    %end;
  %end;
%end;

%define;somebody_spouse_parent()
  %if;(evar.parents = "on")
    %if;(spouse.has_parents)
      <br%/><small>[parents] : %apply;link2("spouse.father","spouse.father") [and] %apply;link2("spouse.mother","spouse.mother")</small>
    %elseif;(evar.sd = "on" and wizard and not cancel_links)
      %sp;<a href="#mi%spouse.index;" title="[add::parents]"
      onclick="window.open('%prefix;m=ADD_PAR;ip=%spouse.index;');"><span class="sure_dates00">--</span></a>
    %end;
  %end;
%end;

%define;link_dates(xx)
  %sp;
  %if;(wizard and not cancel_links)
    <a id="mi%xx.index;" class="date" href="#mi%xx.index;" title="[modify::person/persons]0"
       onclick="window.open('%prefix;m=MOD_IND;i=%xx.index;');">%nn;
  %end;
  %apply;lazy_print(birth_symbol)
  %if;(xx.has_birth_date or xx.has_baptism_date)
    %if;(xx.birth_date.year != "")<tt class="sure_dates%xx.has_linked_page.BIRTHA;%if;(xx.birth_date.prec != "") not_sure_dates%end;">%lazy_force;</tt>%xx.slash_birth_date;%nn;
    %elseif;(xx.baptism_date.year != "")<tt class="sure_dates0 %if;(xx.baptism_date.prec != "") not_sure_dates%end;">%lazy_force;</tt>%xx.slash_baptism_date;%nn;
    %end;
  %end;
  %if;(xx.has_birth_place or xx.has_baptism_place)
    %sp;%lazy_force;%if;xx.has_birth_place;%xx.birth_place;%elseif;xx.has_baptism_place;%xx.baptism_place;%end;
  %end;
  %let;l1;%if;lazy_printed; %end;%in;
  %if;(xx.is_dead)
    %l1;
    %apply;lazy_print(death_symbol)
    %if;(xx.has_death_date or xx.has_burial_date)
      %if;(xx.death_date.year != "")<tt class="sure_dates%xx.has_linked_page.DEATHA;%if;(xx.death_date.prec != "") not_sure_dates%end;">%lazy_force;</tt>%xx.slash_death_date;%nn;
      %elseif;(xx.burial_date.year != "")<tt class="sure_dates0 %if;(xx.burial_date.prec != "") not_sure_dates%end;">%lazy_force;</tt>%xx.slash_burial_date;%nn;
      %end;
    %end;
    %if;(xx.has_death_place or xx.has_burial_place)
      %sp;%lazy_force;%if;xx.has_death_place;%xx.death_place;%elseif;xx.has_burial_place;%xx.burial_place;%end;
    %end;
  %end;
  %let;l2;%if;lazy_printed; %end;%in;
  %if;(wizard and not cancel_links)
    %if;(l1 = "" and l2 = "") - %end;
    </a>%nn;
    %if;("xx" = "ancestor" or "xx" = "self" or "xx" = "child")
      %sp;<a style="color:#FF0000;" href="#mi%xx.index;" title="[add::family/families]0"
        onclick="window.open('%prefix;m=ADD_FAM;ip=%xx.index;');"><span class="sure_dates00">&amp;&amp;</span></a>%nn;
    %end;
  %end;
%end;

%define;link_marriage(xx)
  %if;(wizard and not cancel_links)
    <a id="mf%family.index;" class="date" href="#mf%family.index;"
      title="[modify::family/families]0"
      onclick="window.open('%prefix;m=MOD_FAM;i=%family.index;;ip=%index;;');">%nn;
      <span class="sure_dates%xx.has_linked_page.MARRIAGEA;%xx.spouse.has_linked_page.MARRIAGEA;
        %if;(marriage_date.prec != "" or on_marriage_date = "" or marriage_place = "") not_sure_dates%end;">&amp;</span>%nn;
      %slash_marriage_date; %marriage_place;
    </a>
  %else;
    <span class="sure_dates%xx.has_linked_page.MARRIAGEA;%xx.spouse.has_linked_page.MARRIAGEA;
      %if;(marriage_date.prec != "" or on_marriage_date = "" or marriage_place = "") not_sure_dates%end;">&amp;</span>%nn;
    %slash_marriage_date; %marriage_place;
  %end;
%end;

%define;somebody_notes(xx,yy)
  %if;(evar.inline = "on")
    %incr_count;
    %if;(evar.notes = "on")
      %if;(xx.has_notes or xx.has_linked_page.BNOTE)
        <div class="inot">
          %if;xx.has_linked_page.BNOTE;&gt;&gt; %xx.linked_page.BNOTE;%end;
          %if;xx.has_notes;%xx.notes;%end;
        </div>
      %end;
    %end;
    %if;(evar.src = "on")
      %if;(xx.has_sources or xx.has_linked_page.BIBLIO)
        <div class="isrc">
          %if;xx.has_linked_page.BIBLIO;&gt;&gt; %xx.linked_page.BIBLIO;%end;
          %if;(xx.has_sources)
            %foreach;xx.source
              <em>• %source_type; : </em>%source;%sp;
            %end;
          %end;
        </div>
      %end;
    %end;
  %elseif;((evar.notes = "on" and (xx.has_notes or xx.has_linked_page.BNOTE))
        or (evar.src = "on" and (xx.has_sources or xx.has_linked_page.BIBLIO)))
      <sup><a href="#nyy">yy</a></sup>%nn;
  %end;
  %if;(evar.image = "on" and xx.has_image)<div style="clear:both;"></div>%end;
%end;

%define;inline_comment()
  %incr_count;
  <div class="icom">%comment;</div>
%end;

%define;marriage_info()
  %if;(evar.rel = "on" and has_witnesses)
    <div>[witness/witnesses]1 :
    %foreach;witness;
      %if;(not is_first),%nl;%end;
      %apply;link2("witness","witness")
    %end;
    </div>
  %end;
  %if;(has_comment and evar.notes = "on" and evar.inline = "on")
    %apply;inline_comment()
  %end;
%end;

%define;init_count(prev_count)
  %reset_count;
  %for;i;0;prev_count;
    %incr_count;
  %end;
%end;

%define;link_comment(z1)
  %if;(has_comment and evar.notes = "on" and evar.inline != "on")
    <sup><a id="iz1" href="#nz1">z1</a></sup>%nn;
  %end;
%end;

%define;bcomment(z1,z2)
  %if;(has_comment and evar.notes = "on")
    <dt><a id="nz2" href="#iz2">z2</a>. %z1; &amp;%marriage_date.year; %spouse;</dt>
    <dd>%comment;</dd>
  %end;
%end;

%define;bnotes(z1,z2)
  %if;((evar.notes = "on" and (z1.has_notes or z1.has_linked_page.BNOTE))
         or (evar.src = "on" and (z1.has_sources or z1.has_linked_page.BIBLIO)))
    <dt><a id="nz2" href="#iz2">z2</a>. %z1;%z1.dates;</dt>
    %if;(evar.notes = "on" and (z1.has_notes or z1.has_linked_page.BNOTE))
      %if;(z1.has_linked_page.BNOTE)<dd>&gt;&gt; %z1.linked_page.BNOTE;</dd>%end;
      %if;(z1.has_notes)<dd>%z1.notes;</dd>%end;
    %end;
    %if;(evar.src = "on" and (z1.has_sources or z1.has_linked_page.BIBLIO))
      %if;(z1.has_linked_page.BIBLIO)<dd class="xs">&gt;&gt; %z1.linked_page.BIBLIO;</dd>%end;
      %if;(z1.has_sources)
        %foreach;z1.source;
          <dd class="xs">• <em>%source_type; : </em>%source;</dd>
        %end;
      %end;
    %end;
  %end;
%end;

%define;image(xx)
  %if;(evar.image="on" and xx.has_image)
    <img class="image" src="%xx.image_url;" alt="[image/images]0" title="%xx;"%/>%nn;
  %end;
%end;

%( end $Id: ancsosa_deslist.txt mickroue(a)yahoo.fr 20140513 templ=templm %)
%( <!-- Begin define --> %)

%define;bnotes2(xx, curlev, maxlev)
  %incr_count;
  %apply;bnotes("xx",count)
  %foreach;xx.family;
    %if;(evar.spouse="on")
      %incr_count;
      %let;id_fam;x%family_cnt;-%count;%in;
      %apply;bcomment("xx",id_fam)
      %apply;bnotes("spouse",count)
    %end;
    %if;(curlev < maxlev)
      %if;(curlev = 0 or
           evar.t = "M" and xx.is_male or
           evar.t = "F" and xx.is_female or
           evar.t = "L" and evar.t1 = "1" and xx.has_sosa or
           evar.t = "L" and evar.t1 = "")
        %if;(family.desc_level = curlev and has_children)
          %family.set_infinite_desc_level;
          %foreach;child;
            %if;(evar.t1 = "" or
                 evar.t1 = "1" and evar.siblings = "on" or 
                 evar.t1 = "1" and evar.siblings != "on" and has_sosa)
              %apply;bnotes2("child", curlev+1, maxlev)
            %end;
          %end;
        %end;
      %end;
    %end;
  %end;
%end;

%define;bnotes1()
  %if;(evar.inline != "on" and (evar.notes = "on" or evar.src = "on"))
    %reset_desc_level;
    %reset_count;
    <hr%/>
    <h3>%if;(evar.notes = "on")[*note/notes]1
          %if;(evar.src = "on")[and] [source/sources]1%end;
        %else;[*source/sources]1%end;</h3>
    <dl>%apply;bnotes2("self",0,l_v)</dl>
  %end;
%end;

%define;descendants_by_list(xx, yy, curlev, maxlev)
  %if;(curlev = 0)<div>%nl;%end;
  %apply;image("xx")
  %incr_count;
  %apply;link1("xx","yy",count)
  %apply;somebody_long_info("xx")
  %apply;somebody_extra_info("xx")
  %apply;somebody_notes("xx",count)
  %foreach;xx.family;
    %if;(evar.spouse="on")
      <div class="f1">
      %if;(family_cnt != 1 and curlev = 0)<div>%nl;%end;
      %apply;married("xx")
      %incr_count;
      %let;id_fam;x%family_cnt;-%count;%in;
      %apply;link_comment(id_fam)
      <br%/>%nn;
      %apply;image("spouse")
      %apply;link1("spouse","spouse",count)
      %apply;somebody_long_info("spouse")
      %apply;somebody_extra_info("spouse")
      %apply;somebody_spouse_parent()
      %apply;somebody_notes("spouse",count)
      %apply;marriage_info()
      </div>
    %end;
    %if;(curlev < maxlev)
      %if;(curlev = 0 or
           evar.t = "M" and xx.is_male or
           evar.t = "F" and xx.is_female or
           evar.t = "L" and evar.t1 = "1" and xx.has_sosa or
           evar.t = "L" and evar.t1 = "")
        %if;(family.desc_level < curlev)
          &rArr; [see further]
          %apply;lazy_print%with;<br%/>%nl;%end;
        %elseif;(family.desc_level > curlev)
          &rArr; [see above]
          %apply;lazy_print%with;<br%/>%nl;%end;
        %elseif;has_children;
          %family.set_infinite_desc_level;
          %if;(curlev = 0)</div>%nl;%end;
          <ol style="list-style-type:lower-latin;padding-left:1.2em;">
          %foreach;child;
            %if;(evar.t1 = "" or
                 evar.t1 = "1" and evar.siblings = "on" or 
                 evar.siblings != "on" and has_sosa)
              <li class="li_%sex; li_%has_families;%has_sosa;">
                %apply;descendants_by_list("child", let_child, curlev+1, maxlev)
              </li>
            %end;
          %end;
          </ol>
          %apply;lazy_print%with;%end;
        %else;
          %if;(curlev = 0)%nl;</div>%nl;
          %else;%apply;lazy_print%with;<br%/>%nl;%end;
          %end;
        %end;
      %end;
    %else;%nl;
      %apply;lazy_print%with;<br%/>%nl;%end;
    %end;
  %end;
%end;

%define;by_list(xx)
  <p>
  %if;(evar.t = "F")
    [*male line/female line]1<br%/>
  %elseif;(evar.t = "M")
    [*male line/female line]0<br%/>
  %elseif;(evar.t1 = "1" and has_sosa)
    [*branch/branches]0 : Sosa<br%/>
  %end;
  %if;(evar.l = "")
    %apply;togen(xx)
  %elseif;(has_sosa)
    [up to] %sosa_ref; %sosa_ref.dates;
  %end;
  </p>
  %reset_count;
  %apply;descendants_by_list("self", "self", 0, xx)%nl;
  %if;(evar.t1 != "1")
    <p>
      %foreach;descendant_level;
        %if;(level = l_v)
          [*total] : %number_of_descendants; [[person/persons]1@(c)]
        %end;
      %end;
    </p>
  %end;
%end;
%( <!-- End define --> %)

%apply;by_list(l_v)
%apply;bnotes1()
