<commit_before><%!
    from c2corg_ui.templates.utils import get_attr
    from json import dumps, loads
    from shapely.geometry import asShape
    from math import floor
    from c2corg_ui.views.document import get_slug
%>

<%def name="show_attr(obj, key, parse=True)">\
  <%
      attr = get_attr(obj, key, md=parse, bb=parse)
      attr = attr if attr else ''
  %>
  ${attr | n}\
</%def>

<%def name="show_archive_data(module, document, locale, version)">\
  <article class="archive-data">
    <h2><span class="glyphicon glyphicon-warning-sign"></span>&nbsp;<span translate>You are viewing an archived version of this document.</span></h2>
    <div class="text-left">
      <p><b translate>Date</b>: {{'${1000 * version['written_at']}' | date:'medium'}} &nbsp;<span translate>by</span>&nbsp; <a href="#TODO">${version['name']}</a></p>
      <p><b translate>Changes</b>: <span x-translate>${show_version_comment(version)}</span></p>
    </div>
    <p class="text-center">
        <a href="${request.route_path(module + '_view_id_lang', id=document['document_id'], lang=locale['lang'])}">
          <button class="btn btn-default" translate>See the latest version</button>
        </a>
    </p>
  </article>
</%def>

<%def name="show_other_langs_links(module, document, other_langs)">\
  % if other_langs:
    <div id="other-langs">
      <div class="modal-header"><h3 class="text-center" translate>View in other lang</h3></div>
      <ul>
        % for l in other_langs:
          <li>
            <a href="${request.route_path(module + '_view_id_lang', id=document['document_id'], lang=l)}" x-translate>${l}</a>
            <span class="glyphicon glyphicon-chevron-right"></span>
          </li>
        % endfor
      </ul>
    </div>
  % endif
</%def>

<%def name="show_missing_langs_links(module, document, missing_langs)">\
  % if missing_langs:<commit_msg>Fix user profile link in archive disclaimer<commit_after><%!
    from c2corg_ui.templates.utils import get_attr
    from json import dumps, loads
    from shapely.geometry import asShape
    from math import floor
    from c2corg_ui.views.document import get_slug
%>

<%def name="show_attr(obj, key, parse=True)">\
  <%
      attr = get_attr(obj, key, md=parse, bb=parse)
      attr = attr if attr else ''
  %>
  ${attr | n}\
</%def>

<%def name="show_archive_data(module, document, locale, version)">\
  <article class="archive-data">
    <h2><span class="glyphicon glyphicon-warning-sign"></span>&nbsp;<span translate>You are viewing an archived version of this document.</span></h2>
    <div class="text-left">
      <p>
        <b translate>Date</b>: {{'${1000 * version['written_at']}' | date:'medium'}} &nbsp;<span translate>by</span>
        <a href="${request.route_path('profiles_view_id', id=version['user_id'])}">${version['name']}</a>
      </p>
      <p><b translate>Changes</b>: <span x-translate>${show_version_comment(version)}</span></p>
    </div>
    <p class="text-center">
        <a href="${request.route_path(module + '_view_id_lang', id=document['document_id'], lang=locale['lang'])}">
          <button class="btn btn-default" translate>See the latest version</button>
        </a>
    </p>
  </article>
</%def>

<%def name="show_other_langs_links(module, document, other_langs)">\
  % if other_langs:
    <div id="other-langs">
      <div class="modal-header"><h3 class="text-center" translate>View in other lang</h3></div>
      <ul>
        % for l in other_langs:
          <li>
            <a href="${request.route_path(module + '_view_id_lang', id=document['document_id'], lang=l)}" x-translate>${l}</a>
            <span class="glyphicon glyphicon-chevron-right"></span>
          </li>
        % endfor
      </ul>
    </div>
  % endif
</%def>

<%def name="show_missing_langs_links(module, document, missing_langs)">\
  % if missing_langs:
{'fraction_non_alphanumeric': 0.18008861089392755, 'fraction_numerical': 0.005212405525149857, 'mean_word_length': 3.6521212121212123, 'pattern_counts': {'":': 0, '<': 109, '<?xml version=': 0, '>': 109, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3852787', 'n_tokens_mistral': 1325, 'n_tokens_neox': 1284, 'n_words': 276}