%doctype;
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <!-- $Id: ancsosa.txt, Template x v 6.07c 2013/02/19 12:00:00 ddr/dd Exp $ -->
  <!-- copyright (c) 1998-2013 INRIA -->
  <title>%nn;
    %if;(evar.t = "D")
      [*ancestors] ... [up to] ...%nn;
    %elseif;(evar.t = "N" and evar.only = "on")
      [*generation/generations]0 %evar.v;
    %else;
      %apply;a_of_b%with;
        %if;(evar.t = "M")
          %if;(evar.evt = "on")[*missing events]%else;[*missing ancestors]%end;
        %else;[*ancestors]
        %end;
      %and;
        %if;(public_name != "")%public_name;%else;%first_name;%end;
        %if;(qualifier != "") %qualifier;%end;
        %sp;%surname;
      %end;
    %end;
  </title>
  <meta name="robots" content="none"%/>
  <meta http-equiv="Content-Style-Type" content="text/css"%/>
  <meta http-equiv="Content-Type" content="text/html; charset=%charset;"%/>
  <link rel="shortcut icon" href="%image_prefix;/favicon_gwd.png"%/>
%include.css;
  <style type="text/css"><!--
  --></style>
%base_header;
</head>

%define;image_sosa(xxx,yyy)
  <img src="%image_prefix;/sosa.png" width="10" height="10"%sp;
    style="border: none" alt=""%sp;
    title="%if;(yyy=1)%else;[direct ancestor of %s:::xxx], %end;[*Sosa] yyy"%/>%nn;
%end;

%define;display_sosa(xx)
  %if;(bvar.display_sosa="" or bvar.display_sosa="yes")
    %if;xx.has_sosa;
      %if;not cancel_links;<a href="%prefix;%xx.sosa_link;">%end;
      %apply;image_sosa%with;%sosa_ref.first_name_key_strip;%sp;
                             %sosa_ref.surname_key_strip;
                        %and;%xx.sosa;%end;
      %if;not cancel_links;</a>%end;%sp;
    %end;
  %end;
%end;

%define;image_MF(xx,wi_he)
  %if;(wizard and not cancel_links and not xx.is_restricted)
    <a href="%prefix;m=MOD_IND;i=%xx.index;">%end;
  %if;xx.is_male;
    <img src="%image_prefix;/male.png" title="[M/F]0"%sp;
  %elseif;xx.is_female;
    <img src="%image_prefix;/female.png" title="[M/F]1"%sp;
  %else;
    <img src="%image_prefix;/sexunknown.png" title="?"%sp;
  %end;
         width="wi_he" height="wi_he" style="border: none" alt=""%/>%nn;
  %if;(wizard and not cancel_links and not xx.is_restricted)</a>%end;
  %sp;
%end;

%define;display_arrows()
  %if;not cancel_links;
    <table style="float: %right;" border="%border;"><tr><td>
      %if;has_referer;
        <a href="%referer;"><img style="border-width: thin" alt="" title="&lt;&lt;"%sp;%nn;
          src="%image_prefix;/left.png"%wid_hei;left.png;%/></a>
      %end;
      <a href="%prefix;"><img style="border-width: thin" alt="" title="^^"%sp;
        src="%image_prefix;/up.png"%wid_hei;up.png;%/></a>
      <a href="%url;cgl=on" target="_blank"><img style="border-width: thin"%sp;
        src="%image_prefix;/right.png"%wid_hei;right.png; alt="" title="[cancel GeneWeb links]"%/></a>
    </td></tr></table>
  %end;
%end;

%define;tothegen(xx)
  [*to the %s generation:::xx]%nn;
%end;

%define;thegen(xx)
  [*the %s generation:::xx]%nn;
%end;

%define;togena(xx)
  %if;(xx = 1)[*specify::generation/generations]0%nn;
  %elseif;(xx = 2)[*to the parents]%nn;
  %elseif;(xx = 3)[*to the grandparents]%nn;
  %elseif;(xx = 4)[*to the great-grandparents]%nn;
  %else;
    %apply;tothegen%with;
      %apply;nth([nth (generation)], xx)
    %end;
  %end;
%end;

%define;gena(xx)
  %if;(xx = 1)[*specify::generation/generations]0%nn;
  %elseif;(xx = 2)[*the parents]%nn;
  %elseif;(xx = 3)[*the grandparents]%nn;
  %elseif;(xx = 4)[*the great-grandparents]%nn;
  %else;
    %apply;thegen%with;
      %apply;nth([nth (generation)], xx)
    %end;
  %end;
%end;

%define;letter(xx)
  %apply;nth%with;
    /a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z
  %and;xx%end;
%end;

%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;
%end;

%define;short_display_person(xx)
  %apply;display_sosa("xx")
  %if;(xx.index=central_index)<b>%xx;</b>%else;
    %if;(cancel_links or xx.is_restricted)%xx;
    %else;<a href="%prefix;%xx.access;">%xx;</a>%end;
  %end;%sp;
  %xx.title;%xx.dates;
%end;

%define;very_short_display_person(xx)
  %apply;display_sosa("xx")
  %if;(xx.index=central_index)<b>%xx;</b>%else;
    %if;(cancel_links or xx.is_restricted)%xx;
    %else;<a href="%prefix;%xx.access;">%xx;</a>%end;
  %end;
%end;

%define;very_short_display_person_name(xx)
  %apply;display_sosa("xx")
  %if;(xx.index=central_index)<b>%xx_name;</b>%else;
    %if;(cancel_links or xx.is_restricted)%xx_name;
    %else;<a href="%prefix;%xx.access;">%xx_name;</a>%end;
  %end;
%end;

