<!--  Union complet -->

%( 
   ATTENTION: on n'utilise pas max_desc_level parce que c'est extremement
   gourmand sur les gros arbre puisqu'on calcule toute la descendance.
   Hors on n'a besoin de seulement savoir s'il y a des arrière petits
   enfant, d'où le code ci-dessous : 
   1 si on a des enfants
   2 si on a des petits enfants
   3 si on a des arrières petits endants
%)
%reset_count;
%if;has_children;
  %incr_count;
  %foreach;family;
    %foreach;child;
      %foreach;family;
        %if;child.has_children;
          %if;(count<2)
            %incr_count;
          %end;
          %foreach;child;
            %foreach;family;
              %if;child.has_children;
                %if;(count<3)
                  %incr_count;
                %end;
              %end;
            %end;
          %end;
        %end;
      %end;
    %end;
  %end;
%end;


%if;has_families;
  <h3 class="highlight">[*marriage/marriages]1%nn;
    %if;(count>0 and count>1)
      , [child/children]1%nn;
      %if;(count>1 and count>2)
        <span style="font-size: 90%%">, [the grandchildren]</span>
      %else
        <span style="font-size: 90%%"> [and::the grandchildren]</span>
      %end;
      %if;(count>2)
        <span style="font-size: 80%%"> [and::the great-grandchildren]</span>
      %end;
    %else;
      %if;has_children; [and::child/children]1%end;
    %end;
  </h3>
  <ul>
    %( On remet les compteurs à zéro et on commence à compter à 1 %)
    %reset_count; %incr_count;
    %foreach;family;
      %apply;li_SD("spouse")
        %if;(wizard)
          <a href="%prefix;m=MOD_FAM;i=%family.index;;ip=%index;">
            <img src="%image_prefix;/picto_molette.png" width="13" height="13" alt="[modify]" title="[modify::family/families]0"%/>
          </a>
        %end;
        %apply;long_married("self")%sp;
        %apply;long_display_person("spouse")%sp;
        %if;spouse.has_parents;
          <span style="font-size: 90%%"><em> ([*parents] :
            %apply;image_MF("spouse.father","13")
            %apply;short_display_person("spouse.father")
            &nbsp;&amp;&nbsp;
            %apply;image_MF("spouse.mother","13")
            %apply;short_display_person("spouse.mother"))</em>%nn;
          </span>
        %end;
        %if;has_witnesses;
          &nbsp;([witness/witnesses]w :
          %foreach;witness;
            %if;not is_first;, %end;
            %apply;image_MF("witness","13")
            %apply;short_display_person("witness")%nl;
          %end;)
        %end;
        %if;((wizard or friend or bvar.no_note_for_visitor="" or bvar.no_note_for_visitor="no") and has_comment) 
          ([see::note/notes]0 <a href="#note-wed-%count;" name="wed-note-%count;" id="wed-note-%count;">%count;</a>)
          %incr_count;
        %end;
        %if;are_divorced;, [divorced]0%divorce_date;%sp;%end;
        %if;are_separated;, [separated]0%sp;%end;
        %if;has_children;[having as children]0
          %( On sauvegarde l'ancienne valeur de count %)
          %let;prev_count;%count;%in;
          <ul>
            %foreach;child;
              %apply;li_SDC("child")
                %apply;image_MF("child","13")
                %apply;short_display_person("child")
                %if;child.has_families;
                  %foreach;child.family;
                    %if;(family_cnt!=1)
                      <img width="13" height="13"%sp;
                        src="%image_prefix;/1pixel.png"  alt=""%/>%sp;
                      <em>%child;%child.title;%child.dates;</em>
                    %end;
                    <em>&nbsp;%apply;long_married("child")</em>
                    %apply;short_display_person("spouse")
                    %if;(nb_children!=0)
                      &nbsp;[having as children]0
                      <div style="font-size: 90%%">
                        <ul>
                          %foreach;child;
                            %apply;li_SDC("child")
                              %apply;image_MF("child","11")
                              %apply;short_display_person("child")
                              %if;child.has_families;
                                %foreach;child.family;
                                  %if;(family_cnt!=1)
                                    <br%/><img width="10" height="10"%sp;
                                            src="%image_prefix;/1pixel.png" alt=""%/>
                                    <em>%child;%child.title;%child.dates;</em>%nl;
                                  %end;
                                  <em>&nbsp;%apply;long_married("child")</em>
                                  %apply;short_display_person("spouse")
                                  %if;(nb_children!=0)
                                    &nbsp;[having as children]0 :
                                    <div style="font-size: 90%%">%nn;
                                      <ul>
                                        %foreach;child;
                                          <li>
                                            %apply;image_MF("child","10")
                                            %apply;short_display_person("child")
                                          </li>
                                        %end;
                                      </ul>
                                    </div>
                                  %end;
                                %end;
                              %end;
                            </li>
                          %end;
                        </ul>
                      </div>
                    %else;
                     <br/>
                    %end;
                  %end;
                %end;
              </li>
            %end;
          </ul>
          %( On rétablie l'ancienne valeur de count %)
          %apply;init_count(prev_count)
        %end;
        %if;(evar.opt = "from" and wizard)<em>(%origin_file;)</em><br%/>%nl;%end;
      </li>
    %end;
  </ul>
%end;
