<commit_before><%inherit file="../base.html"/>
<%namespace file="../helpers/common.html" import="show_title"/>
<%namespace file="../helpers/view.html" import="show_version_comment"/>

<%block name="pagelang">lang="${lang}"</%block>

<%block name="pagetitle"><title>${show_title(title)}</title></%block>

<section class="document-differences">
  <h3 class="text-center" translate>Comparing documents</h3>
  <h2 class="text-center">${title}</h2><br>
  <p class="text-center">
    <a href="${request.route_path(module + '_view_id_lang', id=document_id, lang=lang)}">
      <button class="btn orange-btn" translate>See the latest version</button>
    </a>
  </p>
  <table class="diff_header table table-bordered table-striped">
    <tr>
      <td>
        <a href="${request.route_path(
              module + '_archive', id=document_id, lang=lang,
              version=version1['version_id'])}"><span translate>Revision as of</span> {{'${version1['written_at']}' | amUtc | amLocal | amDateFormat:'L LTS'}}</a><br/>
        <span translate>by</span> <a href="${request.route_path('profiles_view_id', id=version1['user_id'])}">${version1['name']}</a>
        % if version1['comment']:
          <br/><span class="revision-comment" x-translate>${show_version_comment(version1)}</span>
        % endif
        % if previous_version_id:
          <br/><a href="${request.route_path(
              module + '_diff', id=document_id, lang=lang, v1=previous_version_id,
              v2=version1['version_id'])}" translate>previous difference</a>
        % endif
      </td>
      <td>
        <%
            if next_version_id:
                route_path = request.route_path(module + '_archive', id=document_id, lang=lang, version=version2['version_id'])
            else:
                route_path = request.route_path(module + '_view_id_lang', id=document_id, lang=lang)
        %>
        <a href="${route_path}"><span translate>Revision as of</span> {{'${version2['written_at']}' | amUtc | amLocal | amDateFormat:'L LTS'}}</a><br/>
        <span translate>by</span> <a href="${request.route_path('profiles_view_id', id=version2['user_id'])}">${version2['name']}</a>
        % if version2['comment']:
          <br/><span class="revision-comment" x-translate>${show_version_comment(version2)}</span>
        % endif
        % if next_version_id:
          <br/><a href="${request.route_path(
              module + '_diff', id=document_id, lang=lang, v1=version2['version_id'],
              v2=next_version_id)}" translate>next difference</a>
        % endif
      </td>
    </tr>
  </table>

  % if not diffs:
    <p class="bg-info" translate>No content changes.</p>
  % else:
    % for field_diff in diffs:
      <h3 x-translate>${field_diff.field}</h3>
      <div class="diff-container">
      % if field_diff.field == 'geometry':
      <%block name="moduleConstantsValues">
      module.value('mapFeatureCollection', {
        "type": "FeatureCollection",
        "features": [
        %if geometry1:
          {"type": "Feature", "geometry": ${geometry1 | n}, "properties": {"type": "v1"}},
        %endif
        %if geometry2:
          {"type": "Feature", "geometry": ${geometry2 | n}, "properties": {"type": "v2"}}
        %endif
        ]
      });
      </%block>\
      <app-diff-map></app-diff-map>
      <p class="diff-map-legend">
        <span translate>Legend:</span> <span translate>Version 1 in </span> <span class="diff-red" translate>red</span>,
        <span translate>Version 2 in</span> <span class="diff-green" translate>green</span>
      </p>
      % else:
        ${field_diff.html_diff | n}
      % endif
      </div>
    % endfor
  % endif
</section><commit_msg>Hide geometry diff if there is... no diff!<commit_after><%inherit file="../base.html"/>
<%namespace file="../helpers/common.html" import="show_title"/>
<%namespace file="../helpers/view.html" import="show_version_comment"/>

<%block name="pagelang">lang="${lang}"</%block>

<%block name="pagetitle"><title>${show_title(title)}</title></%block>

<section class="document-differences">
  <h3 class="text-center" translate>Comparing documents</h3>
  <h2 class="text-center">${title}</h2><br>
  <p class="text-center">
    <a href="${request.route_path(module + '_view_id_lang', id=document_id, lang=lang)}">
      <button class="btn orange-btn" translate>See the latest version</button>
    </a>
  </p>
  <table class="diff_header table table-bordered table-striped">
    <tr>
      <td>
        <a href="${request.route_path(
              module + '_archive', id=document_id, lang=lang,
              version=version1['version_id'])}"><span translate>Revision as of</span> {{'${version1['written_at']}' | amUtc | amLocal | amDateFormat:'L LTS'}}</a><br/>
        <span translate>by</span> <a href="${request.route_path('profiles_view_id', id=version1['user_id'])}">${version1['name']}</a>
        % if version1['comment']:
          <br/><span class="revision-comment" x-translate>${show_version_comment(version1)}</span>
        % endif
        % if previous_version_id:
          <br/><a href="${request.route_path(
              module + '_diff', id=document_id, lang=lang, v1=previous_version_id,
              v2=version1['version_id'])}" translate>previous difference</a>
        % endif
      </td>
      <td>
        <%
            if next_version_id:
                route_path = request.route_path(module + '_archive', id=document_id, lang=lang, version=version2['version_id'])
            else:
                route_path = request.route_path(module + '_view_id_lang', id=document_id, lang=lang)
        %>
        <a href="${route_path}"><span translate>Revision as of</span> {{'${version2['written_at']}' | amUtc | amLocal | amDateFormat:'L LTS'}}</a><br/>
        <span translate>by</span> <a href="${request.route_path('profiles_view_id', id=version2['user_id'])}">${version2['name']}</a>
        % if version2['comment']:
          <br/><span class="revision-comment" x-translate>${show_version_comment(version2)}</span>
        % endif
        % if next_version_id:
          <br/><a href="${request.route_path(
              module + '_diff', id=document_id, lang=lang, v1=version2['version_id'],
              v2=next_version_id)}" translate>next difference</a>
        % endif
      </td>
    </tr>
  </table>

  % if not diffs:
    <p class="bg-info" translate>No content changes.</p>
  % else:
    % for field_diff in diffs:
      % if field_diff.field == 'geometry':
        % if geometry1 != geometry2:
          <h3 x-translate>${field_diff.field}</h3>
          <div class="diff-container">
            <%block name="moduleConstantsValues">
            module.value('mapFeatureCollection', {
              "type": "FeatureCollection",
              "features": [
              %if geometry1:
                {"type": "Feature", "geometry": ${geometry1 | n}, "properties": {"type": "v1"}},
              %endif
              %if geometry2:
                {"type": "Feature", "geometry": ${geometry2 | n}, "properties": {"type": "v2"}}
              %endif
              ]
            });
            </%block>\
            <app-diff-map></app-diff-map>
            <p class="diff-map-legend">
              <span translate>Legend:</span> <span translate>Version 1 in </span> <span class="diff-red" translate>red</span>,
              <span translate>Version 2 in</span> <span class="diff-green" translate>green</span>
            </p>
          </div>
        % endif
      % else:
        <h3 x-translate>${field_diff.field}</h3>
        <div class="diff-container">
          ${field_diff.html_diff | n}
        </div>
      % endif
    % endfor
  % endif
</section>
{'fraction_non_alphanumeric': 0.1822679338627783, 'fraction_numerical': 0.008853013930477802, 'mean_word_length': 2.871975806451613, 'pattern_counts': {'":': 20, '<': 173, '<?xml version=': 0, '>': 173, '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': '7305109', 'n_tokens_mistral': 2448, 'n_tokens_neox': 2402, 'n_words': 441}