<!-- $Id: modules/notes.txt v 7.00 15/01/2017 20:07:23 hg -->
%( op_m=1 Notes and marriage comments %)
%( op_m=2 Notes and event notes (+comments for marriages) %)
%let;op_m;%if;(op_m!="")%op_m;%else;%if;(has_families or bvar.display_timeline="yes")1%end;%else;2%end;%in;

%reset_count;
%if;has_linked_page.BNOTE;%incr_count;%end;
%if;has_notes;%incr_count;%end;
%if;has_birth_note;%incr_count;%end;
%if;has_baptism_note;%incr_count;%end;
%if;has_death_note;%incr_count;%end;
%if;has_burial_note;%incr_count;%end;
%if;has_linked_page.NOTE;%incr_count;%end;
%foreach;event;
  %if;event.has_note;%incr_count;%end;
%end;
%reset_count2;
%foreach;family;
  %if;has_comment;%incr_count2;%end;
  %if;has_marriage_note;%incr_count2;%end;
%end;

%define;link_pages()
  %if;(not cancel_links and has_linked_pages)
    <div id ="link_pages" class="ml-auto d-flex align-items-center">
      (<a href="%prefix;m=LINKED;%access;">[linked pages]</a>)
    </div>
  %end;
%end;

%if;(op_m=1 and (wizard or friend or bvar.no_note_for_visitor = "" or bvar.no_note_for_visitor = "no") and
      (has_notes or has_linked_page.BNOTE or has_linked_page.NOTE or count2>0))
  %if;(count>0 or has_linked_page.BNOTE and linked_page.BNOTE!="")
    <div class="d-flex justify-content-start">
      <h2 class="mt-2">[*individual notes]</h2>
      %apply;link_pages()
    </div>
    %if;(has_linked_page.BNOTE and linked_page.BNOTE!="")
      <p>%apply;capitalize(linked_page.BNOTE).</p>
    %end;
    <div class="ml-3">
      %notes;
    </div>
  %end;
  %if;(count2>0 and has_families)
    %( On remet les compteurs à zéro, on démarre à 1 - synchro avec unions.txt %)
    %reset_count;
    %foreach;family;
      %incr_count;
      %if;((wizard or friend or bvar.no_note_for_visitor="" or bvar.no_note_for_visitor="no") and has_comment)
        %if;(count=1 or count2=1 and (has_notes or has_linked_page.BNOTE or has_linked_page.NOTE))
          <h2>%if;(nb_families>1)[*marriage notes/marriages notes]1%else;[*marriage notes/marriages notes]0%end;</h2>
        %end;
        <dl>
          <dt>
            %if;(not cancel_links)
              <a href="#wed-callnote-%count;" id="note-wed-%count;" style="text-decoration:none" title="[see] [marriage/marriages]0">^
              </a>
            %else;^
            %end;
            %if;(nb_families>1)%apply;nth([nth (generation)], count) [marriage with]%else;[*marriage with]%end; %spouse.first_name; %spouse.surname;
            [:]
          </dt>
          <dd>%comment;</dd>
        </dl>
      %end;
    %end;
  %end;
  %if;(has_linked_page.NOTE and linked_page.NOTE!="")
    <p>%apply;capitalize(linked_page.NOTE).</p>
  %end;
%elseif;((count>0 or count2>0) and op_m=2)
  <h3 id="notes" class="mt-2">[*note/notes]1</h3>
    %if;(has_linked_page.BNOTE and linked_page.BNOTE!="")
      <blockquote>%apply;capitalize(linked_page.BNOTE).</blockquote>
    %end;
    %if;has_notes;
      <h2>[*individual notes]</h2>
      <blockquote>%notes;</blockquote>
    %end;
    %if;has_birth_note;
      <h3>[*birth]</h3>
      <blockquote>%birth_note;</blockquote>
    %end;
    %if;has_baptism_note;
      <h3>[*baptism]</h3>
      <blockquote>%baptism_note;</blockquote>
    %end;
    %foreach;family;
      %if;(has_comment or has_marriage_note)
        <h3>[*marriage notes/marriages notes]0%sp;
        [with] %spouse.first_name; %spouse.surname;</h3>
      %end;
      <blockquote>%nn;
        %if;has_comment;%comment;%end;
        %if;(has_comment and has_marriage_note)%nl;%end;
        %if;has_marriage_note;%marriage_note;%end;
      </blockquote>
    %end;
    %if;has_death_note;
      <h3>[*death]</h3>
      <blockquote>%death_note;</blockquote>
    %end;
    %if;(has_burial_note and is_buried)
      <h3>[*burial]</h3>
      <blockquote>%burial_note;</blockquote>
    %elseif;(has_burial_note and is_cremated)
      <h3>[*cremation]</h3>
      <blockquote>%burial_note;</blockquote>
    %end;
    %foreach;event;
      %if;event.has_note;
        %if;(event.name!=[birth] and
             event.name!=[baptism] and
             event.name!=[marriage event] and
             event.name!=[death] and
             event.name!=[burial] and
             event.name!=[cremation])
          <h3>%apply;capitalize(event.name)</h3>
          <blockquote>%event.note;</blockquote>
        %end;
      %end;
    %end;
    %if;(has_linked_page.NOTE and linked_page.NOTE!="")
      <blockquote>%apply;capitalize(linked_page.NOTE).</blockquote>
    %end;
  %nl;
%end;
%reset_count;