%define;short_display_generations()
  %if;(evar.only != "on")
    <p>
    %apply;togena(nb_gena).
    </p>
  %end;
  %reset_count;
  %foreach;ancestor_level(nb_gena)
    %if;(evar.only != "on" or level = nb_gena)
      %nl;
      <b>[*generation/generations]0 %level;</b>
      <ul>
        %foreach;ancestor;
          <li class="%if;ancestor.has_parents;goway%else;noway%end;">%nn;
            %if;(ancestor.interval != "")
              %ancestor.interval;
            %else;
              %if;(ancestor.same = "")%incr_count;%end;
              %if;(evar.sosab = 16)%ancestor.anc_sosa.hexa;
              %elseif;(evar.sosab = 8)%ancestor.anc_sosa.octal;
              %else;%ancestor.anc_sosa;%end;%sp;
              %if;(ancestor.same != "")=&gt;%else;-%end;%sp;
              %apply;image_MF("ancestor","13")
              %if;(ancestor.same = "")
                %apply;short_display_person("ancestor")
              %else;
                %if;not cancel_links;<a href="%prefix;%ancestor.access">%end;
                %ancestor.same;
                %if;not cancel_links;</a>%end;
              %end;
            %end;
          </li>
        %end;
      </ul>
   %end;
  %end;
  <p style="clear:both;">[*total] : %count; [[person/persons]1@(c)]</p>
%end;

%define;somebody_long_info(xx)
  %if;xx.has_aliases;
    %foreach;xx.alias;, [alias] <em>%alias;</em>%end;
  %end;
  %if;(("xx" = "ancestor" or xx.sosa_in_list = "") and xx.has_nobility_titles)
    <em>%nn;
    %foreach;xx.nobility_title;, %nobility_title;%end;
    </em>%nn;
  %end;
  %if;(xx.has_birth_date or xx.has_birth_place)
    , %apply;nth([born],xx.sex)
    %if;xx.has_birth_date; %xx.on_birth_date;%end;
    %if;xx.has_birth_place; - %xx.birth_place;%end;
  %end;
  %if;(xx.has_baptism_date or xx.has_baptism_place)
    , %apply;nth([baptized],xx.sex)
    %if;xx.has_baptism_date; %xx.on_baptism_date;%end;
    %if;xx.has_baptism_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; - %xx.death_place;%end;
    %if;(xx.has_linked_page.DEATH !="") %xx.linked_page.DEATH;%end;
    %if;xx.computable_death_age; [age at death:] %xx.death_age;%end;
    %if;xx.is_buried;
      , %apply;nth([buried],xx.sex)
      %if;xx.has_burial_date; %xx.on_burial_date;%end;
      %if;xx.has_burial_place; - %xx.burial_place;%end;
    %end;
    %if;xx.is_cremated;
      , %apply;nth([cremated],xx.sex)
      %if;xx.has_cremation_date; %xx.on_cremation_date;%end;
      %if;xx.has_cremation_place; - %xx.cremation_place;%end;
    %end;
  %end;
%end;

%define;somebody_extra_info(xx)
  %if;xx.has_occupation;, %apply;capitalize(xx.occupation)%end;
  %if;(xx.has_linked_page.OCCU)
    %apply;capitalize(xx.linked_page.OCCU)%nl;
  %end;
  %if;(evar.rel = "on" and xx.has_relations)
    %foreach;xx.relation;%nl;
      (%relation_type; :%sp;
      %if;has_relation_him;
        %apply;image_MF("relation_him","13")
        %apply;short_display_person("relation_him")
        %if;(relation_him.sosa_in_list != ""),%sp;
          [see]%sp;
          %if;not cancel_links;<a href="#%relation_him.sosa_in_list;">%end;
          %relation_him.sosa_in_list;
          %if;not cancel_links;</a>%end;
        %end;
      %end;
      %if;has_relation_her;
        %if;has_relation_him; , %end;
        %apply;image_MF("relation_her","13")
        %apply;short_display_person("relation_her")
        %if;(relation_her.sosa_in_list != ""),%sp;
          [see]%sp;
          %if;not cancel_links;<a href="#%relation_her.sosa_in_list;">%end;
          %relation_her.sosa_in_list;
          %if;not cancel_links;</a>%end;
        %end;
      %end;)%sp;
    %end;
    %foreach;xx.related;%nl;
      (%related_type;:
      %apply;image_MF("related","13")
      %apply;short_display_person("related")
      %if;(related.sosa_in_list != ""),%sp;
        [see]%sp;
        %if;not cancel_links;<a href="#%related.sosa_in_list;">%end;
        %related.sosa_in_list;
        %if;not cancel_links;</a>%end;
      %end;)%sp;
    %end;
  %end;
%end;

%define;somebody(xx)
  %apply;image_MF("xx","13")
  %apply;very_short_display_person("xx")
  %apply;somebody_long_info("xx")
  %apply;somebody_extra_info("xx")
%end;

%define;somebody_spouse_parent(xx)
  %apply;image_MF("spouse.xx","13")
  %apply;short_display_person("spouse.xx")
  %if;(spouse.xx.sosa_in_list != "")%sp;
    ([see]%sp;
    %if;not cancel_links;<a href="#%spouse.xx.sosa_in_list;">%end;
    %spouse.xx.sosa_in_list;
    %if;not cancel_links;</a>%end;
    )%nn;
  %end;
%end;

%define;somebody_notes_and_sources(xx)
  <dd>
    %if;(evar.notes = "on")
      %if;(xx.has_linked_page.BNOTE or xx.has_notes or xx.has_linked_page.NOTE)
        <table><tr><td>%nn;
          %if;(xx.has_linked_page.BNOTE)<p>%apply;capitalize(xx.linked_page.BNOTE).</p>%end;
          %if;(xx.has_notes)%xx.notes;%end;
          %if;(xx.has_linked_page.NOTE)<p>%apply;capitalize(xx.linked_page.NOTE).</p>%end;
        </td></tr></table>
      %end;
    %end;
    %if;(evar.src = "on")
      %if;(xx.has_sources)
        <em style="font-size:80%%">[*source/sources]1:
          <ul>
            %foreach;xx.source;
              <li>%apply;capitalize(source_type): %source;</li>
            %end;
          </ul>
        </em>
      %end;
      %if;xx.has_linked_page.BIBLIO;<p>%apply;capitalize(xx.linked_page.BIBLIO).</p>%end;
    %end;
  </dd>
  <br%>
%end;

