{% extends 'base.html.twig' %}

{% block title 'attribution.title'|trans %}

{% block body %}
  <h1>{{ block('title') }}</h1>
  <p>
    {% if app_name() == 'Postmill' %}
      {{- 'attribution.summary'|trans({
        '%site_name%': site_name()|e,
        '%app%': '<a href="%s" rel="external">%s%s</a>'|format(
          app_website()|e,
          app_name()|e,
          (app_version() is not empty ? (' '~app_version()))|e
        ),
      })|raw -}}
    {% else %}
      {{- 'attribution.summary_fork'|trans({
        '%site_name%': site_name()|e,
        '%postmill%': '<a href="https://postmill.xyz" rel="external">Postmill</a>',
        '%app%': '<a href="%s" rel="external">%s%s</a>'|format(
          app_website()|e,
          app_name()|e,
          (app_version() is not empty ? (' '~app_version()))|e
        ),
      })|raw -}}
    {% endif %}
  </p>

  {% if postmill_license is not empty %}
    <h2>{{ 'attribution.postmill_license'|trans }}</h2>
    <pre class="yes-wrap" lang="en"><kbd>{{ postmill_license }}</kbd></pre>
  {% endif %}

  {% if public_libraries is not empty %}
    <h2>{{ 'attribution.public_libraries'|trans }}</h2>
    <p>{{ 'attribution.public_libraries_summary'|trans }}</p>
    {% for library in public_libraries %}
      <h3>{{ library.name }}</h3>
      {% if library.licenseText is not empty %}
        <details>
          <summary>{{ library.licenseId }}</summary>
          <pre class="yes-wrap" lang="en"><kbd>{{ library.licenseText }}</kbd></pre>
        </details>
      {% else %}
        <p>{{ library.licenseId }}</p>
      {% endif %}
    {% endfor %}
  {% endif %}
{% endblock body %}