%define;long_display_ancestor_personal()
  %apply;somebody("ancestor").
  %if;(evar.only != "on" and ancestor.father_sosa != "")
    [*parents] :%sp;
    %if;not cancel_links;<a href="#%ancestor.father_sosa;">%end;
    %ancestor.father_sosa;
    %if;not cancel_links;</a>%end;
    %sp;[and]%sp;
    %if;not cancel_links;<a href="#%ancestor.mother_sosa;">%end;
    %ancestor.mother_sosa;.%nn;
    %if;not cancel_links;</a>%end;
  %end;
  %if;(((evar.notes="on")
        and (ancestor.has_linked_page.BNOTE or ancestor.has_notes or ancestor.has_linked_page.NOTE))
       or
       (evar.src="on" and ancestor.has_sources))
    %if;(evar.inline = "on")
      %apply;somebody_notes_and_sources("ancestor")
    %else;
      %[%ns;%sp;
      %if;not cancel_links;<a href="#notes-%ancestor.anc_sosa.v;">%end;
      %ancestor.anc_sosa;
      %if;not cancel_links;</a>%end;
      %].%nn;
    %end;
  %end;
  %if;(evar.siblings = "on")
    %foreach;ancestor.family;
      %if;(ancestor.index = index or family.index != ancestor.family.index)
        %apply;capitalize%with;
          %apply;married_to%with;
            %ancestor.is_male;
          %and;
            %if;(ancestor.index != index) (%family_cnt;)%end;
            %if;(on_marriage_date != "") %on_marriage_date;%end;
            %if;(marriage_place != ""), %marriage_place;, %end;
          %end;%sp;
        %end;
        %apply;somebody("spouse")%nn;
        %if;spouse.has_parents;,%sp;
          %apply;a_of_b%with;
            %if;spouse.is_male;[son/daughter/child]0
            %else;[son/daughter/child]1%end;
          %and;
            %apply;somebody_spouse_parent("father") [and]%sp;
            %apply;somebody_spouse_parent("mother")
          %end;
        %end;
        %if;(evar.witn = "on" and has_witnesses)
          %sp;%nl;([witness/witnesses]1 :%sp;
          %foreach;witness;
            %if;(not is_first),%nl;%end;
            %apply;image_MF("witness","13")
            %apply;short_display_person("witness")
          %end;
          )%nn;
        %end;
        %if;(evar.comm = "on" and has_comment)
          ,%sp;(%comment;)%nn;
        %end;
        .%nn;
      %end;
    %end;
  %end;
%end;

%define;child_long_info(spec)
  %apply;image_MF("child","13")
  %if;(bvar.always_surname="yes")
    %apply;very_short_display_person("child")
  %else;
    %apply;very_short_display_person_name("child")
  %end;
  %apply;somebody_long_info("child")
  %if;(child.sosa_in_list != "").%nn;
    %if;(evar.only != "on")
      [*see]%sp;
      %if;not cancel_links;<a href="#%child.sosa_in_list;">%end;
      %child.sosa_in_list;
      %if;not cancel_links;</a>%end;
      .%nn;
    %end;
  %else;
    %foreach;child.family;
      %apply;somebody_extra_info("child"),%sp;
      %apply;capitalize%with;
        %apply;married_to%with;
          %child.is_male;
        %and;
          %if;(on_marriage_date != "") %on_marriage_date;%end;
          %if;(marriage_place != ""), %marriage_place;, %end;
        %end;%sp;
      %end;
      %apply;somebody("spouse")%nn;
      %if;spouse.has_parents;,%sp;
        %apply;a_of_b%with;
          %if;spouse.is_male;[son/daughter/child]0
          %else;[son/daughter/child]1%end;
        %and;
          %apply;somebody_spouse_parent("father") [and]%sp;
          %apply;somebody_spouse_parent("mother")
        %end;
        .%nn;
      %end;
      %if;are_divorced; [*divorced]0%divorce_date;
      %elseif;are_separated; [*separated]0%nl;%end;
      .%nn;
    %end;
    %if;(((evar.notes="on")
          and (child.has_linked_page.BNOTE or child.has_notes or child.has_linked_page.NOTE))
         or
         (evar.src="on" and child.has_sources))
      %if;(evar.inline = "on")
        %apply;somebody_notes_and_sources("child")
      %else;
        %[%ns;%sp;
        %if;not cancel_links;
          <a href="#notes-%ancestor.anc_sosa.v;
            %if;("spec" != "")-spec%end;
            %apply;letter(child_cnt)">%nn;
        %end;
        %ancestor.anc_sosa;
        %if;("spec" != "")-spec%end;
        %apply;letter(child_cnt)
        %if;not cancel_links;</a>%end;
        %].%nn;
      %end;
    %end;
  %end;
%end;

%define;long_display_ancestor_families()
  %if;ancestor.is_male;
    ...
    %foreach;ancestor.family;
      %if;(family.index = ancestor.family.index)
        %apply;married_to%with
          %ancestor.is_male;
        %and;
          %if;(on_marriage_date != "") %on_marriage_date;%end;
          %if;(marriage_place != ""), %marriage_place;, %end;
        %end;...
      %end;
    %end;
  %else;
    %foreach;ancestor.family;
      %if;(family.index = ancestor.family.index)
        ...
        %if;(evar.witn = "on" and has_witnesses)([witness/witnesses]1:
          %foreach;witness;
            %if;(not is_first),%nl;%end;
            %apply;image_MF("witness","13")
            %apply;short_display_person("witness")
          %end;),
        %end;
        %if;(evar.comm = "on" and has_comment)
          %sp;(%comment;)%nl;
        %end;
        [having as children] : %nn;
          <ol style="list-style-type:lower-latin">
            %foreach;child;
              %if;(evar.siblings = "on" or child.sosa_in_list != "")
                <li>%apply;child_long_info("")</li>
              %end;
            %end;
          </ol>
      %end;
    %end;
    %if;(evar.siblings = "on")
      %( father's other children %)
      %foreach;ancestor.spouse.family;
        %if;(spouse.index != ancestor.index and nb_children > 0)
          ... [having as children] : %nn;
          %if;not cancel_links;<a href="#%family.father.sosa_in_list;">%end;
          %family.father.sosa_in_list;
          %if;not cancel_links;</a>%end;
          %sp;(X %family_cnt; [with] %spouse;) :
            <ol style="list-style-type:lower-latin">
              %foreach;child;
                <li>%apply;child_long_info(family_cnt)</li>
              %end;
            </ol>
        %end;
      %end;
      %( mother's other children %)
      %foreach;ancestor.family;
        %if;(spouse.index != ancestor.spouse.index and nb_children > 0)
          ... [having as children] : %nn;
          %if;not cancel_links;<a href="#%family.mother.sosa_in_list;">%end;
          %family.mother.sosa_in_list;
          %if;not cancel_links;</a>%end;
          %sp;(X %family_cnt; [with] %spouse;) :
          <ol style="list-style-type:lower-latin">
            %foreach;child;
              <li>%apply;child_long_info(family_cnt)</li>
            %end;
          </ol>
        %end;
      %end;
    %end;
  %end;
%end;

%define;child_notes_and_sources(spec)
  %if;(child.sosa_in_list = "")
  %if;(((evar.notes="on")
        and (child.has_linked_page.BNOTE or child.has_notes or child.has_linked_page.NOTE))
       or
       (evar.src="on" and child.has_sources))
      %nl;<br%/>
      <dt>%ns;%sp;
        %if;not cancel_links;
          <a href="#%ancestor.anc_sosa.v;" id="notes-%ancestor.anc_sosa.v;
            %if;("spec" != "")-spec%end;
            %apply;letter(child_cnt)">%nn;
        %end;
        %ancestor.anc_sosa;
        %if;("spec" != "")-spec%end;
        %apply;letter(child_cnt)
        %if;not cancel_links;</a>%end;
        %sp;<span style="font-size:80%%">(%child; %child.dates;)</span> :%sp;
      </dt>
      %apply;somebody_notes_and_sources("child")
    %end;
  %end;
%end;

%define;long_display_notes_and_sources()
  <h3 id="ns">%ns;</h3>
  <dl>
  %foreach;ancestor_level;
    %if;(nb_gena != "" and level <= nb_gena
         and (evar.only != "on" or level = nb_gena))
      %foreach;ancestor;
        %if;(ancestor.same = "")
          %if;(((evar.notes="on")
                and (ancestor.has_linked_page.BNOTE or ancestor.has_notes or ancestor.has_linked_page.NOTE))
               or
               (evar.src="on" and ancestor.has_sources))
            %nl;<br%/>
            <dt>%ns;%sp;
              %if;not cancel_links;
                <a href="#%ancestor.anc_sosa.v;" id="notes-%ancestor.anc_sosa.v;">%nn;
              %end;
              %ancestor.anc_sosa;
              %if;not cancel_links;</a>%end;
              %sp;<span style="font-size:80%%">(%ancestor; %ancestor.dates;)</span> :%sp;
            </dt>
            %apply;somebody_notes_and_sources("ancestor")
          %end;
        %end;
        %if;(evar.siblings = "on" and
          ancestor.is_female and ancestor.same = "")
          %( siblings %)
          %if;(ancestor.index != self.index)
            %foreach;ancestor.family;
              %if;(family.index = ancestor.family.index)
                %foreach;child;
                  %apply;child_notes_and_sources("")
                %end;
              %end;
            %end;
            %( father's other families %)
            %foreach;ancestor.spouse.family;
              %if;(spouse.index != ancestor.index)
                %foreach;child;
                  %apply;child_notes_and_sources(family_cnt)
                %end;
              %end;
            %end;
            %( mother's other families %)
            %foreach;ancestor.family;
              %if;(spouse.index != ancestor.spouse.index)
                %foreach;child;
                  %apply;child_notes_and_sources(family_cnt)
                %end;
              %end;
            %end;
          %end;
        %end;
      %end;
    %end;
  %end;
  </dl>
%end;

%define;long_display_images()
  <h3 id="img">[*image/images]1</h3>
  %reset_count;
  <table>
    %foreach;ancestor_level;
      %if;(evar.v != "" and level <= evar.v and (evar.only != "on" or level = evar.v))
        %foreach;ancestor;
          %if;(ancestor.same = "" and ancestor.has_image)
            %if;(count = 0)
              <tr>
            %end;
            %incr_count;
                <td style="text-align:center">%nn;
                  %if;not cancel_links;<a href="%ancestor.image_html_url;">%end;
                  <img src="%ancestor.image_url;"%sp;
                       %ancestor.image_size; style="border: none" %nn;
                       alt="" title="[image/images]0"%/>
                  %if;not cancel_links;</a>%end;
                  <br%/>%nn;
                  %apply;image_MF("ancestor", "13")
                  %apply;short_display_person("ancestor")
                </td>
            %if;(count >= 4)
              %reset_count;
              </tr>
            %end;
          %end;
        %end;
      %end;
    %end;
    %if;(count !=0)
      </tr>
    %end;
  </table>
%end;

%define;long_display_generations()
  %( long display generations %)
  %let;ns;
     %if;(evar.notes="on" and evar.src="on")[*note/notes]1 [and] [*source/sources]1%nn;
      %elseif;(evar.notes="on")[*note/notes]1%nn;
      %elseif;(evar.src="on")[*source/sources]1%nn;
      %end;
  %in;
  %if;not cancel_links;
    %if;(((evar.notes = "on" or evar.src = "on") and evar.inline != "on") or evar.image = "on")
      <p class="not_printable">
        [*see] : <a href="#asc">[*ancestors]</a>%sp;%nn;
        %if;((evar.notes = "on" or evar.src = "on") and evar.inline != "on")
          | <a href="#ns">%ns;</a>
        %end;
        %if;(evar.image = "on")
          | <a href="#img">[*image/images]1</a>
        %end;
      </p>
    %end;
  %end;
  %if;(evar.only != "on")
    <p id="asc">
    %apply;togena(nb_gena).
    </p>
  %end;
  %foreach;ancestor_level(nb_gena)
    %if;(evar.only != "on" or level = nb_gena)
      <b>[*generation/generations]0 %level;</b>
      %foreach;ancestor;
        %nl;
        <p id="%ancestor.anc_sosa.v;">
          %if;(ancestor.same != "")
            %ancestor.anc_sosa; : %nn;
            [see]%sp;
            %if;not cancel_links;<a href="#%ancestor.same.v;">%end;
            %ancestor.same;.%nn;
            %if;not cancel_links;</a>%end;
          %else;
            %ancestor.anc_sosa;%sp;
            %apply;long_display_ancestor_personal()
            %if;(ancestor.index != self.index)
              %apply;long_display_ancestor_families()
            %end;
          %end;
        </p>
      %end;
      <br%/>
    %end;
  %end;
  %if;(evar.inline != "on" and (evar.notes = "on" or evar.src = "on"))
    <p><hr%/></p>
    %apply;long_display_notes_and_sources()
  %end;
  %if;(evar.image = "on")
    <p><hr%/></p>
    %apply;long_display_images()
  %end;
%end;

%define;interval_dates(xxx, yyy)
  %if;(evar.after != "" and evar.before != "")
    %sp; [living between %s and %s:::xxx:yyy]
  %elseif;(evar.before != "")
    %sp; [living before %s:::yyy]
  %elseif;(evar.after != "")
    %sp; [living after %s:::xxx]
  %else;
    %( On n'affiche rien %)
  %end;
%end;

%define;dates_in_interval(xx)
  %if;(evar.after != "" and
       ((xx.birth_date.year     = "" and
         xx.baptism_date.year   = "" and
         xx.death_date.year     = "" and
         xx.burial_date.year    = "" and
         xx.cremated_date.year  = "") or
        (xx.birth_date.year    != "" and xx.birth_date.year    < evar.after) or
        (xx.baptism_date.year  != "" and xx.baptism_date.year  < evar.after) or
        (xx.death_date.year    != "" and xx.death_date.year    < evar.after) or
        (xx.burial_date.year   != "" and xx.burial_date.year   < evar.after) or
        (xx.cremated_date.year != "" and xx.cremated_date.year < evar.after))
       or
       evar.before != "" and
       ((xx.birth_date.year     = "" and
         xx.baptism_date.year   = "" and
         xx.death_date.year     = "" and
         xx.burial_date.year    = "" and
         xx.cremated_date.year  = "") or
        (xx.birth_date.year    != "" and xx.birth_date.year    > evar.before) or
        (xx.baptism_date.year  != "" and xx.baptism_date.year  > evar.before) or
        (xx.death_date.year    != "" and xx.death_date.year    > evar.before) or
        (xx.burial_date.year   != "" and xx.burial_date.year   > evar.before) or
        (xx.cremated_date.year != "" and xx.cremated_date.year > evar.before)))dates_KO%nn;
  %else;dates_OK%end;
%end;

%define;living_interval_dates(xxx, yyy)
  %if;(evar.after != "" and evar.before != "")
    ,%sp;[living between %s and %s:::xxx:yyy]
  %elseif;(evar.before != "")
    ,%sp;[living before %s:::yyy]
  %elseif;(evar.after != "")
    ,%sp;[living after %s:::xxx]
  %else; %( On n'affiche rien %)
  %end;
%end;

%define;ancestor_missing_birth(xx)
  %if;(xx.has_birth_date or xx.has_birth_place)
    %if;xx.has_birth_date; %xx.slash_birth_date;%end;
    %if;xx.has_birth_place; - %xx.birth_place;%end;
  %else;&nbsp;%end;
%end;

%define;ancestor_missing_death(xx)
  %if;xx.is_dead;
    %if;xx.has_death_date; %xx.slash_death_date;%end;
    %if;xx.has_death_place; - %xx.death_place;%end;
  %else;&nbsp;%end;
%end;

%define;display_missing_ancestor_info(xx)
  %if;(evar.birth = "on")
    <td>%apply;ancestor_missing_birth("xx")</td>
  %end;
  %if;(evar.death = "on")
    <td>%apply;ancestor_missing_death("xx")</td>
  %end;
  %if;(evar.spouse = "on")
    <td>
      %if;xx.has_families;
        %if;(not xx.has_parents and xx.first_name != "?" and xx.surname != "?")
          %foreach;xx.family;
            %if;(spouse.first_name != "?" and spouse.surname != "?")
              %if;(family_cnt > 1)<br%/>%sp;%end;
              %apply;image_MF("spouse", "13")
              %apply;very_short_display_person("spouse")
            %end;
          %end;
        %end;
      %end;
    </td>
  %end;
%end;

%define;missing_ancestors_alphabetically()
  %( missing ancestors alphabetically %)
  <p>
    %apply;togena(nb_gena)
    %apply;living_interval_dates(evar.after, evar.before).
  </p>
  %if;not cancel_links;
    <div class="not_printable" style="margin-bottom:25px;">
      <table class="display_search">
        <tr>
          <td><b>[*sort by/generation/alphabetic order]0</b></td>
          <td><img src="%image_prefix;/picto_branch.png"%/></td>
          <td><a href="%prefix;&amp;m=A&amp;p=%first_name_key;&amp;n=%surname_key;&amp;oc=%evar.oc;
                       &amp;t=%evar.t;&amp;v=%evar.v;&amp;birth=%evar.birth;&amp;death=%evar.death;
                       &amp;spouse=%evar.spouse;&amp;al=">%nn;
              [sort by/generation/alphabetic order]1</a></td>
          <td><img src="%image_prefix;/picto_alphabetic_order.png"%/></td>
          <td>[sort by/generation/alphabetic order]2</td>
        </tr>
      </table>
    </div>
  %end;
  %empty_sorted_list;
  %reset_count;
  %foreach;ancestor_level(nb_gena)
    %foreach;ancestor;
      %if;(ancestor.same = "")
        %if;(((not ancestor.has_parents and ancestor.first_name != "?" and ancestor.surname != "?" and level < nb_gena) or
             ((ancestor.has_parents) and
              ((ancestor.father.first_name = "?" and ancestor.father.surname = "?") or
               (ancestor.mother.first_name = "?" and ancestor.mother.surname = "?")))) or
             (ancestor.has_families and ancestor.spouse.first_name = "?" and ancestor.spouse.surname = "?"))
          %if;(0<1) %( todo dates_in_interval %)
            %incr_count;
            %apply;add_in_sorted_list%with
              %ancestor.surname_end;
              %and;%ancestor.first_name;
              %and;%ancestor.surname_begin;
              %and;%ancestor.access;
              %and;%apply;image_MF("ancestor", "13")
              %and;%ancestor.nobility_title;
              %and;%apply;ancestor_missing_birth("ancestor")
              %and;%apply;ancestor_missing_death("ancestor")
              %and;
                %if;((not ancestor.has_parents and ancestor.first_name != "?" and ancestor.surname != "?" and level < nb_gena) or
                    ((ancestor.has_parents) and
                     ((ancestor.father.first_name = "?" and ancestor.father.surname = "?") or
                      (ancestor.mother.first_name = "?" and ancestor.mother.surname = "?"))))
                  %if;(not ancestor.has_parents)
                    [*parents] %expr(ancestor.anc_sosa.v * 2)&nbsp;-&nbsp;%expr(ancestor.anc_sosa.v * 2 + 1)
                  %elseif;((ancestor.father.first_name = "?" and ancestor.father.surname = "?") and
                           (ancestor.mother.first_name = "?" and ancestor.mother.surname = "?"))
                    [*parents] %expr(ancestor.anc_sosa.v * 2)&nbsp;-&nbsp;%expr(ancestor.anc_sosa.v * 2 + 1)
                  %elseif;(ancestor.father.first_name = "?" and ancestor.father.surname = "?")
                    [*father/mother]0 %expr(ancestor.anc_sosa.v * 2)
                  %elseif;(ancestor.mother.first_name = "?" and ancestor.mother.surname = "?")
                    [*father/mother]1 %expr(ancestor.anc_sosa.v * 2 + 1)
                  %else;
                    %sp;
                  %end;
                %else;
                  %sp;
                %end;
              %and;
                %if;(ancestor.has_families and ancestor.spouse.first_name = "?" and ancestor.spouse.surname = "?")
                  %apply;nth([*husband/wife],ancestor.spouse.sex)
                  %if;(ancestor.sex = "0") %expr(ancestor.anc_sosa.v + 1)
                  %elseif;(ancestor.sex = "1") %expr(ancestor.anc_sosa.v -1)
                  %end;
                %else;%sp;%end;
              %and;%apply;display_sosa("ancestor")
            %end;
          %end;
        %end;
      %end;
    %end;
  %end;

  %if;not cancel_links;
    %if;(count > 100)
      <p>
        %foreach;sorted_list_item;
          %if;(initial(prev_item.1) != initial(item.1))
            <a href="#a_%apply;hexa(initial(item.1))">%apply;initial(item.1)</a>
          %end;
        %end;
      </p>
    %end;
  %end;

  <table class="missing_ancestors_table">
    %reset_count;
    %nl;
    <tr class="missing_ancestors_table_header">
      %incr_count;
      <th>[*person/persons]0</th>
      %if;(evar.birth = "on")
        %incr_count;
        <th>[*birth date and birth place]</th>
      %end;
      %if;(evar.death = "on")
        %incr_count;
        <th>[*death date and death place]</th>
      %end;
      <th>%incr_count;[*missing parents]</th>
      <th>%incr_count;[*missing spouse]</th>
    </tr>
    %let;nb_col;%count;%in;
    %reset_count;
    %foreach;sorted_list_item;
      %incr_count;
      %if;(initial(prev_item.1) != initial(item.1))
        %nl;
        <tr id="a_%apply;hexa(initial(item.1))">
          <td colspan="%nb_col"><b>%apply;initial(item.1)</b></td>
        </tr>
      %end;
      %nl;
      <tr>
        <td>%nn;
          %if;not cancel_links;
            %item.5;%item.11;<a href="%prefix;%item.4;">%item.1;%sp;%item.2;</a>%item.3;
          %else;
            %item.5;%item.11;%item.1;%sp;%item.2;%item.3;
          %end;
          %if;(item.6 != ""), <em>%item.6;</em>%end;
        </td>
        %if;(evar.birth = "on")
          <td>%item.7;</td>
        %end;
        %if;(evar.death = "on")
          <td>%item.8;</td>
        %end;
        <td align="center">%item.9;</td>
        <td align="center">%item.10;</td>
      </tr>
    %end;
  </table>
  %empty_sorted_list;
  <p style="clear:both;">[*total] : %count; [[person/persons]1@(c)]</p>
%end;

%define;missing_ancestors_by_generation()
  %( missing ancestors by generation %)
  <p>
    %apply;togena(nb_gena)
    %apply;interval_dates(evar.after, evar.before)
  </p>
  %if;not cancel_links;
    <div class="not_printable" style="margin-bottom:25px;">
      <table class="display_search">
        <tr>
          <td><b>[*sort by/generation/alphabetic order]0</b></td>
          <td><img src="%image_prefix;/picto_branch.png"%/></td>
          <td>[sort by/generation/alphabetic order]1</td>
          <td><img src="%image_prefix;/picto_alphabetic_order.png"%/></td>
          <td><a href="%prefix;&amp;m=A&amp;p=%first_name_key;&amp;n=%surname_key;&amp;oc=%evar.oc;
                       &amp;t=%evar.t;&amp;v=%evar.v;&amp;birth=%evar.birth;&amp;death=%evar.death;
                       &amp;spouse=%evar.spouse;&amp;al=on">%nn;
              [sort by/generation/alphabetic order]2</a></td>
        </tr>
      </table>
    </div>
  %end;
  <table class="missing_ancestors_table">
    <tr class="missing_ancestors_table_header">
      %reset_count;
      <th>[*missing sosa]</th>
      %incr_count;
      <th>[*missing parents]</th>
      %incr_count;
      <th>[*missing spouse]</th>
      %incr_count;
      <th>[*person/persons]0</th>
      %incr_count;
      %if;(evar.birth = "on")
        <th>[*birth date and birth place]</th>
        %incr_count;
      %end;
      %if;(evar.death = "on")
        <th>[*death date and death place]</th>
        %incr_count;
      %end;
      %if;(evar.spouse = "on")
        <th>[*spouse/spouses]1</th>
        %incr_count;
      %end;
      %let;nb_col;%count;%in;
      %reset_count;
    </tr>
    %foreach;ancestor_level(nb_gena - 1)
      %apply;lazy_print%with;
        %nl;
        <tr>
          <td colspan="%nb_col"><b>[*generation/generations]0 %level;</b></td>
        </tr>
      %end;
      %foreach;ancestor;
        %if;(ancestor.same = "")
          %if;(ancestor.first_name != "?" and ancestor.surname != "?")
            %if;(level < nb_gena)
              %if;((not ancestor.has_parents) or
                    ((ancestor.father.first_name = "?" and ancestor.father.surname = "?") or
                     (ancestor.mother.first_name = "?" and ancestor.mother.surname = "?")))
                %( missing ancestor(s) %)
                %if;(0<1) %( todo dates_in_interval %)
                  %lazy_force;
                  %nl;
                  <tr>
                    %incr_count;
                    %if;((not ancestor.has_parents) or
                          ((ancestor.father.first_name = "?" and ancestor.father.surname = "?") and
                           (ancestor.mother.first_name = "?" and ancestor.mother.surname = "?")))
                      <td>%expr(ancestor.anc_sosa.v * 2)&nbsp;-&nbsp;%expr(ancestor.anc_sosa.v * 2 + 1)</td>
                      <td style="text-align:center">[*parents]</td>
                    %elseif;(ancestor.father.first_name = "?" and ancestor.father.surname = "?")
                      <td>%expr(ancestor.anc_sosa.v * 2)</td>
                      <td style="text-align:center">[*father/mother]0</td>
                    %elseif;(ancestor.mother.first_name = "?" and ancestor.mother.surname = "?")
                      <td>%expr(ancestor.anc_sosa.v * 2 + 1)</td>
                      <td style="text-align:center">[*father/mother]1</td>
                    %end;
                    <td>%sp;</td>
                    <td>%nn;
                      %apply;image_MF("ancestor","13")
                      %apply;very_short_display_person("ancestor")
                    </td>
                    %apply;display_missing_ancestor_info("ancestor")
                  </tr>
                %end;
              %end;
            %end;
          %end;
          %if;(ancestor.has_parents)
            %if;(ancestor.father.first_name = "?" and ancestor.father.surname = "?")
              %( mother without spouse %)
              %if;(0<1) %( todo dates_in_interval %)
                %lazy_force;
                %incr_count;
                %nl;
                <tr>
                  <td>%expr(ancestor.anc_sosa.v * 2)</td>
                  <td>%sp;</td>
                  <td style="text-align:center">[*husband/wife]0</td>
                  <td>%nn;
                    %apply;image_MF("ancestor.mother","13")
                    %apply;very_short_display_person("ancestor.mother")
                  </td>
                  %apply;display_missing_ancestor_info("ancestor.mother")
                </tr>
              %end;
            %end;
            %if;(ancestor.mother.first_name = "?" and ancestor.mother.surname = "?")
              %( father without spouse %)
              %if;(0<1) %( todo dates_in_interval %)
                %lazy_force;
                %incr_count;
                %nl;
                <tr>
                  <td>%expr(ancestor.anc_sosa.v * 2 + 1)</td>
                  <td>%sp;</td>
                  <td style="text-align:center">[*husband/wife]1</td>
                  <td>%nn;
                    %apply;image_MF("ancestor.father","13")
                    %apply;very_short_display_person("ancestor.father")
                  </td>
                  %apply;display_missing_ancestor_info("ancestor.father")
                </tr>
              %end;
            %end;
          %end;
        %end;
      %end;
    %end;
  </table>
  <p style="clear:both;">[*total] : %count; [[person/persons]1@(c)]</p>
%end;

%define;ancestors_up_to_somebody()
  %( ancestors up to somebody %)
  %pvar.1.mark_descendants;
  <ul>
  %foreach;ancestor_level;
    %apply;lazy_print%with;
      <li>[*generation/generations]0 %level;%nl;
      <ul>
    %end;
    %if;(level <= evar.l + 1)
      %foreach;ancestor;
        %if;(ancestor.same = "" and ancestor.is_descendant)
          %lazy_force;
          <li>%ancestor.anc_sosa; -%sp;
          %apply;image_MF("ancestor","13")
          %apply;display_sosa("ancestor")
          %if;not cancel_links;<a href="%prefix;%ancestor.access;">%end;
          %ancestor;
          %if;not cancel_links;</a>%end;
          %sp;
          %ancestor.title;%ancestor.dates;
          </li>
        %end;
      %end;
    %end;
    %if;lazy_printed;</ul>%nl;</li>%nl;%end;
  %end;
  </ul>
%end;

%define;ascend_table_header()
  %nl;
  <tr class="ascends_table_header">
    <th>[*Sosa]</th>%nl;
    %( do not put %incr_count; here to obtain finally nb_col - 1 %)
    <th>[*person/persons]0</th>%nl;
    %incr_count;
    %if;(evar.birth = "on")
      <th>[*date of birth]</th>%nl;
      %incr_count;
    %end;
    %if;(evar.birth_place = "on")
      <th>[*where born]</th>%nl;
      %incr_count;
    %end;
    %if;(evar.marr = "on")
      <th>[*spouse/spouses]1</th>%nl;
      %incr_count;
    %end;
    %if;(evar.marr_date = "on")
      <th>[*date of marriage]</th>%nl;
      %incr_count;
    %end;
    %if;(evar.marr_place = "on")
      <th>[*where married]</th>%nl;
      %incr_count;
    %end;
    %if;(evar.child = "on")
      <th>[*child/children]1</th>
      %incr_count;
    %end;
    %if;(evar.death = "on")
      <th>[*date of death]</th>%nl;
      %incr_count;
    %end;
    %if;(evar.death_place = "on")
      <th>[*where dead]</th>%nl;
      %incr_count;
    %end;
    %if;(evar.death_age = "on")
      <th>[*age at death]</th>%nl;
      %incr_count;
    %end;
    %if;(evar.occu = "on")
      <th>[*occupation/occupations]1</th>%nl;
      %incr_count;
    %end;
  </tr>
%end;

%define;ascend_table_row(xx)
  %let;rowsp;
    %if;(xx.nb_families>1)
      %sp;rowspan="%xx.nb_families" style="vertical-align: middle"%else;%end;
  %in;
  %foreach;xx.family;
    %nl;
    <tr%if;(family_cnt=1) id="xx_%xx.anc_sosa.v;"%end;>
      %if;(family_cnt=1)
        <td%rowsp;>%nn;
          %if;(evar.sosab = 16)%xx.anc_sosa.hexa;
          %elseif;(evar.sosab = 8)%xx.anc_sosa.octal;
          %else;%xx.anc_sosa;%end;
        </td>
      %end;
      %if;(xx.same = "" or evar.no_repeat != "on")
        %if;(family_cnt=1)
          %incr_count;
          <td%rowsp;>%nn;
            %apply;image_MF("xx","13")
            %apply;very_short_display_person("xx")
          </td>
          %if;(evar.birth = "on")
            <td%rowsp;>%nn;
              %if;xx.has_birth_date;%xx.slash_birth_date;%else;%sp;%end;
            </td>
          %end;
          %if;(evar.birth_place = "on")
            <td%rowsp;>%nn;
              %if;xx.has_birth_place;%xx.birth_place;%else;%sp;%end;
            </td>
          %end;
        %end;
        %if;(evar.marr = "on")
          <td>%nn;
            %apply;image_MF("spouse","13")
            %apply;very_short_display_person("spouse")
          </td>
        %end;
        %if;(evar.marr_date = "on")
          <td>%nn;
            %if;(on_marriage_date="")%sp;
            %else;%slash_marriage_date;%end;
          </td>
        %end;
        %if;(evar.marr_place = "on")
          <td>%nn;
            %if;(marriage_place="")%sp;
            %else;%marriage_place;%end;
          </td>
        %end;
        %if;(evar.child = "on")
          <td style="text-align:center">%nn;
            %nb_children;
          </td>
        %end;
        %if;(family_cnt=1)
          %if;(evar.death = "on")
            <td%rowsp;>%nn;
              %if;xx.has_death_date;%xx.slash_death_date;%else;%sp;%end;
            </td>
          %end;
          %if;(evar.death_place = "on")
            <td%rowsp;>%nn;
              %if;xx.has_death_place;%xx.death_place;%else;%sp;%end;
            </td>
          %end;
          %if;(evar.death_age = "on")
            <td%rowsp;>%nn;
              %if;xx.computable_death_age;%xx.death_age;%else;%sp;%end;
            </td>
          %end;
          %if;(evar.occu = "on")
            <td%rowsp;>%nn;
              %if;xx.has_occupation;
                %apply;capitalize(xx.occupation)%nn;
              %else;%sp;%end;
            </td>
          %end;
        %end;
      %else;
        %if;(family_cnt=1)
          <td colspan="%nb_colm1">%nn;
             [*see]%sp;
            %if;not cancel_links;<a href="#xx_%xx.same.v;">%end;
            %xx.same.v;
            %if;not cancel_links;</a>%end;
          </td>
        %end;
      %end;
    </tr>
  %end;
%end;

%define;ancestors_in_a_table()
  %( ancestors in a table %)
  %if;(evar.only != "on")
    <p>%apply;togena(nb_gena).</p>
  %end;
  <table class="ascends_table">
    %reset_count;
    %apply;ascend_table_header()
    %let;nb_colm1;%count;%in;
    %incr_count;
    %let;nb_col;%count;%in;
    %reset_count;
    %foreach;ancestor_level(nb_gena)
      %if;(evar.only != "on" or level = nb_gena)
        %if;(evar.gen = "on")
          %nl;
          <tr>
            <td colspan="%nb_col">%nn;
              <b>[*generation/generations]0 %level;</b>%nn;
            </td>
          </tr>
        %end;
        %foreach;ancestor;
          %apply;ascend_table_row("ancestor")
        %end;
      %end;
    %end;
  </table>
  <p style="clear:both;">[*total] : %count; [[person/persons]1@(c)]</p>
%end;

%( Main %)

<body%body_prop;>
%let;central_index;%index;%in;
%let;central_person;%first_name_key_strip;%sp;%surname_key_strip;%in;
%let;nb_gena;
  %if;(bvar.max_anc_level = "")%apply;min(evar.v, max_anc_level, 7)
  %else;%apply;min(evar.v, max_anc_level, bvar.max_anc_level)%end;
%in;
%message_to_wizard;

<h1>%nn;
  %apply;a_of_b%with;
    %if;(evar.t = "M")
      %if;(evar.evt = "on")[*missing events]%else;[*missing ancestors]%end;
    %else;[*ancestors]
    %end;
  %and;
    %if;(public_name != "")%public_name;%else;%first_name;%end;
    %if;(qualifier != "") <em>%qualifier;</em>%end;
    %sp;%surname;
    %if;(alias != "") <em>(%alias;)</em>%end;
  %end;
  %if;(evar.t = "D") [up to] %pvar.1;%end;
</h1>

%apply;display_arrows()

%if;(evar.v <= 1)
  [*specify::generation/generations]0.
%else;
  %if;(evar.t = "N")
    %apply;short_display_generations()
  %elseif;(evar.t = "G")
    %apply;long_display_generations()
  %elseif;(evar.t = "M" and evar.al = "on")
    %apply;missing_ancestors_alphabetically()  
  %elseif;(evar.t = "M" and evar.evt = "on")
    %include.miss_evt;
  %elseif;(evar.t = "M")
    %apply;missing_ancestors_by_generation()
  %elseif;(evar.t = "D")
    %apply;ancestors_up_to_somebody()
  %elseif;(evar.t = "Z")
    %apply;ancestors_in_a_table()
  %elseif;(evar.t = "P")
    %include.perso_short;
  %end;
%end;

%base_trailer;
%copyright;
</body>
</html>